Decorix describes TypeScript business models once and adapts the same neutral metadata to validation, forms, framework, and documentation targets.
Read the full usage guide in docs/ for a getting-started walkthrough, core concepts, validation guide, adapter decision table, CLI usage, and JSON Schema import/export. This README stays a quick overview. Version française : docs/fr/.
Install only the packages required by your target surface:
-
@hermiforge-decorix/coreprovides decorators, the builder API, model metadata, and the generic validator registry. -
@hermiforge-decorix/cliprovides thedecorixcommand-line tool for generating JSON Schema, Zod, and framework re-export artifacts (one command per adapter) from Decorix models. -
@hermiforge-decorix/zodconverts metadata to Zod schemas and can register a Zod validator adapter. -
@hermiforge-decorix/json-schemaconverts metadata to JSON Schema draft 2020-12. -
@hermiforge-decorix/angular-signalexposestoSignalFormfor Angular Signal Forms-oriented facades. -
@hermiforge-decorix/angular-reactiveexposestoReactiveFormConfigfor Angular Reactive Forms-oriented configuration. -
@hermiforge-decorix/react-hook-formexposestoReactHookFormanduseReactHookDecorix. -
@hermiforge-decorix/react-tanstack-formexposestoTanStackFormanduseTanStackDecorix. -
@hermiforge-decorix/vue-vee-validateexposestoVeeValidateanduseVeeDecorix. -
@hermiforge-decorix/vue-formkitexposestoFormKitanduseFormKitDecorix. -
@hermiforge-decorix/svelte-felteexposestoFelteFormanduseFelteDecorixfor Svelte/SvelteKit via Felte. -
@hermiforge-decorix/svelte-superformsexposescreateSuperformsValidatorAdapterfor SvelteKit via Superforms. -
@hermiforge-decorix/solid-felteexposestoFelteFormanduseFelteDecorixfor SolidJS via Felte. -
@hermiforge-decorix/solid-modular-formsexposestoModularFormanduseModularFormDecorixfor SolidJS via Modular Forms. -
@hermiforge-decorix/nestexposes a Nest-compatible validation pipe.
The former aggregate packages @hermiforge-decorix/angular, @hermiforge-decorix/react, and @hermiforge-decorix/vue are intentionally not used. Choose the one adapter package matching your framework library so peer dependencies stay narrow.
import {Email, Label, MaxLength, Min, MinLength, Model, Required} from '@hermiforge-decorix/core';
@Model('RegisterUserDto')
class RegisterUserDto {
@Required('Name is required')
@MinLength(2, 'Name is too short')
@MaxLength(50)
@Label('Name')
name!: string;
@Required('Email is required')
@Email('Invalid email')
@Label('Email')
email!: string;
@Min(18, 'You must be an adult')
age?: number;
}import {model, numberField, stringField} from '@hermiforge-decorix/core';
const RegisterUserDto = model('RegisterUserDto', {
name: stringField().required('Name is required').minLength(2, 'Name is too short').maxLength(50).label('Name'),
email: stringField().required('Email is required').email('Invalid email').label('Email'),
age: numberField().min(18, 'You must be an adult').optional()
});React Hook Form, TanStack Form, VeeValidate, FormKit, Felte (Svelte and SolidJS), Modular Forms, and Nest accept an optional options.validator shaped as the neutral ValidatorAdapter contract from @hermiforge-decorix/core. You don't need to install or wire up anything: when options.validator is omitted, these adapters fall back to the core validator facade, which fully implements native/custom/cross-field/async constraints on its own.
import {toReactHookForm} from '@hermiforge-decorix/react-hook-form';
const config = toReactHookForm(RegisterUserDto);Pass an explicit adapter only when you want a different underlying engine (typically Zod, to share one validation library across your codebase):
import {createZodValidatorAdapter} from '@hermiforge-decorix/zod';
import {toReactHookForm} from '@hermiforge-decorix/react-hook-form';
const validator = createZodValidatorAdapter();
const config = toReactHookForm(RegisterUserDto, {validator});registerZodValidator() sets Zod as the global default adapter, but the adapters above don't consult that global default when options.validator is omitted — always pass {validator} explicitly to use a non-default engine. Angular Reactive Forms builds a core-backed schema automatically only when cross-field/object or async constraints are present. Angular Signal Forms never uses a ValidatorAdapter at all — its options type has no validator field; constraints map directly onto Angular's own native validators. See docs/core-concepts.md for the full picture.
Decorix is a pure validator: it checks whether a value satisfies a constraint and reports issues, but it never mutates or coerces the input (no automatic trimming, no string→number coercion, no date parsing). If you need that, pre-process the value yourself (or through your form library) before it reaches Decorix — a Decorix model always validates exactly the value it is given.
The docs/ directory is a narrative usage guide: getting started, core concepts, the validation guide (native/custom/cross-field/async constraints), choosing a form adapter, the decorix CLI, JSON Schema export/import, and troubleshooting. It reads directly on GitHub — no build step. A dedicated documentation site is planned for later. A French mirror lives in docs/fr/.
Each published package has a short package-level README in packages/core/README.md, packages/cli/README.md, and packages/adapters/*/README.md with installation, peer dependencies, and direct usage examples. docs/ links out to these rather than duplicating their content.
CHANGELOG.md aggregates every release across all @hermiforge-decorix/* packages in one place (they're versioned together as a single group). Each package also keeps its own CHANGELOG.md scoped to just that package, if you only care about one.
Every package has minimal typechecked examples in examples/<package>/class-model.ts and examples/<package>/builder-model.ts. They demonstrate generated configuration and validation without requiring a full Angular, React, or Vue application.
Run:
pnpm examples:typecheckSee CONTRIBUTING.md for the local setup, quality gate, and changeset workflow. Security issues should be reported per SECURITY.md rather than as a public issue.
Decorix is licensed under the GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later). This copyleft applies to Decorix itself and to modifications distributed as part of it; applications that merely depend on @hermiforge-decorix/* packages through their published interfaces are not required to adopt the same license (see LICENSE, sections 0-6, and the incorporated GNU GPL v3 for the exact terms).