Modern data layer for TypeScript apps - type-safe ORM, built-in access control, automatic query services
Find a file
github-actions[bot] daaf0bbd7d
chore: bump version 3.0.0-beta.6 (#266)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2025-09-22 22:31:59 -07:00
.devcontainer chore: setup dev container (#25) 2025-06-16 18:32:09 +08:00
.github fix(policy): run pg/sqlite tests, misc dual db compatibility fixes (#260) 2025-09-22 16:16:15 -07:00
.vscode chore: fix telemetry env var for publish CI (#230) 2025-09-02 18:02:47 +08:00
packages chore: bump version 3.0.0-beta.6 (#266) 2025-09-22 22:31:59 -07:00
samples/blog chore: bump version 3.0.0-beta.6 (#266) 2025-09-22 22:31:59 -07:00
scripts chore: separate extension and language id for vscode extension (#217) 2025-08-30 18:11:11 +08:00
tests chore: bump version 3.0.0-beta.6 (#266) 2025-09-22 22:31:59 -07:00
.coderabbit.yaml chore: fix coderabbit config (#210) 2025-08-26 18:34:56 +08:00
.gitignore chore: setup dev container (#25) 2025-06-16 18:32:09 +08:00
.prettierignore feat: implementing mixin (#106) 2025-07-21 19:48:48 +08:00
.prettierrc chore: upgrade eslint (#36) 2025-06-21 23:26:56 +08:00
BREAKINGCHANGES.md fix issues with nested read; getting more test cases to pass (#6) 2025-05-24 23:06:26 -07:00
CLAUDE.md chore: add package.json export to sql.js project (#235) 2025-09-03 17:09:21 -07:00
LICENSE fix: crud typing fixes and more test cases (#21) 2025-06-15 08:44:05 +08:00
package.json chore: bump version 3.0.0-beta.6 (#266) 2025-09-22 22:31:59 -07:00
pnpm-lock.yaml fix: format zod errors, issue with "this" member access (#250) 2025-09-13 21:35:08 -07:00
pnpm-workspace.yaml fix: format zod errors, issue with "this" member access (#250) 2025-09-13 21:35:08 -07:00
README.md chore(policy): more test cases and update (#246) 2025-09-11 22:23:10 -07:00
TODO.md feat(policy): many-to-many and self-relation support (#256) 2025-09-19 11:55:25 -07:00
turbo.json feat: delegate client typing (#117) 2025-07-28 22:34:09 +08:00
vitest.config.ts chore: fix telemetry env var for publish CI (#230) 2025-09-02 18:02:47 +08:00

ZenStack V3

V3 is currently in beta phase and not ready for production use. Feedback and bug reports are greatly appreciated. Please visit this dedicated discord channel for chat and support.

What's ZenStack

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

  • A modern schema-first ORM that's compatible with Prisma's schema and API
  • Versatile data access APIs: high-level (Prisma-style) ORM queries + low-level (Kysely) query builder
  • Built-in access control and data validation (coming soon)
  • Advanced data modeling patterns like polymorphism
  • Designed for extensibility and flexibility: plugins, life-cycle hooks, etc.
  • Automatic CRUD web APIs with adapters for popular frameworks (coming soon)
  • Automatic TanStack Query hooks for easy CRUD from the frontend (coming soon)

What's new with V3

ZenStack V3 is a major rewrite of V2. The biggest change is V3 doesn't have a runtime dependency to Prisma anymore. Instead of working as a big wrapper of Prisma as in V2, V3 made a bold move and implemented the entire ORM engine using Kysely, while keeping the query API fully compatible with Prisma.

Please check this blog post for why we made this big architectural change 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.

Although ZenStack v3's runtime doesn't depend on Prisma anymore (specifically, @prisma/client), it still relies on Prisma to handle database migration. See database migration for more details.

Quick start

You can also check the blog sample for a complete example.

Installation

1. Creating a new project

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

npm create zenstack@next my-project

2. Setting up an existing project

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

npx @zenstackhq/cli@next init

3. Manual setup

Alternatively, you can set it up manually:

npm install -D @zenstackhq/cli@next
npm install @zenstackhq/runtime@next

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

Documentation

Please visit the doc site for detailed documentation.