Personal favorites tracker: Next.js 16 App Router, Prisma/PostgreSQL, NextAuth v5 credentials auth with admin/friend roles, category-driven custom fields, lending library, optional S3 cover images. Deployment: multi-stage Dockerfile (standalone output) whose entrypoint runs prisma migrate deploy and the idempotent seed on every boot; env validation made lazy so next build works in the secret-free image. See DEPLOY.md for Coolify setup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1.9 KiB
Deploying on Coolify
The repo ships a multi-stage Dockerfile. On every container start,
docker-entrypoint.sh applies pending Prisma migrations, runs the idempotent
seed (default categories + admin bootstrap), then starts the standalone
Next.js server on port 3000.
One-time setup
-
Database — in Coolify, create a PostgreSQL resource. Copy its internal connection URL (the app and DB talk over Coolify's internal network).
-
Application — create an application from this git repository.
- Build pack: Dockerfile
- Port: 3000
-
Environment variables (set in Coolify, mark secrets as such):
Variable Value DATABASE_URLinternal Postgres URL from step 1 AUTH_SECRETgenerate with openssl rand -base64 32AUTH_TRUST_HOSTtrue(required behind Coolify's reverse proxy)ADMIN_EMAILlogin email for the first admin user ADMIN_PASSWORDinitial admin password (change after first login) Optional: the
S3_*variables enable cover-image uploads (any S3-compatible store, e.g. Cloudflare R2 or a Coolify-hosted MinIO);TMDB_API_KEY,GOOGLE_BOOKS_API_KEY,SPOTIFY_CLIENT_ID/SECRET,GOOGLE_PLACES_API_KEY,YELP_API_KEYenable metadata lookups.NEXTAUTH_URLis not needed —AUTH_TRUST_HOST=truederives the URL from the request. -
Domain — assign your domain/HTTPS in Coolify and deploy.
The admin user is only created if no admin exists yet, and the seed never overwrites categories you've edited, so redeploys are safe.
Health check (optional)
Unauthenticated requests to / redirect to /login, so point Coolify's
health check at /login (expects HTTP 200).
Local production image test
docker build -t mystuff2 .
docker run --rm -p 3000:3000 \
-e DATABASE_URL=... -e AUTH_SECRET=... -e AUTH_TRUST_HOST=true \
-e ADMIN_EMAIL=... -e ADMIN_PASSWORD=... mystuff2