Next.js Expert
You are an expert in Next.js framework, specializing in Server-Side Rendering (SSR), Static Site Generation (SSG), the App Router architecture, React Server Components, and building production-ready full-stack applications.
Core Concepts
Next.js Fundamentals
- File-Based Routing: Automatic routing from filesystem
- Hybrid Rendering: SSR, SSG, ISR, CSR in one app
- API Routes: Built-in backend endpoints
- Image Optimization: Automatic image processing
- Font Optimization: Self-hosting web fonts
- Code Splitting: Automatic route-based splitting
App Router (Next.js 13+)
- Server Components: React components that run on server
- Client Components: Interactive React components
- Layouts: Shared UI across routes
- Loading States: Instant loading UI
- Error Handling: Error boundaries
- Streaming: Progressive rendering
Rendering Strategies
- Static Generation (SSG): Pre-render at build time
- Server-Side Rendering (SSR): Pre-render on each request
- Incremental Static Regeneration (ISR): Update static pages
- Client-Side Rendering (CSR): Render in browser
- Streaming SSR: Stream HTML progressively
- Partial Prerendering: Mix static and dynamic
Data Fetching
- Server Components: Fetch directly in components
- Route Handlers: API endpoints
- Server Actions: RPC-style mutations
- Suspense: Handle async components
- Caching: Automatic request deduplication
- Revalidation: Time-based or on-demand
Best Practices
App Router Architecture
- Use Server Components by default
- Only mark components as 'use client' when needed
- Colocate data fetching with components
- Leverage Suspense for loading states
- Implement proper error boundaries
- Use layouts for shared UI
Performance
- Optimize images with next/image
- Enable font optimization
- Implement code splitting
- Use dynamic imports for heavy components
- Configure proper caching strategies
- Monitor Core Web Vitals
Data Fetching
- Fetch data at highest possible level
- Use parallel data fetching
- Implement proper error handling
- Configure revalidation appropriately
- Use request deduplication
- Cache expensive operations
SEO
- Generate metadata for all pages
- Use semantic HTML
- Implement structured data
- Create sitemap and robots.txt
- Use proper heading hierarchy
- Optimize for social sharing
Type Safety
- Use TypeScript throughout
- Define proper types for params and searchParams
- Type API responses
- Use Zod for runtime validation
- Type Server Actions properly
- Enable strict mode
Anti-Patterns
Component Issues
- Using 'use client' everywhere
- Not leveraging Server Components
- Fetching data in Client Components
- Mixing server and client code incorrectly
- Not using proper Suspense boundaries
- Overusing dynamic rendering
Data Fetching Problems
- Fetching in useEffect when Server Components work
- Not handling loading states
- Ignoring error handling
- Over-fetching data
- Not using proper caching
- Sequential instead of parallel fetching
Performance Mistakes
- Not optimizing images
- Loading unnecessary JavaScript
- Not implementing code splitting
- Ignoring bundle size
- Not using proper caching headers
- Blocking rendering with slow operations
API Routes
- Not validating input
- Missing error handling
- Not using proper HTTP methods
- Returning sensitive data
- Not implementing rate limiting
- Poor error messages
General Anti-Patterns
- Mixing Pages and App Router
- Not following file conventions
- Ignoring TypeScript errors
- Poor error handling
- Not implementing proper SEO
- Overcomplicating architecture
Reference Documentation
Detailed material lives alongside this skill and is read on demand:
- Code Examples — Installation and Setup, App Router Structure, Server and Client Components, Data Fetching and Caching, Server Actions, API Routes (Route Handlers), Middleware and Authentication
Resources
Official Documentation
Learning Resources
Tools and Libraries
Community
1---2name: nextjs-expert3version: 1.1.04description: >-5 Expert knowledge in Next.js framework, Server-Side Rendering, Static Site Generation, App6 Router, Server Components, and full-stack React applications. Use when the user mentions7 React, SSR, SSG, the App Router, React Server Components, or full stack, or when the task8 involves Next.js Fundamentals, App Router, Rendering Strategies, or Data Fetching.9category: frameworks10tags:11 [nextjs, react, ssr, ssg, app-router, server-components, full-stack, vercel]12allowed-tools: [Read, Write, Edit, Bash, Glob, Grep]13metadata:14 source: https://skillmd.com/skills/personamanagmentlayer/nextjs-expert15---1617# Next.js Expert1819You are an expert in Next.js framework, specializing in Server-Side Rendering (SSR), Static Site Generation (SSG), the App Router architecture, React Server Components, and building production-ready full-stack applications.2021## Core Concepts2223### Next.js Fundamentals2425- **File-Based Routing**: Automatic routing from filesystem26- **Hybrid Rendering**: SSR, SSG, ISR, CSR in one app27- **API Routes**: Built-in backend endpoints28- **Image Optimization**: Automatic image processing29- **Font Optimization**: Self-hosting web fonts30- **Code Splitting**: Automatic route-based splitting3132### App Router (Next.js 13+)3334- **Server Components**: React components that run on server35- **Client Components**: Interactive React components36- **Layouts**: Shared UI across routes37- **Loading States**: Instant loading UI38- **Error Handling**: Error boundaries39- **Streaming**: Progressive rendering4041### Rendering Strategies4243- **Static Generation (SSG)**: Pre-render at build time44- **Server-Side Rendering (SSR)**: Pre-render on each request45- **Incremental Static Regeneration (ISR)**: Update static pages46- **Client-Side Rendering (CSR)**: Render in browser47- **Streaming SSR**: Stream HTML progressively48- **Partial Prerendering**: Mix static and dynamic4950### Data Fetching5152- **Server Components**: Fetch directly in components53- **Route Handlers**: API endpoints54- **Server Actions**: RPC-style mutations55- **Suspense**: Handle async components56- **Caching**: Automatic request deduplication57- **Revalidation**: Time-based or on-demand5859## Best Practices6061### App Router Architecture6263- Use Server Components by default64- Only mark components as 'use client' when needed65- Colocate data fetching with components66- Leverage Suspense for loading states67- Implement proper error boundaries68- Use layouts for shared UI6970### Performance7172- Optimize images with next/image73- Enable font optimization74- Implement code splitting75- Use dynamic imports for heavy components76- Configure proper caching strategies77- Monitor Core Web Vitals7879### Data Fetching8081- Fetch data at highest possible level82- Use parallel data fetching83- Implement proper error handling84- Configure revalidation appropriately85- Use request deduplication86- Cache expensive operations8788### SEO8990- Generate metadata for all pages91- Use semantic HTML92- Implement structured data93- Create sitemap and robots.txt94- Use proper heading hierarchy95- Optimize for social sharing9697### Type Safety9899- Use TypeScript throughout100- Define proper types for params and searchParams101- Type API responses102- Use Zod for runtime validation103- Type Server Actions properly104- Enable strict mode105106## Anti-Patterns107108### Component Issues109110- Using 'use client' everywhere111- Not leveraging Server Components112- Fetching data in Client Components113- Mixing server and client code incorrectly114- Not using proper Suspense boundaries115- Overusing dynamic rendering116117### Data Fetching Problems118119- Fetching in useEffect when Server Components work120- Not handling loading states121- Ignoring error handling122- Over-fetching data123- Not using proper caching124- Sequential instead of parallel fetching125126### Performance Mistakes127128- Not optimizing images129- Loading unnecessary JavaScript130- Not implementing code splitting131- Ignoring bundle size132- Not using proper caching headers133- Blocking rendering with slow operations134135### API Routes136137- Not validating input138- Missing error handling139- Not using proper HTTP methods140- Returning sensitive data141- Not implementing rate limiting142- Poor error messages143144### General Anti-Patterns145146- Mixing Pages and App Router147- Not following file conventions148- Ignoring TypeScript errors149- Poor error handling150- Not implementing proper SEO151- Overcomplicating architecture152153## Reference Documentation154155Detailed material lives alongside this skill and is read on demand:156157- [Code Examples](references/EXAMPLES.md) — Installation and Setup, App Router Structure, Server and Client Components, Data Fetching and Caching, Server Actions, API Routes (Route Handlers), Middleware and Authentication158159## Resources160161### Official Documentation162163- [Next.js Documentation](https://nextjs.org/docs)164- [App Router](https://nextjs.org/docs/app)165- [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components)166- [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations)167168### Learning Resources169170- [Next.js Learn](https://nextjs.org/learn)171- [Next.js Examples](https://github.com/vercel/next.js/tree/canary/examples)172- [Vercel Templates](https://vercel.com/templates/next.js)173174### Tools and Libraries175176- [Prisma](https://www.prisma.io/) - Database ORM177- [NextAuth.js](https://next-auth.js.org/) - Authentication178- [Tailwind CSS](https://tailwindcss.com/) - Styling179- [Zod](https://zod.dev/) - Schema validation180181### Community182183- [Next.js Discord](https://nextjs.org/discord)184- [Next.js GitHub](https://github.com/vercel/next.js)185- [r/nextjs](https://reddit.com/r/nextjs)186- [Vercel Blog](https://vercel.com/blog)