Skip to main content

Type safe Server Actions in your Next.js project

next-safe-action handles your Next.js app mutations type safety, input/output 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 out of the box, with stateful and stateless actions.
Powerful middleware system
Manage authorization, log and halt execution, and much more with a composable middleware system.
Input/output validation using multiple validation libraries
Input and output are validated using your favorite library.
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.