FrontendnextjsFree
Next.js: fetch data in a Server Component
Moves client-side fetching to the server where it belongs.
Cursor / coding agents, Claude Code, ChatGPT +1
Agent Templates / Next.js
React, App Router, Tailwind, Supabase/Prisma. Files update live as you answer; download everything as a ZIP and drop it into your repo root.
What the app does and for whom.
Generated in your browser. Nothing is uploaded. Review before committing: these are starting points, not guarantees.
# AGENTS.md: my-app ## Stack Next.js 16 (App Router), Tailwind CSS, data via Supabase, tests: Vitest. ## Setup ```bash npm install cp .env.example .env.local ``` ## Commands - Install: `npm install` - Dev: `npm run dev` - Build: `npm run build` - Lint: `npm run lint` - Tests: `npm test` ## Project structure - app/: routes, layouts, route handlers (route.ts) - components/: shared UI - lib/: utilities, data access - public/: static assets ## Code style - TypeScript strict; no `any` in new code - Default to Server Components; add 'use client' only for interactivity or browser APIs - Read the Next.js docs bundled in node_modules/next/dist/docs for your installed version before using unfamiliar APIs (APIs change between major versions) - params and searchParams are async in recent versions; await them - Use Tailwind utility classes; extract repeated patterns into components, not custom CSS - Every page exports metadata (title, description) - Keep secrets server-side; only NEXT_PUBLIC_* variables reach the browser - Rely on Supabase Row Level Security; never use the service-role key in client code ## Testing - Write Vitest tests for new logic - Run `npm test` and `npm run build` before finishing ## Security - Validate all route handler / server action input with a schema - Check authentication and authorisation on the server for every mutation - Never expose secrets via NEXT_PUBLIC_ variables ## Never - Commit secrets or .env files - Run destructive database commands without asking - Do not disable TypeScript or ESLint rules to make errors go away - Do not add client components where a server component works - Do not commit .env.local ## Working agreement - Before editing, state a short plan and the files you will touch - Make the smallest change that solves the task; do not refactor unrelated code - If requirements are ambiguous, ask instead of guessing - When done, summarise what changed and how you verified it
Moves client-side fetching to the server where it belongs.
Cursor / coding agents, Claude Code, ChatGPT +1
Validated, authenticated mutation endpoint.
Cursor / coding agents, Claude Code, ChatGPT +1
Row Level Security that is actually tested.
Cursor / coding agents, Claude Code, ChatGPT +1