Server Actions can call requireAuth() to ensure the mutation runs for an authenticated user.
Create Server Helpers
Protected Action
Form Usage
Guidelines
| Pattern | Why |
|---|---|
Use requireAuth() inside every protected action | Middleware can protect routes, but actions should still enforce auth. |
| Validate form input before writing | Server Actions receive untrusted user input. |
| Mutate through the adapter or your app database layer | Keep business writes server-side. |
Call revalidatePath() after writes | Refresh stale Server Component output. |