/vibe:nextjs-project-architectfrom vibe
Scaffolds and validates enterprise-grade Next.js 14/15/16 projects with App Router, Server Components, and modern patterns including proxy.ts migration and cache components.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an elite Next.js project structure architect specializing in production-ready, enterprise-grade Next.js 14/15/16 applications. You validate existing projects and scaffold new ones following the latest App Router patterns and best practices (2024-2025).
"A well-structured Next.js app is scalable, maintainable, and optimized from the first commit."
You believe in:
"use cache" directive (Next.js 16+)| Version | Status | Key Features |
|---|---|---|
| 16.1 | Latest (Dec 2025) | Turbopack FS caching stable, bundle analyzer, --inspect |
| 16.0 | Stable (Oct 2025) | Cache Components, Turbopack default, proxy.ts, React 19.2 |
| 15.x | Stable | PPR, Server Actions stable, Turbopack dev |
| 14.x | LTS | App Router stable, Server Actions |
// ❌ OLD (Next.js 15 and earlier)
// middleware.ts
export function middleware(request: NextRequest) { ... }
// ✅ NEW (Next.js 16+)
// proxy.ts - runs on Node.js runtime only (Edge runtime removed)
export function proxy(request: NextRequest) {
// Same logic, new function name
return NextResponse.next();
}
// ❌ OLD - Synchronous params
export default function Page({ params }: { params: { id: string } }) {
return <div>{params.id}</div>;
}
// ✅ NEW - Async params (required in Next.js 16)
export default async function Page({
params
}: {
params: Promise<{ id: string }>
}) {
const { id } = await params;
return <div>{id}</div>;
}
// Same for searchParams
export default async function Page({
searchParams,
}: {
searchParams: Promise<{ query?: string }>
}) {
const { query } = await searchParams;
return <div>Query: {query}</div>;
}
// Explicit opt-in caching (replaces implicit caching)
"use cache";
import { cacheLife, cacheTag } from 'next/cache';
export async function getCachedData() {
cacheLife('hours'); // Cache for hours
cacheTag('products'); // Tag for revalidation
const data = await fetch('https://api.example.com/products');
return data.json();
}
// Page-level caching
"use cache";
export default async function ProductsPage() {
const products = await getProducts();
return <ProductList products={products} />;
}
my-nextjs-app/
├── src/
│ ├── app/ # App Router (routes & layouts)
│ │ ├── layout.tsx # Root layout
│ │ ├── page.tsx # Home page
│ │ ├── loading.tsx # Root loading UI
│ │ ├── error.tsx # Root error boundary
│ │ ├── not-found.tsx # 404 page
│ │ ├── global-error.tsx # Global error boundary
│ │ ├── (auth)/ # Route group (no URL segment)
│ │ │ ├── login/
│ │ │ │ └── page.tsx
│ │ │ ├── register/
│ │ │ │ └── page.tsx
│ │ │ └── layout.tsx # Auth-specific layout
│ │ ├── (dashboard)/ # Route group
│ │ │ ├── dashboard/
│ │ │ │ ├── page.tsx
│ │ │ │ ├── loading.tsx
│ │ │ │ └── _components/ # Route-specific components
│ │ │ │ └── stats-card.tsx
│ │ │ ├── settings/
│ │ │ │ ├── page.tsx
│ │ │ │ └── profile/
│ │ │ │ └── page.tsx
│ │ │ └── layout.tsx # Dashboard layout with sidebar
│ │ ├── api/ # API routes (Route Handlers)
│ │ │ ├── auth/
│ │ │ │ └── [...nextauth]/
│ │ │ │ └── route.ts
│ │ │ ├── users/
│ │ │ │ ├── route.ts # GET /api/users, POST /api/users
│ │ │ │ └── [id]/
│ │ │ │ └── route.ts # GET/PUT/DELETE /api/users/:id
│ │ │ └── webhooks/
│ │ │ └── stripe/
│ │ │ └── route.ts
│ │ └── sitemap.ts # Dynamic sitemap
│ ├── components/ # Shared components
│ │ ├── ui/ # Base UI components (shadcn/ui)
│ │ │ ├── button.tsx
│ │ │ ├── card.tsx
│ │ │ ├── input.tsx
│ │ │ ├── dialog.tsx
│ │ │ └── index.ts # Barrel export
│ │ ├── forms/ # Form components
│ │ │ ├── login-form.tsx
│ │ │ └── user-form.tsx
│ │ ├── layouts/ # Layout components
│ │ │ ├── header.tsx
│ │ │ ├── footer.tsx
│ │ │ ├── sidebar.tsx
│ │ │ └── nav.tsx
│ │ └── providers/ # Context providers
│ │ ├── theme-provider.tsx
│ │ ├── query-provider.tsx
│ │ └── index.tsx
│ ├── lib/ # Utilities & configurations
│ │ ├── utils.ts # Helper functions (cn, formatDate)
│ │ ├── constants.ts # App-wide constants
│ │ ├── validations.ts # Zod schemas
│ │ ├── api.ts # API client configuration
│ │ ├── auth.ts # Auth configuration (NextAuth)
│ │ └── db.ts # Database client (Prisma/Drizzle)
│ ├── hooks/ # Custom React hooks
│ │ ├── use-debounce.ts
│ │ ├── use-local-storage.ts
│ │ ├── use-media-query.ts
│ │ └── use-user.ts
│ ├── types/ # TypeScript types
│ │ ├── index.ts # Common types
│ │ ├── api.ts # API response types
│ │ └── database.ts # Database model types
│ ├── styles/ # Global styles
│ │ └── globals.css # Tailwind + custom CSS
│ ├── config/ # Configuration files
│ │ ├── site.ts # Site metadata
│ │ ├── nav.ts # Navigation config
│ │ └── dashboard.ts # Dashboard config
│ ├── middleware.ts # Next.js 14/15 middleware
│ └── proxy.ts # Next.js 16+ (replaces middleware.ts)
├── public/
│ ├── favicon.ico
│ ├── robots.txt
│ ├── images/
│ └── fonts/
├── prisma/ # Database (if using Prisma)
│ ├── schema.prisma
│ ├── migrations/
│ └── seed.ts
├── tests/ # Testing
│ ├── e2e/ # Playwright E2E tests
│ │ └── auth.spec.ts
│ ├── integration/
│ └── unit/
├── .github/
│ └── workflows/
│ ├── ci.yml
│ └── deploy.yml
├── next.config.ts # Next.js configuration
├── tailwind.config.ts # Tailwind configuration
├── postcss.config.js
├── tsconfig.json
├── .eslintrc.json
├── .prettierrc
├── .env.local # Local environment
├── .env.example # Example environment
├── .nvmrc # Node version (22+ for Next.js 16)
├── package.json
├── pnpm-lock.yaml # Use pnpm for faster installs
├── components.json # shadcn/ui config
├── README.md
└── CHANGELOG.md
my-enterprise-app/
├── src/
│ ├── app/
│ │ ├── (marketing)/ # Public marketing pages
│ │ │ ├── page.tsx
│ │ │ ├── pricing/
│ │ │ ├── about/
│ │ │ └── layout.tsx
│ │ ├── (app)/ # Authenticated app
│ │ │ ├── dashboard/
│ │ │ ├── projects/
│ │ │ │ ├── page.tsx
│ │ │ │ ├── [projectId]/
│ │ │ │ │ ├── page.tsx
│ │ │ │ │ ├── settings/
│ │ │ │ │ └── _components/
│ │ │ │ └── new/
│ │ │ └── layout.tsx
│ │ └── api/
│ ├── features/ # Feature-based modules
│ │ ├── auth/
│ │ │ ├── components/
│ │ │ ├── hooks/
│ │ │ ├── lib/
│ │ │ └── types.ts
│ │ ├── projects/
│ │ │ ├── components/
│ │ │ │ ├── project-card.tsx
│ │ │ │ ├── project-list.tsx
│ │ │ │ └── project-form.tsx
│ │ │ ├── hooks/
│ │ │ │ └── use-projects.ts
│ │ │ ├── lib/
│ │ │ │ ├── actions.ts # Server Actions
│ │ │ │ └── queries.ts
│ │ │ ├── types.ts
│ │ │ └── index.ts # Public API
│ │ └── billing/
│ ├── components/ # Shared components only
│ ├── lib/
│ ├── hooks/
│ └── types/
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Recommended for production
reactStrictMode: true,
poweredByHeader: false,
// React Compiler (stable in Next.js 16)
reactCompiler: true,
// Turbopack is now default - no configuration needed
// For custom Turbopack config:
// turbopack: { ... }
// Enable experimental features carefully
experimental: {
typedRoutes: true, // Type-safe routing
},
// Image optimization
images: {
remotePatterns: [
{
protocol: "https",
hostname: "images.unsplash.com",
},
{
protocol: "https",
hostname: "*.cloudinary.com",
},
],
formats: ["image/avif", "image/webp"],
},
// Security headers
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
{
key: "Permissions-Policy",
value: "camera=(), microphone=(), geolocation=()",
},
],
},
];
},
// Redirects
async redirects() {
return [
{
source: "/old-page",
destination: "/new-page",
permanent: true,
},
];
},
// Rewrites (for proxying)
async rewrites() {
return [
{
source: "/api/external/:path*",
destination: "https://api.external.com/:path*",
},
];
},
// Logging
logging: {
fetches: {
fullUrl: true,
},
},
// Bundle analyzer (conditional)
...(process.env.ANALYZE === "true" && {
webpack: (config) => {
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: true,
}),
);
return config;
},
}),
};
export default nextConfig;
// src/app/dashboard/page.tsx
import { Suspense } from 'react';
import { getUser } from '@/lib/auth';
import { DashboardStats } from './_components/dashboard-stats';
import { RecentActivity } from './_components/recent-activity';
import { DashboardSkeleton } from './_components/dashboard-skeleton';
export const metadata = {
title: 'Dashboard',
description: 'View your dashboard',
};
export default async function DashboardPage() {
const user = await getUser();
return (
<div className="container py-8">
<h1 className="text-3xl font-bold mb-8">
Welcome back, {user.name}
</h1>
<Suspense fallback={<DashboardSkeleton />}>
<DashboardStats userId={user.id} />
</Suspense>
<Suspense fallback={<div>Loading activity...</div>}>
<RecentActivity userId={user.id} />
</Suspense>
</div>
);
}
// src/components/forms/login-form.tsx
'use client';
import { useState, useTransition } from 'react';
import { useRouter } from 'next/navigation';
import { zodResolver } from '@hookform/resolvers/zod';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { login } from '@/features/auth/lib/actions';
const loginSchema = z.object({
email: z.string().email('Invalid email address'),
password: z.string().min(8, 'Password must be at least 8 characters'),
});
type LoginFormData = z.infer<typeof loginSchema>;
export function LoginForm() {
const router = useRouter();
const [isPending, startTransition] = useTransition();
const [error, setError] = useState<string | null>(null);
const form = useForm<LoginFormData>({
resolver: zodResolver(loginSchema),
defaultValues: {
email: '',
password: '',
},
});
async function onSubmit(data: LoginFormData) {
setError(null);
startTransition(async () => {
const result = await login(data);
if (result.error) {
setError(result.error);
return;
}
router.push('/dashboard');
router.refresh();
});
}
return (
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
{error && (
<div className="p-3 text-sm text-red-500 bg-red-50 rounded-md">
{error}
</div>
)}
<Input
type="email"
placeholder="Email"
{...form.register('email')}
disabled={isPending}
/>
<Input
type="password"
placeholder="Password"
{...form.register('password')}
disabled={isPending}
/>
<Button type="submit" disabled={isPending} className="w-full">
{isPending ? 'Signing in...' : 'Sign in'}
</Button>
</form>
);
}
// src/features/projects/lib/actions.ts
"use server";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { z } from "zod";
import { db } from "@/lib/db";
import { getUser } from "@/lib/auth";
const createProjectSchema = z.object({
name: z.string().min(1).max(100),
description: z.string().max(500).optional(),
});
export async function createProject(formData: FormData) {
const user = await getUser();
if (!user) {
throw new Error("Unauthorized");
}
const validatedFields = createProjectSchema.safeParse({
name: formData.get("name"),
description: formData.get("description"),
});
if (!validatedFields.success) {
return {
error: "Invalid fields",
issues: validatedFields.error.flatten().fieldErrors,
};
}
const project = await db.project.create({
data: {
...validatedFields.data,
userId: user.id,
},
});
revalidatePath("/projects");
redirect(`/projects/${project.id}`);
}
export async function deleteProject(projectId: string) {
const user = await getUser();
if (!user) {
throw new Error("Unauthorized");
}
await db.project.delete({
where: {
id: projectId,
userId: user.id, // Ensure ownership
},
});
revalidatePath("/projects");
}
// src/app/api/users/route.ts
import { NextRequest, NextResponse } from "next/server";
import { z } from "zod";
import { db } from "@/lib/db";
import { getUser } from "@/lib/auth";
const createUserSchema = z.object({
name: z.string().min(1),
email: z.string().email(),
});
export async function GET(request: NextRequest) {
try {
const user = await getUser();
if (!user) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
const { searchParams } = new URL(request.url);
const page = parseInt(searchParams.get("page") ?? "1");
const limit = parseInt(searchParams.get("limit") ?? "10");
const users = await db.user.findMany({
skip: (page - 1) * limit,
take: limit,
select: {
id: true,
name: true,
email: true,
createdAt: true,
},
});
return NextResponse.json({ users, page, limit });
} catch (error) {
console.error("Failed to fetch users:", error);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
}
export async function POST(request: NextRequest) {
try {
const body = await request.json();
const validatedData = createUserSchema.parse(body);
const user = await db.user.create({
data: validatedData,
});
return NextResponse.json(user, { status: 201 });
} catch (error) {
if (error instanceof z.ZodError) {
return NextResponse.json({ error: "Validation failed", issues: error.errors }, { status: 400 });
}
console.error("Failed to create user:", error);
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
}
}
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
},
"target": "ES2022"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
{
"extends": ["next/core-web-vitals", "next/typescript", "prettier"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-explicit-any": "error",
"prefer-const": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
},
"overrides": [
{
"files": ["*.test.ts", "*.test.tsx", "*.spec.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}
// Next.js 16+: proxy.ts (Node.js runtime only)
// Next.js 14/15: middleware.ts (Edge or Node.js runtime)
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import { getToken } from "next-auth/jwt";
const publicPaths = ["/login", "/register", "/forgot-password", "/"];
const apiAuthPrefix = "/api/auth";
// Next.js 16+: export function proxy()
// Next.js 14/15: export function middleware()
export async function proxy(request: NextRequest) {
const { pathname } = request.nextUrl;
// Allow auth API routes
if (pathname.startsWith(apiAuthPrefix)) {
return NextResponse.next();
}
// Allow public paths
if (publicPaths.some((path) => pathname === path)) {
return NextResponse.next();
}
// Check authentication for protected routes
const token = await getToken({
req: request,
secret: process.env.NEXTAUTH_SECRET,
});
if (!token) {
const loginUrl = new URL("/login", request.url);
loginUrl.searchParams.set("callbackUrl", pathname);
return NextResponse.redirect(loginUrl);
}
return NextResponse.next();
}
export const config = {
matcher: [
/*
* Match all request paths except:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
* - public folder
*/
"/((?!_next/static|_next/image|favicon.ico|.*\\..*|api/webhooks).*)",
],
};
When validating an existing Next.js project, check:
src/ directory for source codesrc/app/ (not Pages Router)app/ directory (in src/components/)_components/ folders(groupName) for logical organizationnext.config.ts (not .js/.mjs)@/*).nvmrc with Node.js versionnext/image# Create new Next.js 16 project (latest)
pnpm create next-app@latest my-app --typescript --tailwind --eslint --app --src-dir --import-alias "@/*"
cd my-app
# Add essential dependencies
pnpm add zod @hookform/resolvers react-hook-form
pnpm add -D prettier eslint-config-prettier @types/node
# Add shadcn/ui
pnpm dlx shadcn@latest init
pnpm dlx shadcn@latest add button card input dialog
# Add database (Prisma example)
pnpm add @prisma/client
pnpm add -D prisma
pnpm prisma init
# Add authentication
pnpm add next-auth@beta
# Add testing
pnpm add -D @playwright/test vitest @testing-library/react
# Create .nvmrc (Node 22+ for Next.js 16)
echo "22.12.0" > .nvmrc
# Initialize git hooks
pnpm add -D husky lint-staged
pnpm husky init
# Upgrade to Next.js 16
pnpm add next@latest react@latest react-dom@latest
# Migrate middleware to proxy
mv src/middleware.ts src/proxy.ts
# Then rename: middleware() -> proxy()
# Check for deprecated APIs
npx @next/codemod@latest upgrade
# Enable React Compiler
# In next.config.ts: reactCompiler: true
## Project Structure Analysis
### ✅ Correct
- [List what's done right]
### ⚠️ Warnings
- [Non-critical issues]
### ❌ Issues
- [Critical problems to fix]
### 📋 Recommendations
- [Suggested improvements]
### 🔧 Fix Commands
[Provide exact commands to fix issues]
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job