Installation
Install only the packages required by the boundary you are modeling.
If you use an adapter package, it already depends on @xndrjs/domain and re-exports the domain APIs for convenient single-entry imports.
Domain core
Section titled “Domain core”Use the core package when you want to provide your own validators or use the built-in compose helpers.
pnpm add @xndrjs/domainimport { compose, domain, pipe } from "@xndrjs/domain";Use this when your project already uses Zod or you want parser-style transforms at the boundary.
pnpm add @xndrjs/domain-zod zodimport { domain, zodFromKit, zodToValidator } from "@xndrjs/domain-zod";Valibot
Section titled “Valibot”Use this when your project prefers Valibot’s function-first schema style.
pnpm add @xndrjs/domain-valibot valibotimport { domain, valibotFromKit, valibotToValidator } from "@xndrjs/domain-valibot";AJV, JSON Schema, and OpenAPI
Section titled “AJV, JSON Schema, and OpenAPI”Use this when contracts already exist as JSON Schema or OpenAPI components.
pnpm add @xndrjs/domain-ajv ajv ajv-formatsimport { domain, jsonSchemaToValidator, openApiComponentToValidator } from "@xndrjs/domain-ajv";Infrastructure packages
Section titled “Infrastructure packages”These packages are optional and solve problems outside the domain modeling core:
pnpm add @xndrjs/tasksSee Tasks for how @xndrjs/tasks fits alongside the rest of xndrjs.
Runtime and TypeScript
Section titled “Runtime and TypeScript”All public packages are TypeScript-first and include type definitions. Packages target Node.js 18+.
For new domain work, use @xndrjs/domain plus one adapter.