Introduction
What jit is, why it compiles your schemas, and how the two execution modes work.
jit is a schema-first data engine for TypeScript. Describe a data shape once, and jit compiles specialized JavaScript for every operation over it: validation, equality, cloning, diffing, hashing, immutable updates, in-memory queries, DTO mapping, PII masking, XSS sanitizing, JSON serialization, a versioned binary codec, binary rowsets for massive flat-object batches, keyed collection change tracking, and progressive streaming validation.
Why compiled?
Generic libraries interpret your schema on every call — walk the tree, branch on types, allocate intermediates. jit walks the schema once, at compile time, and emits the exact monomorphic code a performance engineer would write by hand:
- static property access only — never
for...in/Object.keyson known shapes; - checks ordered cheapest-first:
typeof→ null → numeric → length → regex; - classic indexed loops, no closures, early returns;
- runtime values (regexes, refinement callbacks, query arguments) travel as external bindings — never interpolated into source.
Two execution modes, same generated code
JIT (runtime) — operations compile on first use via globalThis.Function and are
cached per schema. Ideal for dynamic schemas and long-lived processes.
AOT (build time, Prisma-style) — pnpm jit init writes config and jit generate
emits pure .mjs + .cjs + .d.ts modules with zero imports: the engine never ships
to production, and the final bundle keeps only the generated functions your app imports.
AOT output runs under strict CSP, edge runtimes and other locked-down environments.
Where to go next
- Quick start — install jit and compile your first schema.
- Compilation model — understand runtime JIT and AOT.
- Watched lists — compile snapshot diffs or track aggregate children.
- Lazy execution — iterators, async sources and visitors.
- Binary rowsets — compact million-row analytical scans.
- Generation and tree shaking — ship only generated code.
- Complete operator reference — schemas, strings, numbers, objects, queries and compilers.
- Choosing an execution mode — runtime JIT, AOT, eager, lazy, visitor or binary.
- Library comparison — architectural tradeoffs with Zod, Valibot, TypeBox and Typia.