{ "name": "nextjs", "description": "Next.js App (SSR on Cloudflare)", "secrets": [], "capabilities": [], "intent": { "keywords": ["next", "nextjs", "react", "ssr", "full-stack", "server components", "rsc"], "examples": ["next.js app", "server-rendered react", "react ssr"] }, "agentContext": { "summary": "A Next.js app deployed with jack. Supports SSR, SSG, and React Server Components.", "full_text": "## Project Structure\n\n- `app/` - Next.js App Router pages and layouts\n- `public/` - Static assets\n- `open-next.config.ts` - OpenNext configuration\n- `wrangler.jsonc` - Worker configuration\n\n## Commands\n\n- `bun run dev` - Local development\n- `jack ship` - Deploy to production\n- `bun run preview` - Preview production build locally\n\n## Conventions\n\n- Uses App Router (not Pages Router)\n- SSR and SSG work out of the box\n- Server Components supported\n\n## OpenNext on Cloudflare — Important Rules\n\nThis app runs via OpenNext on Cloudflare Workers. Follow these rules to avoid runtime errors:\n\n### Use window.location.href instead of router.push() for full-page transitions\nOpenNext has a broken webpack chunk URL resolver. Client-side navigation via `router.push()` to pages whose chunks aren't already loaded fails with `ChunkLoadError`. Use `window.location.href` for navigations that change auth state or cross major app sections. `` components work fine because Next.js prefetches their chunks.\n\n```tsx\n// BAD — may cause ChunkLoadError\nrouter.push('/dashboard');\nrouter.refresh();\n\n// GOOD — full reload, always works\nwindow.location.href = '/dashboard';\n```\n\n### Add `export const dynamic = 'force-dynamic'` to pages using getCloudflareContext()\nWithout this, Next.js tries to statically prerender the page at build time, which fails because `getCloudflareContext()` is only available at request time.\n\n### Edge middleware cannot use Node.js APIs\nNext.js middleware runs in the edge runtime. Do not import or call anything that requires Node.js built-in modules (e.g., `perf_hooks`, `fs`, `crypto` beyond Web Crypto).\n\n### nodejs_compat flag is required\nThe `wrangler.jsonc` must include `\"compatibility_flags\": [\"nodejs_compat\"]` and a recent `compatibility_date`.\n\n## Resources\n\n- [OpenNext Docs](https://opennext.js.org/cloudflare)\n- [Next.js App Router](https://nextjs.org/docs/app)" }, "hooks": { "postDeploy": [ { "action": "clipboard", "text": "{{url}}", "message": "Deploy URL copied to clipboard" }, { "action": "box", "title": "Deployed: {{name}}", "lines": ["URL: {{url}}", "", "Next.js app is live!"] } ] } }