Giter Site home page Giter Site logo

timoclsn / next-safe-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theedoran/next-safe-action

0.0 0.0 0.0 23.91 MB

Type safe and validated Server Actions in your Next.js (App Router) project.

Home Page: https://next-safe-action.dev

License: MIT License

Shell 0.38% JavaScript 11.88% TypeScript 81.37% CSS 6.37%

next-safe-action's Introduction

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

How does it work?

Like magic. ๐Ÿช„

Features

  • โœ… Pretty simple
  • โœ… End-to-end type safety
  • โœ… Context based clients (with middlewares)
  • โœ… Input validation using Zod
  • โœ… Advanced server error handling
  • โœ… Optimistic updates

Documentation

Explore the documentation for version 5 of the library on the next-safe-action website. โœจ

If you are looking for old versions documentation, check out:

Next.js >= 14 vs 13

Server Actions are now a stable feature in React. For this reason, there were some internal breaking changes to the API, and so a new version of the library is required to prevent backward compatibility issues.

You can continue to use next-safe-action version 4 for your Next.js 13 app:

# For Next.js 13 apps
npm i next-safe-action@v4


# For Next.js >= 14 apps
npm i next-safe-action

Migration guide

Version 4.x.x of the library introduced some breaking changes to the API. Please check out the v3 to v4 migration guide on the website for more information.


Version 5.x.x of the library is required for Next.js >= 14 applications. Please check out the v4 to v5 migration guide on the website for more information.

Example

You can find a basic working implementation of the library here.

Contributing

If you want to contribute to next-safe-action, the best way is to fork this repository and open a pull request when you're done implementing your feature.

If you found bugs or just want to ask a question, feel free to open an issue.

License

next-safe-action is released under the MIT license.

next-safe-action's People

Contributors

theedoran avatar meienberger avatar alerosa avatar burry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.