What problem does it solve?
It prevents inconsistent API behavior in Next.js 16+ by standardizing how server actions and route handlers handle validation, authorization, revalidation, and error responses.
Core Features & Use Cases
- ActionResult<T> Contract: Uses a discriminated union to reliably separate success data from user-facing error strings for cleaner consumer branching.
- Portable CRUD Action Signatures: Defines consistent
getEntities, getEntityById, createEntity, updateEntity, and deleteEntity semantics that work across projects.
- Boundary-First Validation: Enforces Zod
safeParse exactly once at the action or route boundary to establish a clear trust boundary.
- Success-Only Cache Invalidation: Applies
revalidatePath only after a real mutation succeeds, and never on read-only actions.
- Next.js 16+ Correctness for params/searchParams: Treats
params and searchParams as Promises and parses them safely with await.
Quick Start
Implement your server action or route handler using the ActionResult<T> pattern, validate inputs with Zod safeParse at the boundary, and call revalidatePath only on the success path after the mutation completes.