<div align="center">
  <img src="https://raw.githubusercontent.com/next-safe-action/next-safe-action/main/assets/logo.png" alt="next-safe-action logo" width="36" height="36">
  <a href="https://github.com/next-safe-action/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 website](https://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/next-safe-action/next-safe-action/tree/main/apps/playground).

## Sponsors

These amazing people and companies help keep next-safe-action running! ❤️

<p align="center">
  <a href="https://github.com/sponsors/TheEdoRan">
    <img src="https://raw.githubusercontent.com/TheEdoRan/sponsors-data/main/sponsors.svg" alt="Sponsors" />
  </a>
</p>

## Contributing

If you want to contribute to next-safe-action, please check out the [contributing guide](https://github.com/next-safe-action/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/next-safe-action/next-safe-action/issues/new/choose).

## Contributors

<a href="https://github.com/next-safe-action/next-safe-action/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=next-safe-action/next-safe-action" />
</a>

Made with [contrib.rocks](https://contrib.rocks).

## Preview releases powered by [pkg.pr.new](https://pkg.pr.new)

[![pkg.pr.new](https://pkg.pr.new/badge/next-safe-action/next-safe-action)](https://pkg.pr.new/~/next-safe-action/next-safe-action)

## License

next-safe-action is released under the [MIT License](https://github.com/next-safe-action/next-safe-action/blob/main/LICENSE).
