Modeller
ArchitectureLegacy Design Drafts

Domain Definition Language

Domain Definition Language

Status: Implemented

This specification describes the domain definition language for Modeller. We chose a custom DSL parsed with Pidgin parser combinators, rather than YAML (see Format Options for the rationale).

This specification defines a domain definition format designed for:

  1. Business readability - Definitions read like documentation that business stakeholders can review
  2. Technology agnostic - Describes what the business does, not how systems implement it
  3. AI agent friendly - Structured for AI understanding and generation
  4. Code generation ready - Translatable to multiple output formats

Core Principles

Separation of Concerns

ConcernBelongs InDoes NOT Belong In
Domain ModelEntity/Value Object definitionsDatabase IDs, technical keys
PersistenceSeparate storage definitionsDomain definitions
InterfacesCommand/Query definitionsEntity internals
Business RulesRules engine (future)Scattered in definitions

Domain Building Blocks

┌─────────────────────────────────────────────────────────────┐
│                         SERVICE                              │
│  (Bounded Context)                                          │
│                                                             │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐ │
│  │  ENTITIES   │  │   VALUE     │  │    REFERENCE        │ │
│  │             │  │   OBJECTS   │  │    DATA             │ │
│  │ - Identity  │  │ - No ID     │  │ - External          │ │
│  │ - Lifecycle │  │ - Immutable │  │ - Read-only         │ │
│  │ - Mutable   │  │ - Equality  │  │ - Not owned         │ │
│  └─────────────┘  └─────────────┘  └─────────────────────┘ │
│                                                             │
│  ┌─────────────────────────┐  ┌───────────────────────────┐│
│  │       COMMANDS          │  │         QUERIES           ││
│  │ (Business Actions)      │  │ (Business Questions)      ││
│  │ - Change things         │  │ - Retrieve information    ││
│  │ - Notify when done      │  │ - No changes made         ││
│  └─────────────────────────┘  └───────────────────────────┘│
└─────────────────────────────────────────────────────────────┘

Implementation

The DSL is implemented with:

ComponentTechnologyLocation
ParserPidgin parser combinatorssrc/Modeller.Parser/
Domain ModelsImmutable C# records with factory validationsrc/Modeller.Domain/
VS Code ExtensionTextMate grammar + custom iconseditors/vscode-modeller/
Sample DomainFull example definitionssamples/modeller/

Documents

DocumentDescription
OverviewPhilosophy and design goals
Domain ConceptsEntities, Value Objects, Shared Data
BehavioursCommands, Queries, Workflows, and Events
File StructureProject organization
ExamplesConcrete definition examples
AI IntegrationHow AI agents consume and generate definitions
Data TypesType system reference
GlossaryKey terms and definitions
Format OptionsWhy we chose custom DSL over YAML
TemplatesCode generation templates and engines
Implementation StatusCurrent build status and next steps

Design Goals

  1. Business-first - Technical concerns (storage, interfaces) are separate
  2. Natural language - Reads like English, understandable by non-technical stakeholders
  3. AI-friendly - Clear semantics for AI understanding and generation
  4. Version-aware - Support for evolution over time
  5. Composable - Services can reference other services' data

On this page