Skip to content

Rufusemmanuel/PolyPicks

Repository files navigation

PolyPicks

Next.js 14 + Prisma dashboard for Polymarket markets.

Setup

  • Install deps: npm install
  • Set DATABASE_URL to a Postgres connection string (required in all environments).
  • Copy .env.example to .env and update:
    • DATABASE_URL="postgresql://USER:PASSWORD@HOST:5432/DB?sslmode=require"
  • Set user-wallet trading config in .env.local or deployment env:
    • ENABLE_TRADING=true
    • POLYMARKET_BUILDER_CODE=0x...
    • POLYPICKS_SESSION_SECRET=... (32+ chars)
  • Do not set POLYMARKET_PRIVATE_KEY for normal trading. Users sign orders from connected wallets.
  • Optional admin/reporting credentials:
    • POLYMARKET_API_KEY, POLYMARKET_SECRET, and POLYMARKET_PASSPHRASE are only used by builder analytics/reporting utilities.
    • POLYMARKET_PRIVATE_KEY is only used by local live-attribution/admin scripts.
  • Server-only builder relayer credentials:
    • POLYMARKET_BUILDER_API_KEY, POLYMARKET_BUILDER_SECRET, and POLYMARKET_BUILDER_PASSPHRASE are used only by /api/polymarket/submit to forward user-signed Safe/proxy/deposit-wallet transactions to Polymarket relayer /submit.
    • Do not configure wallet-scoped relayer credentials for the builder submit path, and never expose builder credentials with NEXT_PUBLIC_.
  • Optional client flags:
    • NEXT_PUBLIC_CLOB_DEBUG=false
    • NEXT_PUBLIC_POLY_RELAYER_URL=
    • NEXT_PUBLIC_POLY_SIGNATURE_TYPE=3 for new deposit-wallet users. Use 1 or 2 only for legacy proxy/Safe accounts.
    • POLYMARKET_DATA_API_BASE_URL=https://data-api.polymarket.com
  • For soccer stats, set FOOTBALL_DATA_API_KEY in .env.local (local dev) or Vercel Project Settings → Environment Variables.
  • Generate Prisma client: npx prisma generate
  • Start dev server: npm run dev

Vercel

  • Set DATABASE_URL in Project Settings to your Postgres connection string.
  • Run migrations in production:
    • Vercel will auto-run npm run vercel-build if present.
    • vercel-build runs migrations only when VERCEL_ENV=production.
    • Optional: set ALLOW_DB_RESET_ON_FAILED_MIGRATIONS=1 to auto-reset a fresh database on failed migrations.
  • Do not run prisma db pull against production; it can overwrite prisma/schema.prisma and drop models that are not yet present in the database.
  • For user-wallet trading deployments, the required trading runtime vars are only ENABLE_TRADING=true, POLYMARKET_BUILDER_CODE, and POLYPICKS_SESSION_SECRET. Server-side Polymarket API credentials and private keys are optional admin/reporting inputs, not trading blockers.
  • For relayer-backed Safe/proxy/deposit-wallet transactions, configure server-only Builder API credentials: POLYMARKET_BUILDER_API_KEY, POLYMARKET_BUILDER_SECRET, and POLYMARKET_BUILDER_PASSPHRASE.

The app uses the Polymarket Gamma/Data API and an optional RTDS WebSocket for live prices.

Builder-attributed trading uses CLOB V2 builderCode. The browser fetches the server-configured bytes32 code before signing, the SDK serializes it into the final order builder field, and the server rejects posts where that field is missing or mismatched.

Order signing defaults to Polymarket V2 deposit-wallet signature type 3 (POLY_1271). Existing proxy/Safe wallets can still use their legacy type (1 or 2). Browser user trades do not use normal EOA type 0.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors