https://infinyte.github.io/DocFlow/
____ _____ _
| _ \ ___ ___ | ___| | | ___ __ __
| | | | / _ \ / __| | |_ | | / _ \ \ \ /\ / /
| |_| | | (_) | | (__ | _| | | | (_) | \ V V /
|____/ \___/ \___| |_| |_| \___/ \_/\_/
Intelligent Documentation and Modeling Toolkit
Transform whiteboard sketches into working code. Generate diagrams from source files. Map external APIs to your domain model. DocFlow is a complete toolkit for the modern software architect.
| Feature | Description |
|---|---|
| Whiteboard to Code | Snap a photo of your whiteboard diagram, get working C# in seconds |
| Bidirectional Transform | C# to Mermaid and back with full semantic preservation |
| API Integration | Parse OpenAPI specs, map to your CDM, generate typed clients |
| SLA Validation | Validate data freshness against SLA requirements |
| DDD Support | Native understanding of aggregates, entities, and value objects |
# 1. Generate a Mermaid diagram from your C# domain model
docflow diagram Domain.cs -o domain.mmd
# 2. Scan a whiteboard photo and extract the diagram
docflow scan whiteboard.jpg -o extracted.mmd
# 3. Generate integration code from an OpenAPI spec
docflow integrate generate petstore.json --cdm Models/ -o Generated/Linux/macOS/WSL:
curl -sSL https://raw.githubusercontent.com/infinyte/docflow/main/install.sh | bashWindows PowerShell:
irm https://raw.githubusercontent.com/infinyte/docflow/main/install.ps1 | iexFrom Source:
git clone https://github.com/infinyte/docflow.git
cd docflow
dotnet build
dotnet run --project src/DocFlow.CLI -- --helpGenerate and transform between C# and Mermaid class diagrams.
# Generate Mermaid class diagram from C# source
docflow diagram Domain.cs -o domain.mmd
# Generate C# code from Mermaid diagram
docflow codegen diagram.mmd -o Models.cs --namespace MyApp.Domain
# Full round-trip test with comparison
docflow roundtrip Domain.cs --compare -vAI-powered extraction of diagrams from photos using Claude Vision.
# Basic scan
docflow scan whiteboard.jpg -o extracted.mmd
# With context hint for better accuracy
docflow scan whiteboard.jpg -c "e-commerce order management" -v
# Full pipeline: whiteboard to C# code
docflow scan whiteboard.jpg -o temp.mmd && docflow codegen temp.mmd -o Models.csRequirements: Claude API key (see Configuration)
Analyze CDM mappings, validate SLAs, and generate integration code.
# Analyze mapping between API and your CDM
docflow integrate analyze petstore.json --cdm Models/Entities.cs --threshold 70
# Validate SLA data freshness
docflow integrate sla https://api.example.com/data --expected 30s --samples 10
# Generate integration code (DTOs, AutoMapper, HTTP client, validators)
docflow integrate generate petstore.json --cdm Models/ -o Generated/ -n MyApp.Integration| Option | Description |
|---|---|
--generate dtos |
External DTOs with JsonPropertyName attributes |
--generate mappers |
AutoMapper profiles with confidence comments |
--generate client |
Typed HTTP client interface |
--generate validators |
FluentValidation validators |
--generate all |
All of the above (default) |
The whiteboard scanner requires a Claude API key. Configure using one of these methods (in priority order):
1. Environment Variable (Recommended):
export ANTHROPIC_API_KEY='sk-ant-...'2. User Config (~/.docflow/config.json):
{
"anthropicApiKey": "sk-ant-..."
}3. Project Config (./docflow.json):
{
"anthropicApiKey": "sk-ant-..."
}Get your API key at: https://console.anthropic.com/
DocFlow uses a Canonical Semantic Model as the universal truth layer. All formats translate to and from this model, enabling lossless bidirectional transformations.
+-------------------------------------+
| Canonical Semantic Model |
| (Entities, Relationships, DDD) |
+-----------------+-------------------+
|
+---------------+--------------+-------------+---------------+
| | | | |
v v v v v
+-------------+ +-------------+ +---------+ +-----------+ +---------------+
| C# Code | | Mermaid | | OpenAPI | | CDM | | Whiteboard |
| (Roslyn) | | Diagrams | | Specs | | Entities | | (Vision) |
+-------------+ +-------------+ +---------+ +-----------+ +---------------+
Direct format conversion (A -> B) breaks down when:
- Information exists in A but not B (lossy)
- You need round-trips (A -> B -> A != A)
- Semantic meaning differs between formats
DocFlow's approach: A -> Canonical Model -> B
The model captures meaning, not just syntax. It knows that ICollection<LineItem> in C# and a filled diamond in Mermaid both represent composition.
The semantic model understands Domain-Driven Design patterns:
| Classification | C# Output | Mermaid Output |
|---|---|---|
| AggregateRoot | Class with identity | <<AggregateRoot>> stereotype |
| Entity | Class with Id property | <<Entity>> stereotype |
| ValueObject | Immutable record type | <<ValueObject>> stereotype |
| DomainService | Service class | <<Service>> stereotype |
| Enum | Enumeration | <<enumeration>> stereotype |
| Interface | Interface contract | <<interface>> stereotype |
DocFlow/
+-- src/
| +-- DocFlow.Core # Canonical model & abstractions
| +-- DocFlow.Diagrams # Mermaid parsing & generation
| +-- DocFlow.CodeAnalysis # Roslyn-based C# parsing
| +-- DocFlow.CodeGen # C# code generation from model
| +-- DocFlow.Vision # AI-powered whiteboard scanning
| +-- DocFlow.AI # Claude API integration
| +-- DocFlow.IMS # Intelligent Mapping Service
| +-- DocFlow.Ontology # DDD pattern classification
| +-- DocFlow.Integration # API integration automation
| +-- DocFlow.Documents # Document pipeline (planned)
| +-- DocFlow.Web # Web UI (planned)
| +-- DocFlow.CLI # Command-line interface
+-- tests/
| +-- DocFlow.CodeAnalysis.Tests # 20 tests
| +-- DocFlow.Diagrams.Tests # 52 tests
+-- docs/
| +-- ARCHITECTURE.md # Technical architecture
| +-- CLI-REFERENCE.md # Complete CLI documentation
| +-- CHANGELOG.md # Version history
| +-- design/ # Design documents
+-- samples/
+-- whiteboard-demos/ # Whiteboard scanner examples
+-- integration-demos/ # Integration module examples
The Integration module extends DocFlow's canonical model pattern to enterprise API integrations:
- OpenAPI Parsing: Extract semantic model from OpenAPI 3.x specs
- CDM Mapping: Map external DTOs to your Canonical Data Model with confidence scores
- SLA Validation: Validate data freshness against SLA requirements
- Code Generation: Generate DTOs, AutoMapper profiles, HTTP clients, validators
Generated AutoMapper Profile:
// Pet -> Product (79% confidence)
CreateMap<PetDto, Product>()
.ForMember(d => d.Id, opt => opt.MapFrom(s => s.Id)) // 95% - Exact name match
.ForMember(d => d.Name, opt => opt.MapFrom(s => s.Name)) // 95% - Exact name match
.ForMember(d => d.Status, opt => opt.MapFrom(s => MapProductStatus(s.Status)))
// TODO: Manual mapping required for Price (no source field)
.ForMember(d => d.Price, opt => opt.Ignore());SLA Validation:
SLA Validation: COMPLIANT
Expected Max Age: 30s
Actual Average: 12.4s
Compliance: 100% (10/10 samples)
See docs/design/integration-module.md for full documentation.
- .NET 8.0 SDK
- Claude API key (for whiteboard scanning)
# Build
dotnet build
# Run all tests (72 tests)
dotnet test
# Run specific test project
dotnet test tests/DocFlow.CodeAnalysis.Tests
dotnet test tests/DocFlow.Diagrams.Tests
# Run CLI locally
dotnet run --project src/DocFlow.CLI -- diagram MyClass.cs- 72 unit tests across 2 test projects (20 CodeAnalysis + 52 Diagrams)
- C# parsing accuracy (classes, records, interfaces, enums)
- Mermaid generation correctness
- Round-trip semantic preservation
- DDD pattern detection and classification
| Document | Description |
|---|---|
| ARCHITECTURE.md | Technical architecture and design |
| CLI-REFERENCE.md | Complete CLI command reference |
| CHANGELOG.md | Version history and release notes |
| Integration Design | API integration module design |
- C# -> Mermaid class diagram generation
- Mermaid -> C# code generation (DDD-style)
- Bidirectional round-trip with semantic preservation
- AI-powered whiteboard scanning
- Professional CLI with Spectre.Console
- Integration module (analyze, sla, generate)
- SLA data freshness validation
- Integration code generation (DTOs, AutoMapper, clients, validators)
- IMS pattern learning from examples
- PlantUML support
- Sequence diagram support
- GraphQL schema parsing
- PDF/Word document pipeline
- VS Code extension
- Web UI (Blazor)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Ensure all tests pass (
dotnet test) - Submit a pull request
MIT License - see LICENSE for details.
Built by Kurt Mitchell with Claude (Anthropic) as co-designer and implementation partner.
Open source dependencies:
- Roslyn - C# code analysis
- Spectre.Console - CLI framework
- Microsoft.OpenApi - OpenAPI parsing
Transform your diagrams. Generate your code. Ship faster with DocFlow.