System design interview practice: React Flow canvas (left) + AI interviewer chat (right). See docs/MVP_PLAN.md for the implementation plan.
All coding rules in .cursor/rules/ are mandatory — not optional. CI and pre-commit enforce lint, typecheck, and tests so the rules are followed.
Next.js (App Router), Supabase, AWS Bedrock (Anthropic), Vercel AI SDK, React Flow, Tailwind CSS, TypeScript, shadcn/ui, Zustand, neverthrow, ts-pattern. Package manager: pnpm only.
pnpm install
cp .env.example .env.local
# Edit .env.local with your Supabase URL, publishable key, and (server-only) AWS/Bedrock vars
pnpm devpnpm dev— start dev server (Turbopack)pnpm build— production buildpnpm start— start production serverpnpm lint— run ESLintpnpm test— run tests (Vitest)
- CI (GitHub Actions): on push/PR to
main, runspnpm lint,pnpm exec tsc --noEmit,pnpm test,pnpm build. The build fails if any step fails. - Pre-commit (husky): before each commit, runs
pnpm lint,pnpm exec tsc --noEmit,pnpm test. Commit is blocked if any step fails. E2E tests (pnpm test:e2e) run in CI or manually, not in the commit hook. - lint-staged: ESLint runs on staged
*.ts/*.tsxwhen configured (e.g. for faster feedback).
Copy .env.example to .env.local and fill in:
- Client:
NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY - Server (optional):
SUPABASE_SECRET_KEY - Server-only (BFF /api/chat):
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION,BEDROCK_MODEL_ID— never useNEXT_PUBLIC_for these.
The IAM user used by /api/chat must allow both the inference profile and the foundation model (e.g. for Claude Sonnet 4.6). When using cross-region inference, the foundation model is evaluated as a region-agnostic resource (arn:aws:bedrock:::foundation-model/...), so the foundation-model ARN in the policy must use a region wildcard:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"],
"Resource": [
"arn:aws:bedrock:us-east-1:ACCOUNT_ID:inference-profile/global.anthropic.claude-sonnet-4-6",
"arn:aws:bedrock:*::foundation-model/anthropic.claude-sonnet-4-6"
]
}]
}Replace ACCOUNT_ID with your AWS account ID.
Responses should stream and show the first tokens within a few seconds. If you see a long delay (e.g. 60–90s) before any output:
- Try production:
pnpm build && pnpm startand test again (dev/Turbopack can behave differently). - Verify streaming: The route sends
Cache-Control: no-storeandX-Accel-Buffering: noso the response isn’t buffered. - Inference profile: A geographic profile in your region (e.g.
us.anthropic.claude-sonnet-4-6from US) can be faster than the global one; see AWS Bedrock inference profiles docs.
app/— routes, layouts, pages; API underapp/api/components/— UI;components/ui/— shadcn primitiveslib/— pure functions, types, utilsstores/— Zustand storesservices/— Supabase client, API callssupabase/migrations/— Supabase migrations (apply via CLI)
Coding rules: see .cursor/rules/ — mandatory for all implementation.