What if your team never had to ask "which version is right?" again?
The Hidden Cost You're Already Paying
Every enterprise faces the same invisible tax:
π΄ The Documentation Drift Problem Your team spends weeks documenting business requirements. Then someone codes them in Python. Then someone else needs the same logic in TypeScript. Six months later, three different "source of truth" documents existβand none of them match production.
π΄ The Translation Telephone Game
Business requirement β Technical spec β Backend code β Frontend code β Reality
At each handoff, fidelity is lost. At the end, you're left wondering: "Is what we built actually what we agreed to?"
π΄ The Compliance Nightmare
Auditors ask: "Show me where this rule is enforced."
You scramble across Confluence pages, Jira tickets, Python services, and TypeScript frontendsβhoping you didn't miss anything.
DomainForge makes your business logic portable, provable, and permanent.
Write your rules in plain language. Run them identically in Python, TypeScript, Rust, or your browser. Change them in one placeβwatch the change cascade everywhere, automatically.
| What You Get | Why It Matters |
|---|---|
| One model, every language | Python validation = TypeScript validation. Period. No drift. |
| Instant rule checking | 10,000 entities validated in under 100 milliseconds |
| Business-readable, machine-executable | Your analysts can read the rules. Your systems enforce them. |
| Architecture-as-Code | Export directly to FINOS CALM for enterprise governance |
| Formal mathematical rigor | Not just documentationβprovable correctness |
from sea import Model
# Define WHO does the work
assembly_line = model.entity("Assembly Line A")
warehouse = model.entity("Warehouse")
# Define WHAT moves between them
camera = model.resource("Camera", unit="units")
# Define HOW much moves
production = model.flow(
name="Daily Production",
resource=camera,
from_entity=assembly_line,
to_entity=warehouse,
quantity=1000
)
# Define the RULES that must always be true
model.policy(
"Minimum Production Threshold",
expression="forall f in Flow where f.resource = Camera: f.quantity >= 500",
severity="error"
)
# Validate everythingβinstantly
results = model.validate()
print(f"β
Model valid: {results.is_valid}")That's it. You just created a formal, executable business rule that:
- Validates production quantities instantly
- Works identically in Python, TypeScript, Rust, or the browser
- Exports to FINOS CALM for architecture governance
- Becomes the single source of truth everyone can trust
# Python
pip install sea-dsl
# TypeScript / Node.js
npm install @domainforge/sea
# Rust
cargo add sea-core
# Verify it works
python -c "import sea_dsl; print('β
Ready:', sea_dsl.__version__)"π‘ Pre-built packages for PyPI, npm, and Crates.io. No compilation required.
|
"I can finally model our processes without waiting for developers."
|
"Single source of truth for the entire business architecture."
|
|
"Type-safe domain models that work across our whole stack."
|
"Regulations become executable, auditable policies."
|
DomainForge models any business domain using just six universal concepts:
| Concept | What It Represents | Example |
|---|---|---|
| π’ Entity | Actors and locations in your system | Assembly Line, Customer, Warehouse |
| π¦ Resource | Things of value that move | Products, Money, Information |
| π Flow | Movement between entities | Shipments, Payments, Work Orders |
| π Instance | Specific, trackable items | Camera #SN12345, Invoice #INV-2024 |
| οΏ½ Pattern | Reusable validation patterns | Email format, SKU codes |
| οΏ½π Policy | Business rules and constraints | "All shipments must be inspected" |
That's the entire vocabulary. No magic syntax to learn. No framework lock-in.
Write models directly in .sea filesβhuman-readable, version-controllable, and parseable by all bindings.
// Define entities (who/where)
Entity "Warehouse" in logistics
Entity "Factory" in manufacturing
// Define resources (what moves)
Resource "Camera" units in inventory
// Define flows (how things move)
Flow "Camera" from "Warehouse" to "Factory" quantity 100
// Define validation patterns
Pattern "SKU" matches "^[A-Z]{3}-[0-9]{4}$"
// Define business rules
Policy min_shipment as: quantity >= 10
// Versioned entities with evolution tracking
Entity "Vendor" v2.0.0
@replaces "Supplier" v1.0.0
@changes ["renamed", "added_fields"]
// Roles and relations
Role "Approver" in governance
Relation "Payment"
subject: "Buyer"
predicate: "pays"
object: "Seller"
via: flow "Money"
// Typed instances
Instance acme_corp of "Vendor" {
name: "Acme Corporation",
credit_limit: 50000 "USD"
}
// Quantified policy expressions
Policy all_shipments_inspected as:
forall s in flows: (s.inspected = true)
| Declaration | Syntax |
|---|---|
| Entity | Entity "Name" [vX.Y.Z] [in domain] |
| Resource | Resource "Name" [unit] [in domain] |
| Flow | Flow "Resource" from "A" to "B" [quantity N] |
| Pattern | Pattern "Name" matches "regex" |
| Role | Role "Name" [in domain] |
| Relation | Relation "Name" subject: ... predicate: ... object: ... |
| Instance | Instance id of "Entity" { field: value } |
| Policy | Policy name as: expression |
| Dimension | Dimension "Name" |
| Unit | Unit "Name" of "Dimension" factor N base "Base" |
| Metric | Metric "Name" as: expression |
| Mapping | Mapping "Name" for format { ... } |
| Projection | Projection "Name" for format { ... } |
| ConceptChange | ConceptChange "Name" @from_version ... @to_version ... |
π Manufacturing: Assembly Line Control (click to expand)
model = Model("electronics-manufacturing")
# Define the supply chain
supplier = model.entity("Component Supplier")
assembly = model.entity("Assembly Line A")
quality_control = model.entity("QC Department")
finished_goods = model.entity("Finished Goods Warehouse")
# Define what's being built
pcb_board = model.resource("PCB Board", unit="pieces")
camera_module = model.resource("Camera Module", unit="units")
# Define the flow of components
component_delivery = model.flow(
resource=pcb_board,
from_entity=supplier,
to_entity=assembly,
quantity=500
)
# Enforce Just-in-Time inventory limits
model.policy(
"JIT Inventory Control",
expression="""
forall e in Entity where e.type = 'Assembly':
sum(Instance.quantity where Instance.at = e) <= 1000
""",
severity="warn"
)Result: Inventory violations caught before they cause production delays.
π° Finance: Payment Fraud Detection (click to expand)
const model = new Model("payment-system");
const customer = model.entity("Customer Account");
const merchant = model.entity("Merchant Account");
const gateway = model.entity("Payment Gateway");
const money = model.resource("USD", { unit: "dollars" });
// Detect unusual spending patterns
model.policy({
name: "Unusual Activity Detection",
expression: `
forall c in Entity where c.type = 'Customer':
sum(Flow.quantity where Flow.from = c and Flow.timestamp > now() - 1hour) <= 10000
`,
severity: "error",
});Result: Suspicious transactions flagged automaticallyβbefore they clear.
π Logistics: Cross-Border Compliance (click to expand)
model = Model("global-supply-chain")
# Multi-location warehouses
warehouse_us = model.entity("US Distribution Center", location="USA")
warehouse_eu = model.entity("EU Distribution Center", location="Germany")
retail_store = model.entity("Retail Store", location="France")
product = model.resource("Widget", unit="boxes")
# Ensure customs documentation for international shipments
model.policy(
"Customs Documentation Required",
expression="""
forall f in Flow where f.from.location != f.to.location:
f.attributes.customs_cleared = true
""",
severity="error"
)Result: Cross-border shipments without proper documentation are blocked automatically.
β‘ Performance Characteristics
- 10,000 entities validated in < 100ms
- Rust core for maximum performance
- FFI overhead < 1ms per operation
- Streaming validation for large models
π Language Bindings
Python (PyO3):
import sea_dsl
d = sea_dsl.Dimension.parse("currency")
u = sea_dsl.Unit("USD", "US Dollar", "Currency", 1.0, "USD")TypeScript (napi-rs):
import { Dimension, Unit } from "@domainforge/sea";
const d = Dimension.parse("currency");
const u = new Unit("USD", "US Dollar", "Currency", 1.0, "USD");WASM (browser):
import init, { Dimension, Unit } from "./sea_core.js";
await init();
const d = new Dimension("currency");
const u = new Unit("USD", "US Dollar", "Currency", 1.0, "USD");
// Programmatic Expression Building & Normalization
const expr = Expression.binary(
BinaryOp.And,
Expression.variable("b"),
Expression.variable("a")
);
console.log(expr.normalize().toStringRepr()); // "(a AND b)"All bindings provide identical semanticsβzero behavioral drift.
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Your Application β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Python API β TypeScript β WASM β
β (PyO3) β (napi-rs) β (wasm-bindgen) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Rust Core Engine (sea-core) β
β βββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββ β
β β Primitives β Graph Store β Policy Engine β β
β β (5 types) β (IndexMap) β (SBVR logic) β β
β βββββββββββββββΌβββββββββββββββΌββββββββββββββββββ€ β
β β Parser β Validator β CALM Integrationβ β
β β (Pest) β (Ref check) β (export/import) β β
β βββββββββββββββ΄βββββββββββββββ΄ββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Design Principles:
- Rust core is canonical. Bindings wrap coreβnever duplicate logic.
- Deterministic behavior. IndexMap ensures stable ordering across runs.
- Standards-based. SBVR-aligned expressions, FINOS CALM export.
π§ CLI Usage
# Install the CLI
cargo install --path sea-core --features cli
# Validate a model
sea validate model.sea
# Export to FINOS CALM
sea project --format calm model.sea architecture.json
# Import from Knowledge Graph
sea import --format kg model.ttl
# Normalize Expressions
sea normalize "b AND a" # -> "(a AND b)"π Error Diagnostics
Comprehensive error handling with fuzzy matching suggestions:
Error[E001]: Undefined Entity: 'Warehous' at line 1
--> 1:23
|
1 | Flow "Materials" from "Warehous" to "Factory"
| ^^^^^^^^^^
|
hint: Did you mean 'Warehouse'?
- 30+ structured error codes with detailed descriptions
- Multiple output formats: JSON, Human-readable, LSP
- Native error types for Python, TypeScript, and WASM
# Clone and set up
git clone https://github.com/GodSpeedAI/DomainForge.git
cd DomainForge
pip install maturin
maturin develop
# Run your first model
python examples/camera_factory.py# Per-language tests
just rust-test # Rust core
just python-test # Python bindings
just ts-test # TypeScript bindings
# All tests at once
just all-tests# Python bindings
pip install maturin && maturin build --release
# TypeScript bindings
npm install && npm run build
# WebAssembly
./scripts/build-wasm.sh| Resource | Description |
|---|---|
| π Copilot Instructions | Essential guide for AI coding agents |
| π API Specification | Complete API reference |
| π Product Requirements | PRD with success metrics |
| π System Design | Technical specifications |
| ποΈ Architecture Decisions | Key architectural choices |
| πΊοΈ CALM Mapping | SEA β CALM conversion |
| π Error Codes | Validation error reference |
We welcome contributions! Please see Contributing Guide for developer notes on building the CLI, TypeScript bindings, and WASM.
DomainForge is open source under the Apache-2.0 License.
Built on foundational work from:
- ERP5 Unified Business Model β Foundational primitive design
- SBVR Standard (OMG) β Semantic business vocabulary
- FINOS CALM β Architecture-as-Code integration
- Rust Community β High-performance core runtime
Your business rules, everywhere. Always correct. Always in sync.