Skip to content

Gruku/ArchFlow

Β 
Β 

Repository files navigation

ArchFlow

A self-hosted, visual-first C4 architecture platform

Draw your systems the way you think about them. Fork. Comment. Review. Ship.

Deploy License FastAPI Postgres React TypeScript TailwindCSS


What it is

ArchFlow is an open-source alternative to IcePanel β€” a collaborative, real-time workspace for modeling software architecture using the C4 model.

Unlike Figma-for-architecture tools that end at "pretty boxes", ArchFlow treats your architecture as a first-class data model: every object has a type (system, container, component, actor…), a lifecycle status, relationships, drafts, version history, and team-level access control. Drill from a system landscape all the way down to components β€” the model stays consistent at every zoom level.

L1  System Landscape ──▢ System Context
                           β”‚
L2                      Container
                           β”‚
L3                      Component

✨ Features

🎨 Visual-first canvas

  • React Flow-powered editor with snap-to-group, smart containment, and edge routing.
  • Live cursors, presence roster, and selection sync β€” see your teammates edit in real time.
  • Optimistic drag & resize β€” zero snap-back, WebSocket cache patching under the hood.
  • Comments on the canvas β€” question pins, inaccuracy flags, ideas, notes.

🧱 C4-native data model

  • Objects (system / external_system / actor / app / store / component / group) with status, technology, tags, owner team.
  • Per-diagram positions β€” the same object can live on L1, L2, L3 with different coordinates on each canvas.
  • C4-aware quick-create: place the right types for the level you're on, but also allow cross-level references.

πŸŽ›οΈ Technology catalog

  • ~170 built-in technologies (Python, PostgreSQL, Kafka, Figma, gRPC, Kubernetes…) with Iconify-backed logos and brand colors.
  • Picker in the object sidebar (multi-select) and edge sidebar (single-select, filtered to protocols) β€” results group by category with fuzzy search over name / slug / aliases.
  • Canvas renders the primary technology as a corner badge on every node and resolves protocol icons onto edge labels.
  • Create workspace-level custom technologies β€” pick any Iconify icon for the logo, set your own name / slug / color / aliases.
  • Dedicated /technologies management page lists built-in + custom entries with scope + category filters.

πŸ”€ Drafts & reviews

  • Fork any diagram into a draft that lives in isolation from live data.
  • Edit the fork freely β€” compare diffs, resolve conflicts with the live model, then merge.
  • Full version snapshots with revert-to-version.

πŸ‘₯ Workspaces, teams, invites

  • Multi-workspace with per-workspace roles (owner / admin / editor / viewer).
  • Per-diagram ACL via teams β€” grant a team read/edit/manage access on individual diagrams.
  • Pending-approval invite flow (invitee accepts; owner/admin approves).
  • Notification inbox for mentions, invites, and activity.

πŸ“¦ Organization at scale

  • Packs β€” group diagrams into logical collections (like folders, but reorderable).
  • Pinned / Recent on the Overview dashboard.
  • Full-text search across all objects and diagrams (⌘K / Ctrl+K).

πŸ”Œ Extensibility

  • REST API (OpenAPI / Swagger UI at /docs) + orval-generated TypeScript client.
  • API keys with prefix-based detection (ak_…), first-class citizens alongside JWT.
  • Webhooks for object.*, connection.*, diagram.*, and more.
  • Optional AI insights (Claude) β€” summarize an object's role, spot missing connections.
  • JSON export / import for migration or CI snapshotting.

🌐 Realtime collaboration

  • One workspace-level WebSocket firehose + per-diagram channels.
  • Keeps React Query cache in sync across tabs / users / browsers β€” no manual refresh.

🧰 Stack

BackendFrontendInfra
  • FastAPI (async)
  • SQLAlchemy 2.0 + asyncpg
  • Alembic migrations
  • PostgreSQL 16
  • Redis (realtime fanout)
  • pytest + pytest-asyncio
  • uv package manager
  • React 18 + Vite
  • TypeScript 5
  • @xyflow/react (canvas)
  • TanStack Query
  • Zustand (stores)
  • TailwindCSS
  • orval (codegen)
  • Docker Compose (dev + prod)
  • Helm chart (charts/archflow)
  • GitHub Actions-ready
  • make-driven developer flow

πŸš€ Quick start

One-time bootstrap (installs deps, spins up Postgres/Redis, runs migrations):

make setup

Then any time you want to code:

make dev

That launches, in parallel:

Service URL
Backend (FastAPI) http://localhost:8000
API docs http://localhost:8000/docs
Frontend (Vite) http://localhost:5173
Postgres localhost:5432
Redis localhost:6379

One Ctrl+C tears both app processes down. Infra keeps running β€” make down stops the containers.


πŸ“œ Make targets

Dev

Command What it does
make dev Deps β†’ infra β†’ migrations β†’ backend + frontend in parallel
make dev-deps uv sync backend, npm install frontend
make dev-infra Start Postgres + Redis via docker compose
make dev-backend Backend only (uvicorn --reload)
make dev-frontend Frontend only (vite)

Database

Command What it does
make db-upgrade Apply all pending migrations
make db-migrate msg="..." Generate a new Alembic migration from model diff
make db-downgrade Roll back the last migration

Tests, lint, codegen

Command What it does
make test Backend pytest + frontend tests
make test-backend Backend only
make test-frontend Frontend only
make lint ruff check + ruff format --check + npm run lint
make api-codegen Regenerate the typed frontend client from OpenAPI (run after schema changes)

Prod

Command What it does
make build Build prod docker images
make up Start the prod stack
make down Stop the prod stack

πŸ—‚οΈ Project layout

ArchFlow/
β”œβ”€β”€ backend/                  FastAPI app
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/v1/           REST endpoints (one router per resource)
β”‚   β”‚   β”œβ”€β”€ models/           SQLAlchemy 2.0 models
β”‚   β”‚   β”œβ”€β”€ schemas/          Pydantic request/response schemas
β”‚   β”‚   β”œβ”€β”€ services/         Business logic layer
β”‚   β”‚   β”œβ”€β”€ realtime/         WebSocket manager + Redis fanout
β”‚   β”‚   └── core/             Config, DB, security
β”‚   β”œβ”€β”€ alembic/              Migrations
β”‚   └── tests/                Pytest suite
β”œβ”€β”€ frontend/                 Vite + React SPA
β”‚   └── src/
β”‚       β”œβ”€β”€ pages/            Top-level routes
β”‚       β”œβ”€β”€ components/       Canvas, sidebar, toolbar, modals…
β”‚       β”œβ”€β”€ hooks/            React Query hooks + WebSocket client
β”‚       β”œβ”€β”€ stores/           Zustand stores (auth, canvas, workspace)
β”‚       β”œβ”€β”€ lib/              Shared axios client (auth + workspace + 401 β†’ /login)
β”‚       └── types/            Shared TypeScript models
β”œβ”€β”€ docker/                   docker-compose.dev.yml + docker-compose.yml
β”œβ”€β”€ charts/archflow/          Helm chart
└── docs/architecture/        ADRs + design notes

🧠 Concepts in 60 seconds

Workspace β†’ your org's top-level container. Everything (diagrams, objects, teams, packs) belongs to exactly one workspace.

Diagram β†’ a single C4-level canvas. Has a type (system_landscape Β· system_context Β· container Β· component Β· custom) and an optional scope_object_id linking it to its parent in the drill-down hierarchy.

ModelObject β†’ a piece of your architecture (system, container, component, actor…). Lives in a workspace; can appear on many diagrams via a DiagramObject junction that stores per-diagram coordinates and size.

Connection β†’ a directed or bidirectional edge between two ModelObjects. Rendered on any diagram that contains both endpoints.

Draft β†’ a forked universe of a diagram + its objects + its connections. Changes stay isolated until you merge back into live.

Pack β†’ a named collection of diagrams within a workspace, for organizing large architectures.


🧩 Environment

Config lives in .env at the repo root (copied from .env.example on first make setup). Knobs you'll touch most:

DATABASE_URL=postgresql+asyncpg://archflow:archflow@localhost:5432/archflow
JWT_SECRET=change-me-in-production
BACKEND_CORS_ORIGINS=http://localhost:5173

# Optional β€” enables AI insights on ModelObjects
ANTHROPIC_API_KEY=sk-ant-...

πŸ› Troubleshooting

Port 8000 or 5173 already in use
lsof -ti tcp:8000 | xargs kill   # or tcp:5173
Migrations out of sync after pulling
make db-upgrade
Stale frontend types after changing API
make api-codegen
Nuke Postgres (wipes the volume β€” you'll lose all data)
docker compose -f docker/docker-compose.dev.yml down -v
make dev-infra && make db-upgrade

πŸ—ΊοΈ Roadmap

  • C4 canvas with drill-down (L1 β†’ L2 β†’ L3)
  • Real-time collaboration (presence, cursors, selection, optimistic CRUD)
  • Drafts + diffs + conflict resolution
  • Version history with revert
  • Team-level per-diagram ACL
  • API keys + webhooks
  • Packs, pinned, search
  • Import from Structurizr DSL
  • Export to Mermaid / PlantUML
  • SSO (OIDC)
  • Deployment diagrams (C4 L4)

See docs/architecture/ for ADRs and ongoing design.


🀝 Contributing

PRs welcome β€” bug fixes, features, docs, everything. Full workflow in CONTRIBUTING.md.

TL;DR:

  1. main is protected. Branch off: git switch -c feat/my-thing.

  2. Small, focused commits. Conventional prefixes: feat/, fix/, refactor/, docs/, chore/, test/.

  3. Before pushing:

    make lint
    make test
  4. Open a PR targeting main. CI runs build-backend and build-frontend β€” both must be green to merge.

  5. Squash merge keeps main linear.

Bugs β†’ GitHub issues. Security issues β†’ private advisories.


πŸ“„ License

AGPL-3.0 β€” free to use, modify, and self-host. If you run a modified version as a network service, you must offer the source under the same license.

About

Map your architecture, from satellite to syscall. Self-hosted C4 diagrams as a typed, versioned model your team branches and reviews like code. Live at https://archflow.tools

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 60.8%
  • Python 37.5%
  • CSS 1.3%
  • Makefile 0.2%
  • Dockerfile 0.1%
  • Mako 0.1%