Loading...
Principles for Next.js App Router development.
Does it need...?
│
├── useState, useEffect, event handlers
│ └── Client Component ('use client')
│
├── Direct data fetching, no interactivity
│ └── Server Component (default)
│
└── Both?
└── Split: Server parent + Client child
| Type | Use | |------|-----| | Server | Data fetching, layout, static content | | Client | Forms, buttons, interactive UI |
| Pattern | Use | |---------|-----| | Default | Static (cached at build) | | Revalidate | ISR (time-based refresh) | | No-store | Dynamic (every request) |
| Source | Pattern | |--------|---------| | Database | Server Component fetch | | API | fetch with caching | | User input | Client state + server action |
| File | Purpose |
|------|---------|
| page.tsx | Route UI |
| layout.tsx | Shared layout |
| loading.tsx | Loading state |
| error.tsx | Error boundary |
| not-found.tsx | 404 page |
| Pattern | Use |
|---------|-----|
| Route groups (name) | Organize without URL |
| Parallel routes @slot | Multiple same-level pages |
| Intercepting (.) | Modal overlays |
| Method | Use | |--------|-----| | GET | Read data | | POST | Create data | | PUT/PATCH | Update data | | DELETE | Remove data |
| Type | Use | |------|-----| | Static export | Fixed metadata | | generateMetadata | Dynamic per-route |
| Layer | Control | |-------|---------| | Request | fetch options | | Data | revalidate/tags | | Full route | route config |
| Method | Use |
|--------|-----|
| Time-based | revalidate: 60 |
| On-demand | revalidatePath/Tag |
| No cache | no-store |
| ❌ Don't | ✅ Do | |----------|-------| | 'use client' everywhere | Server by default | | Fetch in client components | Fetch in server | | Skip loading states | Use loading.tsx | | Ignore error boundaries | Use error.tsx | | Large client bundles | Dynamic imports |
app/
├── (marketing)/ # Route group
│ └── page.tsx
├── (dashboard)/
│ ├── layout.tsx # Dashboard layout
│ └── page.tsx
├── api/
│ └── [resource]/
│ └── route.ts
└── components/
└── ui/
Remember: Server Components are the default for a reason. Start there, add client only when needed.
The nextjs-best-practices AI agent handles nextjs-best-practices-related tasks automatically. Next.js App Router principles. Server Components, data fetching, routing patterns. You can use this expert persona to automate complex workflows without hiring expensive human freelancers.
To deploy the nextjs-best-practices AI agent, download the package, extract the files to your project's .cursor/skills directory, and type @nextjs-best-practices in your editor chat to start automating your tasks immediately.
Our nextjs-best-practices AI persona is completely free to download and integrate into compatible Agentic IDEs like Cursor, Windsurf, Github Copilot, and Anthropic MCP servers, giving you enterprise-grade automation at zero cost.
Next.js App Router principles. Server Components, data fetching, routing patterns.
Download Skill Package.cursor/skills@nextjs-best-practices in editor chat.Copy the instructions from the panel on the left and paste them into your custom instructions setting.
"Adding this nextjs-best-practices persona to my Cursor workspace completely changed the quality of code my AI generates. Saves me hours every week."
Developers who downloaded nextjs-best-practices also use these elite AI personas.
Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.
Structured guide for setting up A/B tests with mandatory gates for hypothesis, metrics, and execution readiness.
You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.
Explore our most popular utilities designed for the modern Indian creator.