# zenstackhq/zenstack

Modern data layer for TypeScript apps - type-safe ORM, built-in access control, automatic query services

Repository: https://github.com/zenstackhq/zenstack
Canonical: https://ross.abutalabs.com/products/zenstack
Homepage: https://zenstack.dev
Language: TypeScript
License: MIT
License Family: permissive
Topics: fullstack, nextjs, orm, authorization, prisma, access-control, api, openapi, rls, saas, javascript, auth, acl, node, permission, authz, rbac, schema, ai-friendly
Last push: 2026-08-24T09:13:01+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 87, longevity 100
- inputs: {"age_days": 1441, "days_push": 9, "days_rel": 10, "gap_med": 5.5, "n_releases_24m": 87}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2930, forks 150 (observed 2026-08-28T04:07:30.617570+00:00)

## What it is
ZenStack is a TypeScript data layer toolkit providing a schema-first, type-safe ORM with a Prisma-compatible API built on Kysely, plus built-in access control defined directly in the schema. It can automatically generate CRUD web APIs, Zod schemas, OpenAPI specs, and TanStack Query hooks from a single data model.

## Use cases
- replace Prisma with a pure TypeScript ORM
- enforce row-level access control in a TypeScript app
- auto-generate CRUD APIs from a data model
- generate Zod validation schemas from database models
- build a multi-tenant SaaS with permissions
- generate typed TanStack Query hooks for the frontend
- model polymorphic data with inheritance in an ORM

## When to choose
- you want a Prisma-compatible ORM without Rust/WASM dependencies
- you need authorization policies colocated with your data model
- you're building a full-stack TypeScript app with Next.js or similar
- you want automatic secured CRUD APIs with framework adapters

## When to avoid
- you need a mature ORM with a very large ecosystem and long track record
- your project depends on Prisma-specific generators or features not in ZModel
- you prefer raw SQL-first workflows over schema-first modeling

## Facets
- artifact type: library
- maturity: active
- function: orm, authorization, api-framework, serialization, web-framework
- domain: web-development, backend, databases, developer-tools
- platform: cross-platform
- tags: prisma-compatible, kysely, row-level-security, schema-first, zod, openapi, tanstack-query, nextjs, crud-api, rbac, nodejs, typescript, web-server

## Member repositories
- zenstackhq/zenstack (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:30.617570+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:33:26.768261+00:00, confidence not recorded.
  - readme: https://github.com/zenstackhq/zenstack (fetched 2026-08-28T04:07:30.617570+00:00, sha 133086513440)
  - homepage: https://zenstack.dev (fetched 2026-08-29T09:49:07.400544+00:00, sha 5bbce89e0e1f)
  - site_page: https://zenstack.dev/docs (fetched 2026-08-29T09:49:07.409962+00:00, sha bc076e3cbbf2)
  - site_page: https://zenstack.dev/docs/modeling (fetched 2026-08-29T09:49:07.411759+00:00, sha cfdc75f511fe)
  - site_page: https://zenstack.dev/docs/orm (fetched 2026-08-29T09:49:07.413383+00:00, sha 2ac3bcf78496)
  - site_page: https://zenstack.dev/docs/orm/polymorphism (fetched 2026-08-29T09:49:07.415072+00:00, sha 5ac7e9bc6582)
  - site_page: https://zenstack.dev/docs/orm/access-control (fetched 2026-08-29T09:49:07.417619+00:00, sha 4128354f9c32)
  - site_page: https://zenstack.dev/docs/service (fetched 2026-08-29T09:49:07.420396+00:00, sha 746e707ba8f8)
  - site_page: https://zenstack.dev/docs/service/server-adapter (fetched 2026-08-29T09:49:07.422563+00:00, sha c6e3cfb95db4)
  - site_page: https://zenstack.dev/docs/service/client-sdk/tanstack-query (fetched 2026-08-29T09:49:07.425479+00:00, sha 9d3becee290f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
