nextjs-fullstack-patterns

Implements production Next.js App Router patterns covering server components, data fetching, authentication, and deployment.

Updated May 16, 2026
One-click install
npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill nextjs-fullstack-patterns-organvm-i-theoria
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nextjs-fullstack-patterns
Source: https://github.com/organvm-i-theoria/_agent-ontology/tree/main/.agents/skills/nextjs-fullstack-patterns
Command: npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill nextjs-fullstack-patterns-organvm-i-theoria

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building a production Next.js application requires coordinating many decisions—server vs client components, caching strategies, authentication, database access, error handling, and deployment—and getting any of them wrong leads to slow pages, security gaps, or broken builds. This Skill provides a complete, opinionated reference of App Router patterns so you can implement each layer correctly the first time. ## Core Features & Use Cases - App Router Architecture: File-based routing conventions, layouts, route groups, dynamic routes, and route handlers with clear guidance on when to use server vs client components. - Data Fetching & Mutations: Parallel fetching, streaming with Suspense, Server Actions with useFormStatus/useActionState, and caching strategies including ISR and tag-based revalidation. - Full-Stack Concerns: Middleware-based authentication, Prisma database setup with a data access layer, metadata/SEO generation, and error boundaries. - Use Case: You are scaffolding a new Next.js dashboard with login-protected pages and a Postgres backend. Use this Skill to set up middleware auth, a cached getUser helper, Prisma client singleton, server-action form handling, and a deployment checklist covering security headers and monitoring. ## Quick Start Ask the AI to scaffold a Next.js App Router page with server-side data fetching, a server action form, and middleware authentication for a protected dashboard route.

Frequently Asked Questions about nextjs-fullstack-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch data in Next.js App Router server components?▼

Fetch data directly with async/await inside server components, using fetch with cache options like force-cache, no-store, or next.revalidate for ISR. Use Promise.all to run multiple queries in parallel and avoid request waterfalls.

When should I use server components vs client components in Next.js?▼

Use server components by default for data fetching, backend access, secrets, and SEO content. Add 'use client' only at leaf components that need useState, event handlers, or browser APIs, keeping the client bundle small.

How do I protect routes with middleware authentication in Next.js?▼

Create a middleware.ts file that reads the auth token from cookies and redirects unauthenticated requests away from protected paths like /dashboard. Configure the matcher to limit which routes the middleware runs on.

How do I test Next.js server actions and route handlers?▼

Call server actions directly in Vitest with a FormData object, mocking next/cache functions like revalidatePath. For route handlers, invoke the exported GET or POST function with a NextRequest and assert on the JSON response.

Why is my Next.js client bundle too large?▼

Large bundles usually come from unnecessary 'use client' directives, heavy libraries, or full icon-set imports. Run the bundle analyzer, push client directives to leaf components, and use dynamic imports with ssr: false for heavy components.

Can I deploy a Next.js app with Docker instead of Vercel?▼

Yes, set output to 'standalone' in next.config.js and use a multi-stage Dockerfile with next start as the command. Set HOSTNAME to 0.0.0.0 and place a reverse proxy like nginx or caddy in front for SSL.