next-safe-action Client & Action Definition
Quick Start
Chainable API Order
Each method returns a new client instance — the chain is immutable.
Entry Points
Supporting Docs
- Client setup & configuration
- Input & output validation with Standard Schema
- Server error handling
Anti-Patterns
For expected non-validation business errors ("out of stock", "not found"), use returnServerError(payload) instead — it sets result.serverError to the typed payload, bypassing handleServerError. See Server error handling.
Server Code Function Parameters
The function passed to .action() receives a single object:
For .stateAction(), a second argument is added:


