Important links:
- Architecture overview
- Cloudflare dashboard
- Fly.io dashboard
- PlanetScale dashboard
- Google Cloud dashboard (Dev OAuth app)
- GitHub (OAuth app, Dev OAuth app)
If you have not already, install the global dependencies:
# For local development with https
brew install mkcert
brew install caddy
mkcert -install
mkcert -cert-file configuration/caddy/tls/watch.lemon.dev.pem -key-file configuration/caddy/tls/watch.lemon.dev-key.pem "watch.lemon.dev"
nvm install
pnpm install
Add the following to your /etc/hosts
file (only needed for https):
127.0.0.1 watch.lemon.dev
Make sure you have a (gitignored) .env
file in the root of the project with at least the following contents:
# See 1Password for the values
GITHUB_CLIENT_ID="ABC123"
GITHUB_CLIENT_SECRET="XYZ789"
TMDB_ACCESS_TOKEN="ABC123"
# Generate some random value, I generally use 1Password
JWT_DEFAULT_SECRET="imbue-madman-real-bizarre"
Run the development server:
pnpm develop
We use PlanetScale to host a MySQL database for the application, and manage the schema with Prisma. Install the pscale
CLI. Log in, and connect to the watch-test-db
database on the develop
branch:
pscale connect watch-test-db develop --port 3309
Make sure the DATABASE_URL
is updated in the root .env
file to reflect this local connection to the database:
# :3309 is the port we connected to, watch-test-db is the database name
DATABASE_URL="mysql://root@127.0.0.1:3309/watch-test-db"
As you make changes to the schema, you will apply them to production by running the following command:
pnpm exec prisma db push
You can get a visual UI for the database by running Prisma Studio:
pnpm exec prisma studio