Skip to content

QuickModelThe Complete TypeScript Modeling Kit

30+ type transformers, two-layer validation, mocks, 7 schema formats, and a built-in MCP server for AI — all driven by a single `@Quick` decorator.

Angular
React
Vue.js
Svelte
NestJS
Electron
GraphQL
Prisma
Redux
Vitest
Angular
React
Vue.js
Svelte
NestJS
Electron
GraphQL
Prisma
Redux
Vitest
tRPC
TanStack
OpenAPI
React Hook Form
Zod
TypeScript
Mo
Mongoose
Ty
TypeORM
MS
MSW
Fo
Formik
Zu
Zustand
Bun
Jest
tRPC
TanStack
OpenAPI
React Hook Form
Zod
TypeScript
Mo
Mongoose
Ty
TypeORM
MS
MSW
Fo
Formik
Zu
Zustand
Bun
Jest

💡 Why QuickModel? ​

QuickModel is more than a serialization library — it is a complete development platform for data-intensive TypeScript applications.

🔄 Type Transformation

  • 30+ Transformers: Date, BigInt, Set, Map, RegExp, Symbol, Error, WeakMap, WeakSet, ArrayBuffer, TypedArray, URL… Each type has its own specialized transformer.
  • Multi-dimensional arrays: explicit syntax [Date], [[Post]], [[[Map]]] for 1D, 2D or 3D.
  • WeakMap / WeakSet: in-memory caches that are never serialized. Perfect for GC-friendly runtime references.
  • Dot notation: transform nested properties directly in the parent decorator, without decorating external classes.

🧠 Decorator System

  • @Quick: class-level decorator that configures all transformers at once.
  • @QType: property-level decorator for specific cases or different contexts.
  • @QAlias: renames fields between incoming JSON and the instance. Perfect for snake_case ↔ camelCase.
  • @QComputed: defines getters that appear in serialize() without existing in the original JSON.
  • excludeFields: permanently excludes fields from all serialization (password, _checksum, etc.).

✅ Two-Layer Validation

  • Layer 1 — Integrity: checkIntegrity() verifies each value matches its transformer (invalid dates, BigInt out of range, dangerous RegExp).
  • Layer 2 — Business: @QRule applies declarative predicates per field. checkRules() returns errors with field and message.
  • Combined: isValid() runs both layers in a single call. validationReport() separates errors by origin.

📋 Forms & Group Validation

  • Works on any class: @QField, @QRule and @QGroup don't require extending QModel. Useful for DTOs, Angular/Vue/React forms…
  • Groups as wizard steps: qCheckRulesByGroup() validates only the active group, perfect for multi-step forms.
  • Async rules: qCheckRulesAsync() supports predicates returning Promise<boolean> with timeoutMs and serial/parallel mode.

🗂️ 7 Schema Formats

A single getSchema(format) call exports your model as:
json · zod · openapi · mongo · typescript · graphql · ajv

Documentation, validation, and API contracts always in sync with your code.

🤖 MCP Server — AI Integration

QuickModel includes 20 tools and 20 guided prompts: create_model, interface_to_model, get_model_schema, generate_mock, simulate_validation, diff_models, roundtrip…

  • For beginners: your AI knows exactly how to write valid QuickModel code because the library tells it.
  • For pros: generate models from JSON in milliseconds and validate architecture without context switching.

🧪 Zero-Boilerplate Mocks

  • User.mock().random() → valid, typed object with realistic data.
  • User.mock().array(5) → array of 5 instances.
  • User.mock().random({ name: 'Alice' }) → object with overridden fields.
  • Powered by @faker-js/faker. Perfect for building UI before the API exists.

🧩 Automatic Polymorphism

APIs return different shapes in the same list (Payment → Card or PayPal). QuickModel instantiates the correct subclass automatically from the data shape. No switch, no factories.

🔒 Security & Protection

  • Circular references: serialization doesn't crash — circular fields are replaced with { __circular: true } in the output.
  • Injection: validates URLs (blocks javascript:) and limits RegExp length.
  • Prototype pollution: __proto__ properties automatically excluded.
  • Strict mode: unknownPropertyPolicy: 'error' throws on unexpected properties in public APIs.

🔗 Compatibility

  • Mixin QModel.extends(BaseClass): adds superpowers to TypeORM entities, NestJS DTOs, or any class without touching the hierarchy.
  • TC39 + Legacy: compatible with experimentalDecorators (TS 3.4+) and TC39 standard (TS 5+).
  • Three property styles: declare, ! and ? all work identically.

🎯 Feature Comparison

QuickModel vs other libraries with similar features

🎯 Features offered by each library

⚠️ = available with extra manual code

Type:
Libraries:
Features:
FeatureQuickModelarktypeclass-transformerclass-validatorfaker (manual)ImmerjoisuperjsonTypeBoxvalibotvestyupZodPlain JS
Async business rules (@QRule)✅❌❌ ⚠️ ❌❌ ⚠️ ❌❌❌ ⚠️ ⚠️ ⚠️ ❌
Auto coercion✅❌ ⚠️ ❌❌❌❌❌❌ ⚠️ ❌❌ ⚠️ ❌
Built-in AI / MCP Server✅❌❌❌❌❌❌❌❌❌❌❌❌❌
Compile-time TS inference✅✅❌❌❌ ⚠️ ❌❌✅✅❌❌✅❌
Computed fields (@QComputed)✅❌❌❌❌❌❌❌❌❌❌❌❌❌
copy() / isDirty()✅❌❌❌❌ ⚠️ ❌❌❌❌❌❌❌❌
Decorator constraints (@IsEmail…)✅❌❌✅❌❌❌❌❌❌❌❌❌❌
Form schemas (@QField)✅❌❌❌❌❌❌❌❌❌ ⚠️ ❌❌❌
Multi-level inheritance inference✅❌ ⚠️ ❌❌❌❌❌❌❌❌❌❌❌
Native serialization (toJSON)✅❌ ⚠️ ❌❌❌❌✅❌❌❌❌❌❌
Polymorphic JSON✅❌ ⚠️ ❌❌❌❌ ⚠️ ❌❌❌❌❌❌
Preserves RegExp/undefined/NaN✅❌❌❌❌❌❌✅❌❌❌❌❌❌
Runtime integrity✅✅❌ ⚠️ ❌❌ ⚠️ ❌✅ ⚠️ ⚠️ ⚠️ ✅❌
Schema export (JSON/Zod/OpenAPI)✅❌❌❌❌❌❌❌✅❌❌❌❌❌
Tree-shakeable✅✅❌❌✅✅❌❌ ⚠️ ✅❌❌❌❌
Typed mock generation✅❌❌❌❌❌❌❌❌❌❌❌❌❌
Validation groups / suites✅❌❌ ⚠️ ❌❌❌❌❌❌✅❌❌❌

Quick Examples ​

🏗️ Type coercion with @Quick and QModel

A single decorator transforms JSON strings into BigInt, Date, Map and more

import { QModel, Quick } from 'quickmodel';

interface IUser {
  name: string;
  balance: bigint;
  lastLogin: Date;
  roles: Set;
}

@Quick({
  balance: 'bigint',  // primitive alias
  lastLogin: Date,    // native constructor
  roles: Set,         // complex collection
})
class User extends QModel {
  declare name: string;
  declare balance: bigint;
  declare lastLogin: Date;
  declare roles: Set;
}

const user = new User({
  name: 'Alice',
  balance: '500000000000000000',      // string → BigInt auto-coerced
  lastLogin: '2024-03-15T10:00:00Z',  // string → Date auto-coerced
  roles: ['admin', 'editor'],          // array  → Set  auto-coerced
});

console.log(user.balance + 1n);            // 500000000000000001n
console.log(user.lastLogin.getFullYear()); // 2024
console.log(user.roles.has('admin'));      // true