ZenStack: Modern Data Layer for TypeScript Apps

# 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](https://github.com/prisma/prisma)'s schema and API - 📊 Versatile API - high-level ORM queries + low-level [Kysely](https://kysely.dev) query builder - 🔐 Built-in access control and data validation - 🚀 Advanced data modeling patterns like [polymorphism](https://zenstack.dev/docs/orm/polymorphism) - 🧩 Designed for extensibility and flexibility - ⚙️ Automatic CRUD web APIs with adapters for popular frameworks - 🏖️ Automatic [TanStack Query](https://github.com/TanStack/query) hooks for easy CRUD from the frontend - 💎 [Zod](https://zod.dev) 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](https://kysely.dev) 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](https://zenstack.dev/blog/next-chapter-1) 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](https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/raw-queries) or [typed SQL](https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/typedsql). # Try It Now [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/~/github.com/zenstackhq/v3-doc-quick-start?file=zenstack%2fschema.zmodel&file=main.ts&view=editor&showSidebar=0&hideNavigation=1&hideExplorer=1) ## Installation ### 1. Creating a new project Use the following command to scaffold a simple TypeScript command line application with ZenStack configured: ```bash 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: ```bash npx @zenstackhq/cli@latest init ``` ### 3. Setting up manually Alternatively, you can set it up manually: ```bash 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/](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](https://discord.gg/Ykhr738dUe) for chat and updates! # Contributors Thanks to all the contributors who have helped make ZenStack better! ### Source ### Docs ## License [MIT](LICENSE)