mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
|
|
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| eslint.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| vitest.config.ts | ||
@zenstackhq/orm
The core ZenStack ORM engine, built on top of Kysely. Provides a type-safe database client (ZenStackClient) with a high-level, Prisma-compatible CRUD API and direct access to the underlying Kysely query builder for advanced queries.
Key Features
- Type-safe CRUD operations generated from your ZModel schema
- Plugin system for query interception and entity mutation hooks
- Multi-dialect support — SQLite (better-sqlite3), PostgreSQL (pg), and MySQL (mysql2)
- Computed fields evaluated at the database level
- Custom procedures for encapsulating complex queries and mutations
Installation
npm install @zenstackhq/orm
Usage
import { ZenStackClient } from '@zenstackhq/orm';
import schema from './schema';
const client = new ZenStackClient(schema, {
/* dialect config */
});
const user = await client.user.findFirst({ where: { email: 'alice@example.com' } });