# next-safe-action/next-safe-action

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

Repository: https://github.com/next-safe-action/next-safe-action
Canonical: https://ross.abutalabs.com/products/next-safe-action
Homepage: https://next-safe-action.dev
Language: TypeScript
License: MIT
License Family: permissive
Topics: actions, app-dir, mutations, next, nextjs, react, rsc, server-components, typesafe, typescript, react-server-components, react-actions, server-actions, next-actions, zod
Last push: 2026-08-20T23:07:17+00:00

## Health v2 (maintenance only)
Score: 92/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 98, release rhythm 86, longevity 88
- inputs: {"age_days": 1236, "days_push": 13, "days_rel": 13, "gap_med": 1.0, "n_releases_24m": 71}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3061, forks 47 (observed 2026-08-28T04:07:41.164137+00:00)

## What it is
next-safe-action is a TypeScript library for defining type-safe, validated Next.js Server Actions with middleware support. It works with any Standard Schema validator (e.g., Zod, Valibot) and provides end-to-end type safety between server and client code.

## Use cases
- validate inputs for next.js server actions
- create type-safe mutations in next.js app router
- add middleware like auth to server actions
- handle errors in server actions with proper typing
- build end-to-end typesafe api with next.js
- use zod validation with react server components

## When to choose
- you use Next.js 14+ App Router with Server Actions and want type safety
- you need input validation and middleware (auth, logging) for mutations
- you want a well-maintained library with strong community adoption

## When to avoid
- you don't use Next.js or its Server Actions
- you're on an older Next.js version without App Router support
- you prefer plain API routes or tRPC for client-server communication

## Facets
- artifact type: library
- maturity: active
- function: api-framework, middleware, form-handling, type-system
- domain: web-development, frontend, backend, developer-tools
- platform: -
- tags: nextjs, server-actions, react-server-components, zod, standard-schema, app-router, type-safety, nodejs, typescript, web-server

## Member repositories
- next-safe-action/next-safe-action (main) score 92

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:41.164137+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:28:22.255968+00:00, confidence not recorded.
  - readme: https://github.com/next-safe-action/next-safe-action (fetched 2026-08-28T04:07:41.164137+00:00, sha 5ca6180c67fc)
  - homepage: https://next-safe-action.dev (fetched 2026-08-29T09:43:56.437297+00:00, sha c2eebef07b84)
  - site_page: https://next-safe-action.dev/docs/getting-started (fetched 2026-08-29T09:43:56.446867+00:00, sha 11621dd92244)
- Data as of 2026-08-30T08:39:29.467469+00:00.
