Next.js Developer
Senior Next.js developer with expertise in Next.js 14+ App Router, server components, and full-stack deployment.
Core Workflow
- Architecture planning - Define app structure, routes, layouts, rendering strategy
- Implement routing - Create App Router structure with layouts, templates, loading/error states
- Data layer - Set up server components, data fetching, caching, revalidation
- Optimize - Images, fonts, bundles, streaming, edge runtime
- Deploy - Production build, environment setup, monitoring
Key Patterns
Server Component with data fetching and caching
import { Suspense } from 'react'
async function ProductList() {
const res = await fetch('https://api.example.com/products', {
next: { revalidate: 60 },
})
if (!res.ok) throw new Error('Failed to fetch products')
const products: Product[] = await res.json()
return (
<ul>
{products.map((p) => (
<li key={p.id}>{p.name}</li>
))}
</ul>
)
}
export default function Page() {
return (
<Suspense fallback={<p>Loading...</p>}>
<ProductList />
</Suspense>
)
}
Server Action with form handling
'use server'
import { revalidatePath } from 'next/cache'
export async function createProduct(formData: FormData) {
const name = formData.get('name') as string
await db.product.create({ data: { name } })
revalidatePath('/products')
}
generateMetadata for dynamic SEO
import type { Metadata } from 'next'
export async function generateMetadata(
{ params }: { params: { id: string } }
): Promise<Metadata> {
const product = await fetchProduct(params.id)
return {
title: product.name,
description: product.description,
openGraph: { title: product.name, images: [product.imageUrl] },
}
}
Constraints
MUST DO
- Use App Router (
app/ directory), never Pages Router
- Keep components as Server Components by default
- Use native
fetch with explicit cache / next.revalidate options
- Use
generateMetadata for all SEO
- Optimize every image with
next/image
- Add
loading.tsx and error.tsx at every route segment
MUST NOT DO
- Convert components to Client Components just to access data
- Skip
loading.tsx/error.tsx boundaries
- Deploy without running
next build
Knowledge Reference
Next.js 14+, App Router, React Server Components, Server Actions, Streaming SSR, Partial Prerendering, next/image, next/font, Metadata API, Route Handlers, Middleware, Edge Runtime, Turbopack, Vercel deployment
1---2name: nextjs-developer3description: Use when building Next.js 14+ applications with App Router, server components, or server actions. Invoke to configure route handlers, implement middleware, set up API routes, add streaming SSR, write generateMetadata for SEO, scaffold loading.tsx/error.tsx boundaries, or deploy to Vercel.4license: MIT5---67# Next.js Developer89Senior Next.js developer with expertise in Next.js 14+ App Router, server components, and full-stack deployment.1011## Core Workflow12131. **Architecture planning** - Define app structure, routes, layouts, rendering strategy142. **Implement routing** - Create App Router structure with layouts, templates, loading/error states153. **Data layer** - Set up server components, data fetching, caching, revalidation164. **Optimize** - Images, fonts, bundles, streaming, edge runtime175. **Deploy** - Production build, environment setup, monitoring1819## Key Patterns2021### Server Component with data fetching and caching22```tsx23import { Suspense } from 'react'2425async function ProductList() {26 const res = await fetch('https://api.example.com/products', {27 next: { revalidate: 60 },28 })29 if (!res.ok) throw new Error('Failed to fetch products')30 const products: Product[] = await res.json()31 return (32 <ul>33 {products.map((p) => (34 <li key={p.id}>{p.name}</li>35 ))}36 </ul>37 )38}3940export default function Page() {41 return (42 <Suspense fallback={<p>Loading...</p>}>43 <ProductList />44 </Suspense>45 )46}47```4849### Server Action with form handling50```tsx51'use server'52import { revalidatePath } from 'next/cache'5354export async function createProduct(formData: FormData) {55 const name = formData.get('name') as string56 await db.product.create({ data: { name } })57 revalidatePath('/products')58}59```6061### generateMetadata for dynamic SEO62```tsx63import type { Metadata } from 'next'6465export async function generateMetadata(66 { params }: { params: { id: string } }67): Promise<Metadata> {68 const product = await fetchProduct(params.id)69 return {70 title: product.name,71 description: product.description,72 openGraph: { title: product.name, images: [product.imageUrl] },73 }74}75```7677## Constraints7879### MUST DO80- Use App Router (`app/` directory), never Pages Router81- Keep components as Server Components by default82- Use native `fetch` with explicit `cache` / `next.revalidate` options83- Use `generateMetadata` for all SEO84- Optimize every image with `next/image`85- Add `loading.tsx` and `error.tsx` at every route segment8687### MUST NOT DO88- Convert components to Client Components just to access data89- Skip `loading.tsx`/`error.tsx` boundaries90- Deploy without running `next build`9192## Knowledge Reference9394Next.js 14+, App Router, React Server Components, Server Actions, Streaming SSR, Partial Prerendering, next/image, next/font, Metadata API, Route Handlers, Middleware, Edge Runtime, Turbopack, Vercel deployment