# Game Night Live — build pack A spec pack for Claude Code. It builds a live scoring app for youth game nights: an admin control room, a projector scoreboard, and per-game judge links. ## What's in here | File | What it's for | |---|---| | `CLAUDE.md` | Rules Claude Code reads automatically every session | | `docs/KICKOFF_PROMPT.md` | The first message you paste into Claude Code | | `docs/PRD.md` | Features, roles, user flows | | `docs/ARCHITECTURE.md` | Stack, routes, realtime, security model | | `docs/DATA_MODEL.md` | Tables explained | | `docs/SCORING.md` | Exact scoring math (judges, averages, placement points, bonuses) | | `docs/UI.md` | Screens + design direction | | `docs/BUILD_PLAN.md` | Phased tasks with acceptance criteria | | `supabase/migrations/0001_init.sql` | Starting schema + RLS | | `.env.example` | Env vars you'll need | ## Setup (≈15 min, before you open Claude Code) 1. **Supabase** — create a free project at supabase.com. - Settings → API: copy the Project URL, anon key, and service_role key. - Authentication → Providers: make sure Email is on (magic link is fine). 2. **Vercel** — free account, connect GitHub (for deploy at the end). 3. **Node** — install current LTS. Check with `node -v`. 4. Unzip this folder somewhere, `git init`, open it in **WebStorm**. 5. Copy `.env.example` → `.env.local` and paste in your Supabase values + your admin email. ## Running Claude Code in WebStorm - Install the **Claude Code** plugin from JetBrains Marketplace (or just run `claude` in WebStorm's terminal from the project root). - Open `docs/KICKOFF_PROMPT.md`, paste its contents into Claude Code. - Let it go phase by phase. After each phase: run it, click around, commit, then say "next phase". ## Commands | Command | What it does | |---|---| | `npm run dev` | Run locally at http://localhost:3000 | | `npm run test` / `npm run test:coverage` | Unit tests (scoring engine must stay at 100%) | | `npm run lint` / `npm run build` | Lint / production build | | `npm run check:rls` | Proves the anon key cannot read or write any table | | `npm run gen:types` | Regenerate `src/lib/database.types.ts` after a migration | ## Deploying to Vercel 1. Push this repo to GitHub, then in Vercel choose **Add New → Project** and import it. 2. Add these environment variables in Vercel (Production): `NEXT_PUBLIC_SUPABASE_URL`, `NEXT_PUBLIC_SUPABASE_ANON_KEY`, `SUPABASE_SERVICE_ROLE_KEY`, `ADMIN_EMAILS`, `NEXT_PUBLIC_APP_NAME`, and `NEXT_PUBLIC_SITE_URL` set to the site's address (e.g. `https://your-project.vercel.app`, no trailing slash). The build fails with a clear message if any is missing. 3. Deploy. `vercel.json` runs the server functions in Dublin (`dub1`), next to a West EU Supabase project; change it if your database is elsewhere. 4. In Supabase → Authentication → URL Configuration, set **Site URL** to the Vercel address and add `https://your-project.vercel.app/auth/confirm` to **Redirect URLs** (keep the localhost one for development). 5. If you change `NEXT_PUBLIC_SITE_URL` later, redeploy: share links and QR codes are built from it. ## Before game night - Free Supabase projects pause after about a week without use. Open the Supabase dashboard a day before and click **Restore** if it is paused. - Sign in as host the day before; the magic-link email is limited to a few per hour. - Test the scoreboard on the actual projector PC and one judge link on a phone, on the venue's Wi-Fi. The scoreboard also polls every 10 seconds if live updates are blocked. - Keep `docs/` as the source of truth: change the doc first, then the code.