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 tools/caddy/tls/watch.lemon.dev.pem -key-file tools/caddy/tls/watch.lemon.dev-key.pem "watch.lemon.dev"
nvm install
pnpm installAdd 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 developWe 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 3309Make 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://[email protected]: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 pushYou can get a visual UI for the database by running Prisma Studio:
pnpm exec prisma studioTo add a new secret that will be deployed to production:
# key stored in private notes
pnpm secrets.encrypt --name MY_KEY --value secret-value --file ./app/tools/cloudflare/secrets.production.json --key abcTo read the secrets locally:
pnpm secrets.decrypt --file ./app/tools/cloudflare/secrets.production.json --key abc