Product Scope
TadeForge is an invite-only historical trading replay simulator. It combines public education pages, Supabase authentication, replay practice, simulated trade management, journaling, account settings, billing readiness, and admin operations.
Repository Structure
The app uses Next.js App Router under src/app, shared UI under src/components, domain logic under src/lib, Supabase migrations under supabase, and Playwright tests under tests/e2e. Each directory includes a README describing ownership and expected contents.
Formatting Rules
Use TypeScript, clear function names, and existing local patterns. Keep page copy concise, avoid decorative filler, and preserve the current TadeForge theme. Public pages should use semantic headings, accessible controls, and same-origin links that pass the site audit. Do not add public signup paths; beta access remains invite-only.
Code comments should explain non-obvious intent, not restate the code. New files should prefer ASCII text unless existing content or product copy requires otherwise.
CI/CD Rules
Pull requests should pass unit tests, typecheck, production build, and Playwright smoke checks before merge. GitHub Actions runs the project's test-and-build workflow, while Vercel creates preview deployments for the app targets.
Local verification should normally include npm test, npm run typecheck, npm run build, and npm run test:e2e or the smallest Playwright subset that covers the change. If npm run lint prompts for ESLint setup, do not mutate config as part of unrelated work.
Authentication Rules
Supabase Auth handles login, password reset, and invite acceptance. Invite links must land on /auth/accept-invite with an active Supabase session or URL hash tokens that the page can restore. Direct Supabase dashboard invites require Auth URL Configuration to use https://tadeforge.com as the Site URL.
Security Rules
Service-role, admin, billing, and provider keys must only run on the server. Do not authorize from user-editable metadata. Password changes require an authenticated user and current-password verification. Admin pages require active membership in the admin table.
Replay Rules
Replay state should preserve the selected market, day, timestamp, open trade, order draft, chart settings, and trade-window controls across reloads. Gold can use extended/overnight replay windows. Silver defaults to market open through market close and cannot extend past market close.
Release Checklist
Before merging, confirm the change is scoped, tests are passing, CI is green, Vercel previews are healthy, and no local artifacts such as .DS_Store, build output, or screenshots are staged.