A guided track through @sotajs/ddd. Each part builds on the previous one. Read in order if you’re new to the library — or jump to what you need.

Core workflow

  1. Creating Entities — Zod schema → rich domain entity
  2. Reading and Mutating State — props, auto-setters, identity
  3. Actions — business logic with validation and guard clauses
  4. Computed Properties — derived values from entity state

Domain integrity

  1. Invariants — cross-field consistency rules
  2. Value Objects — structural equality for values without identity
  3. Branded IDs — compile-time safety for entity identifiers

End-to-end

  1. Building Aggregates — transactional boundaries, nested entities, events
  2. Testing — unit-test domain logic without mocks

Other sections

  • Core Concepts — all four building blocks side by side (coming soon)
  • How It Works — internals: freeze, auto-setters, invariants mechanism
  • Style Guide — rules with priorities: Essential / Recommended / Suggested
  • API Reference — full config reference for every function
  • ORM Integration — Prisma, Drizzle, Knex
  • FAQ — answers structured by topic