DomainLang for VS Code
A Domain-Driven Design modeling language with first-class VS Code support. Define domains, bounded contexts, context maps, and team ownership in a concise, readable syntax.
Features
- Syntax highlighting for
.dlang files
- IntelliSense with auto-completion for keywords, references, and patterns
- Go to definition and Find references for domains, contexts, and teams
- Hover documentation showing element details
- Real-time validation with helpful error messages
- Code formatting to keep models consistent
Quick start
- Install the extension from the VS Code Marketplace
- Create a file with the
.dlang extension
- Start modeling your domain:
Domain Bookstore {
description: "Online bookstore platform"
vision: "Make books easy to discover and buy"
}
Team CatalogTeam
Team OrderTeam
Classification CoreDomain
BoundedContext Catalog for Bookstore as CoreDomain by CatalogTeam {
description: "Product catalog and inventory"
terminology {
term Book: "A product available for purchase"
term ISBN: "International Standard Book Number"
}
}
BoundedContext Orders for Bookstore as CoreDomain by OrderTeam {
description: "Order lifecycle and fulfillment"
}
ContextMap BookstoreIntegration {
contains Catalog, Orders
Catalog -> Orders
}
Language highlights
Domains and subdomains
Domain Enterprise { description: "Company-wide" }
Domain Sales in Enterprise {
description: "Revenue generation"
vision: "Make buying easy"
}
Bounded contexts with ownership
BoundedContext Checkout for Sales as CoreDomain by PaymentsTeam {
description: "Checkout and payment orchestration"
}
Context maps and relationships
ContextMap Integration {
contains Orders, Payments, Shipping
[OHS] Orders -> [ACL] Payments
Orders -> Shipping
[SK] Payments <-> Billing : SharedKernel
}
Supported DDD patterns: OHS (Open Host Service), ACL (Anti-Corruption Layer), CF (Conformist), PL (Published Language), SK (Shared Kernel), P (Partnership).
Terminology (ubiquitous language)
BoundedContext Orders for Sales {
terminology {
term Order: "A customer's request to purchase items"
aka: PurchaseOrder
examples: "Order [#12345](https://github.com/DomainLang/DomainLang/issues/12345)"
term OrderLine: "A single line item within an order"
}
}
Decisions and policies
BoundedContext Orders for Sales {
decisions {
decision EventSourcing: "Capture every state change"
policy Refunds: "Allow refunds within 30 days"
rule MinOrder: "Minimum order value is $10"
}
}
Namespaces and imports
import "./shared-definitions.dlang"
namespace Acme.Sales {
bc Checkout for Sales { }
}
Documentation
Requirements
Extension settings
This extension contributes the following settings:
- Language support for
.dlang files
Known issues
Report issues at GitHub Issues.
Contributing
Contributions are welcome! See the repository for development setup.
License
Apache License 2.0 - See LICENSE for details.