zmdbzero-maintenance data layer
Docs Benchmarks Anti-patterns OpenAPI
◇ zero schema drift · AOT validation

Define once.
Everything derives.

A TypeScript data layer where entities, DTOs, validation, serialization, OpenAPI and CRUD all derive from one schema — at compile time.

import {
  defineRepository,
  schemaOf,
  type CreateDTO,
  type Entity,
  type HasDefault,
  type PrimaryKey,
  type Serial,
  type Sql,
  type Table,
} from '@zmdb/core';

// 1 — declare the table once, as a type
export interface User extends Table<'users'> {
  id: number & Sql<'integer'> & Serial & PrimaryKey;
  email: string & Sql<'text'>;
  role: ('admin' | 'user') & HasDefault;
}

// 2 — every other shape is derived from that declaration
type Row     = Entity<User>;    // { id; email; role }
type NewUser = CreateDTO<User>; // { email; role? } — no id: the database makes it

// 3 — validated CRUD in one line
const users = defineRepository(schemaOf<User>(), driver);
await users.create({ email: 'a@b.com' }); // validated before any SQL

Why zmdb

The whole framework is built around one guarantee: your schema is the single source of truth, and nothing can silently drift from it.

🧬

Define once, derive everything

One schema drives entity / create / update / read DTOs, validators, serializers, OpenAPI and migrations. Change a column and anything that no longer fits fails to compile.

Zero overhead by design

No proxies, no identity map, no change tracking. Reads return plain inert objects; writes are explicit. That is where the speed comes from.

🛠️

AOT validation & Ser/De

is / assert / validate / stringify compile to straight-line JavaScript at build time — no runtime parser, no reflection.

🗄️

SQL-first query builder

Typed select / insert / update / delete with real joins, aggregations and full-text search — plus typed Get / List / Search DTOs on top.

291
docs pages · 3 on the roadmap · 13 not planned
10–14×
AOT vs runtime validation
4
validation libraries measured head-to-head
13/13
ORM benchmark routes expressible
2
web frameworks benchmarked on one box

Thirty-seven published packages

Composable and ESM-only. Combine the cohesive data, app, and HTTP facade with a database vertical, or use provider-neutral AI tools, opt-in client/framework, gRPC, NATS, RabbitMQ, Redis, MCP, OpenTelemetry, or another implementation package on its own.

@zmdb/client

Dependency-free HTTP transport, deterministic request planning, cancellation, authentication, and typed errors.

@zmdb/client/react

React context, query, and mutation lifecycle bindings for generated HTTP clients.

@zmdb/client/react-native

React Native AppState, connectivity, credential-store, and offline lifecycle policy over the React client binding.

@zmdb/client/angular

Angular dependency injection, signals, Observable cancellation, and request-local generated-client ownership.

@zmdb/client/vue

Vue plugin, reactive query and mutation composables, scope cancellation, and per-application SSR isolation.

@zmdb/client/svelte

Typed Svelte context, subscription-aware stores, stale-result suppression, and lifecycle cancellation.

@zmdb/sveltekit

Request-local server/client loads, explicit credential forwarding, native errors, and navigation cancellation.

@zmdb/client/solid

Solid context, native resources, owner cancellation, stale-result suppression, and native Suspense/error propagation.

@zmdb/next

Request-scoped App Router server clients and browser bindings over @zmdb/client/react.

@zmdb/nuxt

Request-scoped Nitro transport, native hydration, and browser bindings over @zmdb/client/vue.

@zmdb/query-compiler

SELECT / INSERT / UPDATE / DELETE + dialects, joins, aggregations, FTS, set-ops, and schema-object DDL.

@zmdb/migrations

Schema snapshots, deterministic diffs and DDL plans, ledger and embedded runners, catalog introspection, and declaration emission.

@zmdb/schema-core

Schema DSL + type derivation (Entity / Create / Update / read DTOs), relations, OpenAPI, seeding, custom types.

@zmdb/ai

Provider-neutral tool documents, bounded chat orchestration, shared invocation, and OpenAPI-derived tools.

@zmdb/ai/anthropic

Opt-in Anthropic Messages API driver over the provider-neutral chat contract.

@zmdb/ai/langchain

Opt-in LangChain structured-tool fields, validation dispatch, and result serialization over @zmdb/ai.

@zmdb/ai/vercel

Opt-in Vercel AI SDK tool fields with caller-owned schema branding over @zmdb/ai.

@zmdb/mcp

Transport-neutral MCP client/server cores with authenticated identity, validation, and call budgets.

@zmdb/protobuf

Dependency-free protobuf calls, descriptors, generated-code wire ABI, and typed gRPC artifacts.

@zmdb/aot-validator

Compiler-free is / assert / validate / equals / random, unions, transforms, JSON Ser/De, errors, and generated-code runtime helpers.

@zmdb/compiler

The single TypeScript front end for reflection, AOT emission, project compilation, unplugin and Metro adapters, lint rules, and project config.

@zmdb/repository

Auto-validating CRUD, transactions, populate, read-replicas, lifecycle events, framework adapters.

@zmdb/mssql

Complete SQL Server compilation, migrations, structural execution, introspection, refusals, and packed live acceptance.

@zmdb/postgres

Complete PostgreSQL dialect, migrations, catalog introspection, structural pg driver, cursors, and cancellation.

@zmdb/sqlite

Complete SQLite dialect, migrations, introspection, embedded runner, and structural node:sqlite driver.

@zmdb/mysql

Complete MySQL dialect, migrations, introspection, structural mysql2 driver, and packed real-server acceptance.

@zmdb/app

Protocol-neutral metadata, dependency injection, modules, lifecycle, commands, events, CQRS, state, and observability ports.

@zmdb/jobs

Typed queues, workers, dead letters, scheduling, leases, and the built-in SQLite memory backend.

@zmdb/jobs-postgres

PostgreSQL job storage over caller-owned pools and clients.

@zmdb/app/otel

OpenTelemetry API adaptation over caller-owned tracers and meters, with no SDK, exporter, or ambient global context.

@zmdb/transport/grpc

Typed grpc-js servers and clients over generated protobuf artifacts, with streaming, deadlines, metadata, and bounded shutdown.

@zmdb/transport/nats

Core NATS wildcard and queue-group messaging over the public application transport strategy contract.

@zmdb/transport/rabbitmq

RabbitMQ topic transport with positive prefetch, confirmed delayed retries, and owned dead-letter topology.

@zmdb/transport/redis

Lossy Redis Pub/Sub messaging with concrete-channel dispatch and correlated request/reply.

@zmdb/web

HTTP controllers, routing, request pipelines, OpenAPI, gateways, testing, and runtime adapters over @zmdb/app.

@zmdb/core

The cohesive application facade: a lazy root plus focused schema, SQL, validator, ORM, web, compiler, migrations, and testing entries. It contains no implementation logic and does not re-export opt-in integrations.

Start here

Four pages get you from nothing to a validated, typed, queried table.

1

Quick Start

Install, define a schema, run your first validated query.

2

Schema Declaration

The one definition everything else is derived from.

3

CRUD

Create, read, update, delete — validated before any SQL is sent.

4

AOT Setup (transformer)

Wire the transformer so validation compiles to straight-line code.

291 pages of documentation

The union of the MikroORM, Drizzle, Typia and NestJS doc surfaces. Every capability page is written in full; the ones that are anti-patterns for a zero-overhead, no-proxy, AOT layer are excluded and explained rather than quietly missing. Press ⌘K to search all of it.

Validation and contracts 22

is() · assert() · validate() · Special Tags · Shallow Validation · +17 more

MPL-2.0 · Node 26+ · TypeScript 7 · ESM-only · github.com/ambasta/zmdb