GitHub

Diagram as Code,
Beautiful by Default

Write architecture diagrams in Python. Render with a Rust-powered engine. Get publication-ready SVG output, every time.

🌐

Language Neutral

JSON IR works from Python, TypeScript, Kotlin, or any language. Write once, render anywhere.

Rust-Powered

Deterministic layout and rendering. Same input always produces the exact same output.

🎨

Beautiful by Default

Clean, professional themes out of the box. No design work needed for presentation-ready diagrams.

Simple DSL

# Just describe your architecture
title: Web Service
direction: LR

Client >> Load Balancer >> API Server >> Database

cluster AWS VPC {
  Load Balancer
  API Server
  Database
}

Or use Python

from archflow import Diagram, Node, Cluster

with Diagram("Web Service", direction="LR") as d:
    with Cluster("vpc", "AWS VPC"):
        web = Node("web", "Web Server")
        app = Node("app", "App Server")
        db  = Node("db", "Database")
    web >> app >> db
    d.save_svg("output.svg")
Loading...
100%
Loading icons from registry...

Documentation

Archflow is a Diagram-as-Code platform that turns code into beautiful architecture diagrams.

DSL Syntax (Playground)

Write diagrams in a simple, readable syntax:

# Metadata
title: My Architecture
direction: LR

# Edges (use >> or ->)
Client >> API Gateway >> Auth Service
API Gateway >> User Service

# Edge with label
Auth Service >> Database : SQL queries

# Clusters (groups)
cluster Kubernetes {
  API Gateway
  Auth Service
  User Service
}

cluster Storage {
  Database
  Redis
}

Nodes are automatically created when referenced in edges or clusters. Node IDs are generated from labels.

Quick Start (Python)

pip install archflow

from archflow import Diagram, Node, Cluster

with Diagram("My Service", direction="LR") as d:
    with Cluster("vpc", "VPC"):
        web = Node("web", "Web Server")
        db  = Node("db", "Database")
    web >> db
    d.save_svg("output.svg")

CLI Usage

archflow render diagram.json -o output.svg

JSON IR Schema

The core contract between any DSL and the rendering engine.

FieldTypeRequiredDescription
versionstringYesSchema version ("1.0.0")
metadata.titlestringNoDiagram title
metadata.directionstringNo"TB" (top-bottom) or "LR" (left-right)
metadata.themestringNoTheme name (default: "default")
nodes[]arrayYesList of node definitions
nodes[].idstringYesUnique node identifier
nodes[].labelstringYesDisplay label
edges[]arrayYesList of edge definitions
edges[].fromstringYesSource node ID
edges[].tostringYesTarget node ID
edges[].labelstringNoEdge label text
clusters[]arrayNoList of cluster (group) definitions
clusters[].idstringYesUnique cluster identifier
clusters[].labelstringYesDisplay label
clusters[].childrenstring[]YesList of child node/cluster IDs

Style Overrides

Any node, edge, or cluster can include an optional style object:

{
  "style": {
    "fill": "#FF6B6B",
    "stroke": "#C92A2A",
    "stroke_width": 2,
    "stroke_dasharray": "5,5",
    "font_color": "#FFFFFF"
  }
}

Architecture

Python DSL / TS DSL / Any Language
          |
     Diagram IR (JSON)
          |
      Rust Core Engine
   +------+------+
   |      |      |
Layout  Theme  Scene Graph
          |
      Renderer
   +------+------+------+
   |      |      |      |
  SVG    PNG    CLI    WASM
                        |
                    React / Web
Copied!