Choosing an Implementation
DTRules is implemented in Go, providing a high-performance runtime with multiple ways to work with your rules.
The DTRules Workflow
DTRules separates rule authoring from rule execution. This is the key concept:
┌─────────────────────────────────────────────────────────────────┐
│ AUTHORING PHASE │
│ │
│ Excel Files (.xls) ───► CLI Compiler ───► XML Files │
│ - EDD (data model) (Go tools) - *_edd.xml │
│ - Decision Tables - *_dt.xml │
│ │
│ Requires: Go 1.21+ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ EXECUTION PHASE │
│ │
│ ┌─────────────────────┐ ┌─────────────────────┐ │
│ │ Go CLI │ OR │ REST API │ │
│ │ │ │ │ │
│ │ • Quick validation │ │ • HTTP endpoints │ │
│ │ • Batch execution │ │ • Visual UI backend │ │
│ │ • Tracing output │ │ • Cloud-native │ │
│ │ │ │ │ │
│ └─────────────────────┘ └─────────────────────┘ │
│ │
│ Requires: Go 1.21+ │
└─────────────────────────────────────────────────────────────────┘ Available Tools
| Tool | Purpose | Best For |
|---|---|---|
| Visual UI | Interactive rule editing and testing | Learning, visual debugging |
| Go CLI | Command-line rule execution | Validation, batch testing, CI/CD |
| REST API | HTTP API for rule execution | Production services, microservices |
| Go Library | Embedded rule engine | Go application integration |
Performance
Go runtime highlights:
- 130x faster operator lookup
- 24x faster arithmetic operations
- Zero-allocation hot paths for reduced GC pressure
- Single binary deployment - no runtime dependencies
- Container-friendly - low memory footprint
Common Scenarios
Scenario 1: New to DTRules
Recommended: Start with the Visual UI
The Visual UI is the easiest way to understand DTRules concepts. Load the CHIP sample project and explore decision tables visually. You don't need to write any code.
Scenario 2: Rule Author
Recommended: Go CLI for compilation and testing
- Write rules in Excel
- Compile with Go CLI tools
- Test with Go CLI:
./dtrules -rules xml/ -entry Main -trace - Use Visual UI for interactive debugging
Scenario 3: Production Service
Recommended: Go REST API
- Compile rules (CI/CD pipeline)
- Deploy XML files with Go REST API server
- Use the REST API for rule execution
- Benefit from Go's performance and low resource usage
Project Structure
myproject/
├── DecisionTables/ # Excel files with business rules
│ └── MyRules_dt.xls
├── edd/ # Entity Definition Documents
│ └── MyRules_edd.xls
├── xml/ # Compiled XML files
│ ├── MyRules_edd.xml
│ └── MyRules_dt.xml
├── testfiles/ # Test case input files
├── DTRules.xml # Project configuration
└── main.go # Your Go application (optional) Next Steps
Choose your quick start guide based on your needs:
- Quick Start (UI) Recommended - Visual editing, best for learning
- Quick Start (Go) - CLI and REST API