gitwtfhub

wtf is cairn?

r0kshan/cairn — explained in plain English

Analysis updated 2026-05-18

37JavaScriptAudience · developerComplexity · 3/5Setup · easy

TL;DR

Cairn is a command line diagram-as-code tool focused on logical, application, and infrastructure software architecture views, with overlap-free layouts and validation.

Mindmap

mindmap
  root((cairn))
    What it does
      Diagram as code CLI
      Logical application views
      Infrastructure views
    Tech stack
      JavaScript
      Elkjs layout
      CLI and playground
    Features
      Overlap-checked layout
      Validation
      Flow matrix export
      French English output
    Use cases
      Architecture documents
      CI diagram checks

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Generate logical, application, or infrastructure architecture diagrams from a text based source file.

REASON 2

Catch overlapping diagram labels automatically in continuous integration before they ship in documents.

REASON 3

Export an infrastructure flow matrix as CSV, Markdown, or SVG for technical architecture documents.

REASON 4

Produce architecture diagrams in English or French with customizable theme colors.

What's in the stack?

JavaScriptElkjsCLI

How it stacks up

r0kshan/cairnangelsswordstudios/angelssword-adventurers-creatoravacocloud/avaco-railway
Stars373737
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasymoderate
Complexity3/52/53/5
Audiencedevelopergeneralops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 30min

Pre-release status, CLI and browser playground both ship template initializers for each diagram type.

Wtf does this do

Cairn is a command line tool for creating software architecture diagrams from written code instead of dragging shapes around in a graphical editor. It focuses specifically on three kinds of views used in technical architecture documents: logical, application, and infrastructure diagrams. It is built on top of Elkjs, a layout engine, and comes both as a CLI and as a browser based playground, both of which offer starter templates for each diagram type, live preview, and export to SVG and PNG images. The project explains its own reasoning: many teams still draw these diagrams by hand in tools like Drawio, which gives fine control but is slow to update and hard to keep consistent. Existing diagram as code tools exist, but on complex architecture diagrams with many connections they tend to produce layouts that are either too large or have overlapping labels that become unreadable, which does not work for formal documents that require clear logical, application, and infrastructure views. To address that, Cairn checks for label overlaps on every build and treats any overlap as a failure that can be caught in continuous integration, keeping each connection line and its label distinct and readable. It supports different layout dispositions for slides versus full pages, validates diagrams against typed rules for each view and reports clear, source located errors, and can export an infrastructure flow matrix as CSV, Markdown, or SVG, splitting protocol and port information and labeling each connection point by its network zone. Output can be generated in English or French, and colors can be customized per element type using built in or custom themes. The README is upfront that Cairn is not meant to replace general purpose diagramming tools: for flowcharts or sequence diagrams, tools like Mermaid or D2 are recommended instead, and for detailed C4-style software structure modeling, dedicated tools such as Structurizr or LikeC4 are suggested. The project is currently in a pre-release state, with the maintainer waiting on early user feedback and open issues before calling it stable.

Yoink these prompts

Prompt 1
Show me how to write a Cairn source file for a logical architecture view with the CLI.
Prompt 2
Explain how Cairn's overlap-checked layout differs from a typical diagram-as-code tool.
Prompt 3
Walk me through using cairn validate to catch schema and completeness errors in a diagram.
Prompt 4
How do I export an infrastructure flow matrix from a Cairn diagram as Markdown?

Frequently asked questions

wtf is cairn?

Cairn is a command line diagram-as-code tool focused on logical, application, and infrastructure software architecture views, with overlap-free layouts and validation.

What language is cairn written in?

Mainly JavaScript. The stack also includes JavaScript, Elkjs, CLI.

How hard is cairn to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is cairn for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.