Skip to main content


next-safe-action is a library that takes full advantage of the latest and greatest Next.js, React and TypeScript features, using validation libraries of your choice, to let you define typesafe Server Actions and execute them inside Client Components.

How does it work?

Like magic. 🪄


  • ✅ Pretty simple
  • ✅ End-to-end type safety
  • ✅ Context based clients (with middlewares)
  • ✅ Input validation using multiple validation libraries
  • ✅ Advanced server error handling
  • ✅ Optimistic updates