···696970703. Set up your .env file
71717272- from `apps/web` and `packages/db` you will find .env.example create your own
7272+ from `apps/web` and `packages/db` you will find .env.example create your own.
7373+7474+4. Follow the steps to run your sqlite database locally inside of
7575+ [README.md](https://github.com/openstatusHQ/openstatus/packages/db/README.md)
73767474-4. Start the development server
7777+5. Start the development server
75787679 ```sh
7780 pnpm dev
7881 ```
79828080-5. Open [http://localhost:3000](http://localhost:3000) with your browser to see
8383+6. Open [http://localhost:3000](http://localhost:3000) with your browser to see
8184 the result.
82858386For [clerk](https://clerk.com), you will need to create a webhook endpoint. To
+3-2
apps/web/.env.example
···2323# TINY BIRD for time series data (trackers)
2424TINY_BIRD_API_KEY=tiny-bird-api-key
25252626-# PlanetScale ( or a local mysql database)
2727-DATABASE_URL='mysql://root:password@localhost:3306/openstatus'
2626+# TURSO SQLITE
2727+DATABASE_URL=http://127.0.0.1:8080
2828+DATABASE_AUTH_TOKEN=any-token
28292930# Solves 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY', see https://github.com/nextauthjs/next-auth/issues/3580
3031# NODE_TLS_REJECT_UNAUTHORIZED="0"
···11# DB
2233-Our database package
33+We are using [turso](https://turso.tech) and sqlite as database to store
44+user/page/monitor settings. The timeseries data is stored in a
55+[tinybird](https://tinybird.co) datasource (built on top of ClickHouse).
66+77+## Local Development
88+99+Install the [Turso CLI](https://docs.turso.tech/reference/turso-cli).
1010+1111+For local environment, first
1212+[install sqld](https://github.com/libsql/sqld/blob/main/docs/BUILD-RUN.md).
1313+1414+When installing with Homebrew, follow:
1515+1616+```bash
1717+$ brew tap libsql/sqld
1818+$ brew install sqld-beta
1919+$ sqld --help
2020+```
2121+2222+If you want to keep your database locally, run:
2323+2424+```bash
2525+$ turso dev --db-file openstatus.db
2626+```
2727+2828+It will create a local database in the directory you run the command.
2929+3030+Add the environment variables to inside of the `.env` file in both projects, the
3131+`/apps/web` and `/packages/db`:
3232+3333+```env
3434+DATABASE_URL=http://127.0.0.1:8080
3535+DATABASE_AUTH_TOKEN=any-token # no need to change token
3636+```
3737+3838+Start the migration script inside of `/packages/db` to have the database schema
3939+up to date:
4040+4141+```bash
4242+$ pnpm migrate
4343+```
44455-## Getting started
4545+You should be ready to go! Check out the Drizzle Studio to see if your tables
4646+have been created:
64777-1. Create you mysql database or use planetscale
88-2. Update your .env file with DATABASE_URL=""
99-3. Run `pnpm push` to push the tables
4848+```$
4949+$ pnpm studio
5050+```