---
paths:
  - "js/cf-webapp/**"
---
# Next.js Patterns (cf-webapp)

- Default to server components. `"use client"` only for interactivity/state/browser APIs. Push client boundaries as low in the tree as possible
- Server actions go in files with `"use server"` at the top — never define inside client components
- Props passed from server → client must be JSON-serializable (no functions or class instances)
- Prisma queries go in server components. Client components fetch via API or receive data as props
- Path alias: `@/*` → `./src/*`
- Tree-sitter WASM files in `public/` built by `postinstall` — don't delete
- `@codeflash-ai/common` must be in `transpilePackages` (top-level await)
