Skip to main content

Type safe Server Actions in your Next.js (App Router) project

next-safe-action handles your Next.js app mutations type safety, input validation, server errors and even more!

Why choose next-safe-action?
Pretty simple
No need to overcomplicate things. next-safe-action API is pretty simple, designed with fast development in mind.
End-to-end type safety
With next-safe-action you get full type safety between server and client code.
Form Actions support
next-safe-action supports Form Actions via stateful `useStateAction` hook.
Powerful middleware system
Manage authorization, log and halt execution, and much more with a composable middleware system.
Input validation using multiple validation libraries
Input passed from the client to the server is validated using libraries of your choice.
Advanced server error handling
Decide how to return execution errors to the client and how to log them on the server.
Optimistic updates
Need to update UI immediately without waiting for server response? You can do it with the powerful useOptimisticAction hook.
It's time to try it out for yourself!