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, targeted for fast development.
End-to-end type safety
With next-safe-action you get full type safety between server and client code.
Context-based clients (with middlewares)
Powerful context-based clients with custom logic execution, thanks to middlewares.
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!