The contract
Copy page
The client does not import server Drizzle schema by default. Types come from a generated artifact — REQ-12.
Endpoint
Section titled “Endpoint”GET /nizhal/contractReturns OpenAPI/JSON-Schema derived from:
schema— entity row shapes + per-table merge policymutators— Zod input schemas per mutator namesyncRules— collection/sync-rule names
ORM-agnostic by construction — the server’s Drizzle types never cross the wire.
Server emission
Section titled “Server emission”import { emitNizhalContract } from "@nizhal/kernel";
const contract = emitNizhalContract({ schema, mutators, syncRules });createNizhalServer serves this at runtime from the same inputs passed to the server config.
Client consumption (planned)
Section titled “Client consumption (planned)”nizhal gen --url https://api.example.com/nizhal/contract -o src/nizhal.gen.tsGenerated file provides Row types and Mutators input types for nizhalCollectionOptions and createNizhalMutators.
Monorepo fast path (opt-in)
Section titled “Monorepo fast path (opt-in)”Type-import from a shared package is possible in monorepos but couples client to server ORM — not the default integration path.
Why it matters
Section titled “Why it matters”- Independent client deploys
- Language-agnostic consumers
- No accidental import of server-only invariants into UI bundles
See API reference for emitNizhalContract and endpoint list.