Next.js 14 + Prisma dashboard for Polymarket markets.
- Install deps:
npm install - Set
DATABASE_URLto a Postgres connection string (required in all environments). - Copy
.env.exampleto.envand update:DATABASE_URL="postgresql://USER:PASSWORD@HOST:5432/DB?sslmode=require"
- Set Polymarket builder creds in
.env.local(never NEXT_PUBLIC):POLY_BUILDER_API_KEY=...POLY_BUILDER_SECRET=...POLY_BUILDER_PASSPHRASE=...
- Optional client flags:
NEXT_PUBLIC_CLOB_DEBUG=falseNEXT_PUBLIC_FORCE_EOA=falseNEXT_PUBLIC_POLY_RELAYER_URL=POLYMARKET_DATA_API_BASE_URL=https://data-api.polymarket.com
- For soccer stats, set
FOOTBALL_DATA_API_KEYin.env.local(local dev) or Vercel Project Settings → Environment Variables. - Generate Prisma client:
npx prisma generate - Start dev server:
npm run dev
- Set
DATABASE_URLin Project Settings to your Postgres connection string. - Run migrations in production:
- Vercel will auto-run
npm run vercel-buildif present. vercel-buildruns migrations only whenVERCEL_ENV=production.- Optional: set
ALLOW_DB_RESET_ON_FAILED_MIGRATIONS=1to auto-reset a fresh database on failed migrations.
- Vercel will auto-run
- Do not run
prisma db pullagainst production; it can overwriteprisma/schema.prismaand drop models that are not yet present in the database.
The app uses the Polymarket Gamma/Data API and an optional RTDS WebSocket for live prices.
Builder-attributed trading relies on the exact clobBody string used to compute POLY_SIGNATURE; the same string must be forwarded to the server unchanged.