UNPKG

next-safe-action

Version:

Type safe and validated Server Actions in your Next.js project.

92 lines (62 loc) 4.44 kB
<div align="center"> <img src="https://raw.githubusercontent.com/TheEdoRan/next-safe-action/main/assets/logo.png" alt="next-safe-action logo" width="36" height="36"> <a href="https://github.com/TheEdoRan/next-safe-action"><h1>next-safe-action</h1></a> </div> **next-safe-action** is a library that takes full advantage of the latest and greatest Next.js, React and TypeScript features to let you define **type safe** Server Actions and execute them inside React Components. ## Features - ✅ Pretty simple - ✅ End-to-end type safety - ✅ Form Actions support - ✅ Powerful middleware system - ✅ Input/output validation using multiple validation libraries - ✅ Advanced server error handling - ✅ Optimistic updates ## Documentation **Explore the documentation for the current stable version of the library on the [next-safe-action v7 website](https://next-safe-action.dev).** ✨ ### Looking for v7 docs? You can keep using version 6 and eventually upgrade to version 7. Check out the v7 documentation [here](https://v7.next-safe-action.dev). ## Migrate from v7 to v8 Check out the [v7 to v8 migration guide](https://next-safe-action.dev/docs/migrations/v7-to-v8) to learn how to update your code for v8. ## Installation ```bash npm i next-safe-action ``` ## Playground You can find a basic working implementation of the library [here](https://github.com/TheEdoRan/next-safe-action/tree/main/apps/playground). ## Sponsors A big shout-out to all our [sponsors](https://github.com/sponsors/TheEdoRan)! You’re the driving force behind this library's growth, and we're truly grateful for your support. ❤️ ### 🥉 Enthusiasts (Bronze) <table> <tr> <td align="center"><a href="https://launch.arcjet.com/Wk7JBrE"><img src="https://avatars.githubusercontent.com/u/24397786?s=120&v=4" width="120" alt="ArcJet"/><br />ArcJet</a></td> </tr> </table> ### ☕ Supporters <table> <tr> <td align="center"><a href="https://github.com/pontusab"><img src="https://avatars.githubusercontent.com/u/655158?s=80&v=4" width="80" alt="Pontus Abrahamsson"/><br />Pontus Abrahamsson</a></td> <td align="center"><a href="https://www.robinwieruch.de"><img src="https://avatars.githubusercontent.com/u/2479967?s=80&v=4" width="80" alt="Robin Wieruch"/><br />Robin Wieruch</a></td> </tr> </table> ### 👷 Past sponsors <table> <tr> <td align="center"><a href="https://vercel.com"><img src="https://avatars.githubusercontent.com/u/14985020?s=50&v=4" width="50" alt="Vercel"/><br />Vercel</a></td> <td align="center"><a href="https://liam.so"><img src="https://avatars.githubusercontent.com/u/38444224?v=4&size=50" width="50" alt="Liam Murray"/><br />Liam Murray</a></td> <td align="center"><a href="https://chalifoux.dev"><img src="https://avatars.githubusercontent.com/u/3289533?v=4&size=50" width="50" alt="David Chalifoux"/><br />David Chalifoux</a></td> <td align="center"><a href="https://www.undheim.io"><img src="https://avatars.githubusercontent.com/u/46612252?v=4&size=50" width="50" alt="Rein Undheim"/><br />Rein Undheim</a></td> <td align="center"><a href="https://github.com/merthanmerter"><img src="https://avatars.githubusercontent.com/u/7555905?v=4&size=50" width="50" alt="Merthan Merter"/><br />Merthan Merter</a></td> <td align="center"><a href="https://github.com/marcotommoro"><img src="https://avatars.githubusercontent.com/u/65455109?v=4&size=50" width="50" alt="Marco Moroni"/><br />Marco Moroni</a></td> <td align="center"><a href="https://github.com/gvffelisberto"><img src="https://avatars.githubusercontent.com/u/17497942?v=4&size=50" width="50" alt="Gustavo Felisberto"/><br />Gustavo Felisberto</a></td> </tr> </table> ## Contributing If you want to contribute to next-safe-action, please check out the [contributing guide](https://github.com/TheEdoRan/next-safe-action/blob/main/CONTRIBUTING.md). If you found bugs or just want to ask a question, feel free to open an issue or a discussion by following the [issue templates](https://github.com/TheEdoRan/next-safe-action/issues/new/choose). ## Contributors <a href="https://github.com/TheEdoRan/next-safe-action/graphs/contributors"> <img src="https://contrib.rocks/image?repo=TheEdoRan/next-safe-action" /> </a> Made with [contrib.rocks](https://contrib.rocks). ## License next-safe-action is released under the [MIT License](https://github.com/TheEdoRan/next-safe-action/blob/main/LICENSE).