MCPcopy Index your code
hub / github.com/zenstackhq/zenstack

github.com/zenstackhq/zenstack @v3.8.2

repository ↗ · DeepWiki ↗ · release v3.8.2 ↗ · Ask this repo → · + Follow
2,773 symbols 9,309 edges 839 files 93 documented · 3% updated todayv3.8.3 · 2026-07-04★ 2,923161 open issues
README
<a href="https://zenstack.dev">






<img src="https://raw.githubusercontent.com/zenstackhq/zenstack-docs/main/static/img/logo.png" height="128">



</a>
<h1>ZenStack: Modern Data Layer for TypeScript Apps</h1>
<a href="https://www.npmjs.com/package/@zenstackhq/cli?activeTab=versions">
    <img src="https://img.shields.io/npm/v/%40zenstackhq%2Fcli/latest">
</a>
<a href="https://www.npmjs.com/package/@zenstackhq/language">
    <img src="https://img.shields.io/npm/dm/@zenstackhq/language">
</a>    
<img src="https://github.com/zenstackhq/zenstack/actions/workflows/build-test.yml/badge.svg">
<a href="https://twitter.com/zenstackhq">
    <img src="https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Fzenstackhq%2Fzenstack">
</a>
<a href="https://discord.gg/Ykhr738dUe">
    <img src="https://img.shields.io/discord/1035538056146595961">
</a>
<a href="https://github.com/zenstackhq/zenstack/blob/main/LICENSE">
    <img src="https://img.shields.io/badge/license-MIT-green">
</a>

What's ZenStack

Read full documentation at 👉🏻 https://zenstack.dev/docs.

ZenStack is a TypeScript database toolkit for developing full-stack or backend Node.js/Bun applications. It provides a unified data modeling and query solution with the following features:

  • 🔧 Modern schema-first ORM that's compatible with Prisma's schema and API
  • 📊 Versatile API - high-level ORM queries + low-level Kysely query builder
  • 🔐 Built-in access control and data validation
  • 🚀 Advanced data modeling patterns like polymorphism
  • 🧩 Designed for extensibility and flexibility
  • ⚙️ Automatic CRUD web APIs with adapters for popular frameworks
  • 🏖️ Automatic TanStack Query hooks for easy CRUD from the frontend
  • 💎 Zod schema generation

What's New in V3

ZenStack V3 is a major rewrite. It replaced Prisma ORM with its own ORM engine built on top of Kysely while keeping a Prisma-compatible query API. This architecture change brings the level of flexibility that we couldn't imagine in previous versions. Please check this blog post for why we made this bold decision.

Even without using advanced features, ZenStack offers the following benefits as a drop-in replacement to Prisma:

  1. Pure TypeScript implementation without any Rust/WASM components.
  2. More TypeScript type inference, less code generation.
  3. Fully-typed query-builder API as a better escape hatch compared to Prisma's raw queries or typed SQL.

Try It Now

Open in StackBlitz

Installation

1. Creating a new project

Use the following command to scaffold a simple TypeScript command line application with ZenStack configured:

npm create zenstack@latest my-project

2. Setting up an existing project

Or, if you have an existing project, use the CLI to initialize it:

npx @zenstackhq/cli@latest init

3. Setting up manually

Alternatively, you can set it up manually:

npm install -D @zenstackhq/cli
npm install @zenstackhq/schema @zenstackhq/orm

Then create a zenstack folder and a schema.zmodel file in it.

Documentation

https://zenstack.dev/docs/

Sponsors

Thank you for your generous support!

Current Sponsors

Suhyl Suhyl Marblism Marblism Mermaid Chart Mermaid Chart CodeRabbit CodeRabbit Johann Rohn Johann Rohn

Previous Sponsors

Benjamin Zecirovic Benjamin Zecirovic Ulric Ulric Fabian Jocks Fabian Jocks

Community

Join our discord server for chat and updates!

Contributors

Thanks to all the contributors who have helped make ZenStack better!

Source

Docs

License

MIT

Extension points exported contracts — how you extend this code

AstValidator (Interface)
(no doc) [12 implementers]
packages/language/src/validators/common.ts
OpenApiSpecGenerator (Interface)
(no doc) [6 implementers]
packages/server/src/api/common/types.ts
CliPlugin (Interface)
(no doc) [3 implementers]
packages/sdk/src/cli-plugin.ts
SchemaLookupCache (Interface)
* Structural lookups derived purely from the (immutable) schema. The schema does not * change for a client's lifetime,
packages/orm/src/client/query-utils.ts
CacheEntry (Interface)
(no doc)
packages/ide/vscode/src/extension/documentation-cache.ts
IntrospectedTable (Interface)
(no doc)
packages/cli/src/actions/pull/provider/provider.ts
AdapterConfig (Interface)
(no doc)
packages/auth-adapters/better-auth/src/config.ts
SchemaAccessorConstructor (Interface)
(no doc)
packages/schema/src/accessor.ts

Core symbols most depended-on inside this repo

createField
called by 398
packages/clients/client-helpers/test/test-helpers.ts
createTestClient
called by 385
packages/testtools/src/client.ts
createPolicyTestClient
called by 384
packages/testtools/src/client.ts
push
called by 361
packages/orm/src/client/helpers/schema-db-pusher.ts
$unuseAll
called by 271
packages/orm/src/client/client-impl.ts
log
called by 232
packages/server/src/types.ts
$setAuth
called by 231
packages/orm/src/client/client-impl.ts
invariant
called by 199
packages/common-helpers/src/tiny-invariant.ts

Shape

Method 1,358
Function 934
Class 377
Interface 97
Enum 7

Languages

TypeScript100%

Modules by API surface

packages/orm/src/client/zod/factory.ts105 symbols
packages/language/src/generated/ast.ts104 symbols
packages/orm/src/utils/kysely-utils.ts103 symbols
packages/sdk/src/prisma/prisma-builder.ts89 symbols
packages/server/src/api/rest/index.ts76 symbols
packages/orm/src/client/crud/operations/base.ts66 symbols
packages/orm/src/client/crud/dialects/base-dialect.ts65 symbols
packages/sdk/src/ts-schema-generator.ts62 symbols
packages/language/src/factory/declaration.ts61 symbols
packages/language/src/factory/expression.ts60 symbols
packages/plugins/policy/src/policy-handler.ts54 symbols
packages/language/src/zmodel-code-generator.ts52 symbols

Dependencies from manifests, versioned

@better-auth/cli1.4.19 · 1×
@better-auth/core1.4.19 · 1×
@edge-runtime/vm5.0.0 · 1×
@eslint/js9.29.0 · 1×
@readme/openapi-parser6.0.0 · 1×
@sveltejs/adapter-auto7.0.0 · 1×
@sveltejs/kitcatalog: · 1×
@sveltejs/package2.5.7 · 1×
@sveltejs/vite-plugin-svelte6.2.1 · 1×
@tailwindcss/vite4.1.18 · 1×

Datastores touched

(mysql)Database · 1 repos
dbDatabase · 1 repos
dbDatabase · 1 repos

For agents

$ claude mcp add zenstack \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact