Skip to content

A visual and textual toolkit for Domain-Driven Design powered by category theory. Build precise domain models with drag-and-drop for domain experts or a DSL for developers. Validates aggregates, context maps, and business rules. Generates code.

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

ibrahimcesar/SketchDDD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

SketchDDD

Build Domain Models Visually or with Code

Crates.io License CI

Website β€’ Documentation β€’ Visual Builder


What is SketchDDD?

SketchDDD bridges the gap between domain experts and developers by providing two ways to build the same precise domain model:

πŸ‘©β€πŸ’Ό Domain Experts πŸ‘¨β€πŸ’» Developers
Visual drag-and-drop builder Text-based DSL
Guided wizards Full expressiveness
Templates to start fast Version control friendly
Plain English rules CI/CD integration

Both interfaces produce the same model, validated by category theory to ensure precision.


Quick Start

Visual Builder

Visit app.sketchddd.dev and start building.

CLI

# Install
cargo install sketchddd

# Create a new project
sketchddd init my-domain

# Validate your model
sketchddd check my-domain.sddd

# Generate code
sketchddd codegen my-domain.sddd --target rust

# Start visual builder locally
sketchddd serve

File Extension: SketchDDD uses .sddd files - short for SketchDDD. See examples/ for sample models.


Example

context Commerce {
  
  objects { Customer, Order, LineItem, Product, Money }
  
  morphisms {
    placedBy: Order -> Customer
    items: Order -> List<LineItem>
    product: LineItem -> Product
    price: LineItem -> Money
  }
  
  aggregate Order {
    root: Order
    contains: [LineItem]
    invariant: totalPrice = sum(items.price)
  }
  
  value Money {
    amount: Decimal
    currency: Currency
  }
}

Features

  • 🎨 Visual Builder - Drag-and-drop for non-technical users
  • πŸ“ Text DSL - Full control for developers
  • βœ… Validation - Catch errors before runtime
  • πŸ”— Context Maps - Model system integration
  • 🏭 Code Generation - Rust, TypeScript, Kotlin, Python, Java, Clojure
  • πŸ“Š Diagrams - Auto-generated visualizations
  • πŸ“š Templates - Start with common patterns

Editor Support

First-class editor support for .sddd files:

Editor Status Features
VS Code βœ… Available Syntax highlighting, snippets, bracket matching
Sublime Text βœ… Available Syntax highlighting
Vim/Neovim βœ… Available Syntax highlighting, indentation
Any LSP Client βœ… Available Full LSP support

Language Server Protocol (LSP)

The sketchddd-lsp binary provides:

  • Real-time diagnostics and error reporting
  • Auto-completion for keywords, types, and morphisms
  • Go to definition and find references
  • Hover documentation
  • Document symbols and outline
  • Code formatting
# Install LSP server
cargo install sketchddd-lsp

# For Neovim (add to your config)
# lua: require('lspconfig').sketchddd.setup{}

See editors/ for installation instructions


Documentation


Why Category Theory?

DDD concepts like "aggregate" and "bounded context" are often vague. SketchDDD uses category theory to give them precise mathematical definitions:

DDD Concept Mathematical Definition
Bounded Context Sketch (graph + equations + limits)
Aggregate Limit cone with root
Value Object Limit with structural equality
Context Map Sketch morphism

This precision enables automated validation and code generation that actually works.


Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Open Discussions

We're building this in the open! Join the conversation:


License

Licensed under either of:

at your option.

About

A visual and textual toolkit for Domain-Driven Design powered by category theory. Build precise domain models with drag-and-drop for domain experts or a DSL for developers. Validates aggregates, context maps, and business rules. Generates code.

Topics

Resources

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Contributors 2

  •  
  •