What problem does it solve?
Align Next.js App Router code with the framework's rendering model to prevent accidental client components in server code, reduce client bundle size, and avoid leaking server secrets.
Core Features & Use Cases
- Enforces that Server Components are default and 'use client' is placed only on the smallest leaves that require it.
- Prevents importing server-only modules (fs, database clients, secret managers) into client components.
- Keeps route handlers thin by delegating business logic to services and returning typed responses.
- Narrows middleware to lightweight tasks (auth checks, redirects, headers) without DB access or business logic.
- Validates server actions input with schema validation and re-verifies authorization at the top.
- Ensures explicit caching policies for data fetches and cache handlers to avoid stale data.
- Promotes pure
generateMetadata / generateStaticParams functions to avoid side effects and secrets.
Quick Start
Review an App Router file and apply the guard rules to ensure server/client boundaries are respected and the code remains testable.