Web app for browsing and reading public-domain horror books (starting with Lovecraft). UI in English.
- Next.js 16 (App Router) + TypeScript + Tailwind CSS v4
- shadcn/ui (Base UI + Radix-style primitives)
- Prisma 7 + PostgreSQL +
@prisma/adapter-pg+pg
(SQLite was removed — for a database-driven catalog on Vercel you need hosted Postgres: Neon, Supabase, etc.) - No
DATABASE_URL/POSTGRES_*: the app uses a static catalog (src/data/static-catalog.ts) pluscontent/books/*.txt— Vercel deploy works from the repo alone (no DB).
-
PostgreSQL running locally (Docker example):
docker run --name strangeflix-pg -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=strangeflix -p 5432:5432 -d postgres:16
-
Env & DB
npm install cp .env.example .env # edit DATABASE_URL if needed npx prisma migrate dev npm run db:seed npm run dev
Open http://localhost:3000.
- Connect the Git repo to Vercel and deploy. Do not add
DATABASE_URL/POSTGRES_*— the catalog comes fromsrc/data/static-catalog.tsandcontent/books/*.txt. - Canonical URL (Open Graph, sitemap): you usually need no Environment Variables.
getSiteUrl()usesVERCEL_URL, which Vercel sets automatically →https://<your-project>.vercel.app. - Optional: if you use a custom domain, add
NEXT_PUBLIC_SITE_URL=https://your-domain.com(Production + Preview if you want) so metadata and sitemap use that base instead of*.vercel.app.
Build: prisma generate → migrate script skips migrate deploy when no Postgres URL → next build.
-
Create a Neon (or Supabase) database and copy the connection string (
sslmode=requirewhere required). -
In Vercel → Settings → Environment Variables, add one Postgres URL for Production (and Preview if needed):
DATABASE_URL,POSTGRES_PRISMA_URL,POSTGRES_URL, orPOSTGRES_URL_NON_POOLING(first defined wins). -
Redeploy so
prisma migrate deployruns on build, then seed once:vercel env pull .env.production.local npx prisma db seed
Or run seed from any machine with
DATABASE_URLpointing at production. -
Same canonical URL rules as above (
VERCEL_URLby default;NEXT_PUBLIC_SITE_URLfor a custom domain).
- Local
DATABASE_URL(e.g.localhost) only works on your machine when you runnpm run dev(or a localnext start). Strangeflix reads that from.env. - Vercel runs your app on servers in the cloud. Those servers cannot open a connection to
localhoston your laptop. So the live site needs a hosted PostgreSQL (Neon, Supabase, Vercel Postgres, etc.) and the same connection string copied into Vercel → Environment Variables (DATABASE_URLor oftenPOSTGRES_URL/POSTGRES_PRISMA_URLfrom the provider). - Files-only (no Postgres on Vercel): you don’t need
DATABASE_URL; keepstatic-catalogandcontent/booksin sync withprisma/seed.tswhen adding titles. - After the first deploy with that variable, migrations should run on build; then run
prisma db seedonce against the hosted database (not only your local DB), e.g.vercel env pullthennpx prisma db seed.
Models: Author, Book, BookChapter (see prisma/schema.prisma).
Use npm run db:studio to inspect data.
| Script | Description |
|---|---|
npm run dev |
Development server |
npm run build |
Production build (includes migrate deploy) |
npm run db:generate |
Regenerate Prisma client |
npm run db:migrate |
Create/apply migrations (migrate dev) |
npm run db:studio |
Prisma Studio |
npm run db:seed |
Seed authors & books |
npm run content:dunwich |
Regenerate Dunwich text from Wikisource (optional; needs network or WIKISOURCE_DUMP path) |