diagc publish writes one self-contained HTML page per diagram, and a PNG. The page folds, zooms and switches views in the browser, with no server behind it.
Host the pages on GitHub Pages, GitLab Pages or any static host. Put the PNG in a README.
.diagrams/html/<name>.html a small page, loading one shared viewer
.diagrams/html/index.html an index of all the pages
diagc studio opens a browser app against your repository. Draw a diagram there and the studio saves it as a file in the repository. diagc eject turns a drawn diagram into TypeScript.
It runs on your machine against your files: no accounts and no server.
A diagram is a TypeScript file, so it diffs, reviews and refactors like the rest of your repository. diagc lint reports what compiles but is probably a mistake.
A plane groups the same things in a second way: by system in one view, by where they run in another. A layer adds detail without cluttering the base picture.
Boxes are laid out for you. Drag one, with alignment guides and snap, and its place goes to a file of its own, so a recompile keeps it. Symmetry centres a tree on its axis.
C4, deployment, ER, activity, threat model, causal loop, plan, fishbone, git graph, state machine and second-order thinking. Each has a starter to copy.
Fourteen styles, from clean boxes to sketch, blueprint and neon, and a light and a dark theme. A published page has a theme switch and a style picker for its reader.
diagc show prints a diagram as text, for a pipe or a coding agent. diagc tui browses it full-screen, folds, planes and search included, and redraws as you edit.
The studio's ⋯ menu saves a diagram as a PNG, or as a web page in one file to send instead of a picture. The reader unfolds groups and picks the theme and style.
A diagram is a .diagram.ts file under .diagrams/src/. Or draw it in the studio, which writes a .diagram.json. Positions go to a separate .layout.json, so meaning and coordinates land in different diffs.
Compile and validate
diagc compile checks each source and writes one validated model per diagram. Both ways of authoring meet at that model.
Look, then publish
diagc studio shows the result and recompiles as you edit, and diagc show prints it in the terminal. diagc publish writes the HTML pages and the PNGs.
.diagrams/src/shop.diagram.ts
import { model } from '@diagc/core';
// A starter: a customer and one system holding two services and a database.
// `contains` nests, `relate` draws an arrow. The system rests folded, with the
// arrows into it bundled, until you double-click it.
const m = model('shop', { name: 'Shop' });
const customer = m.node('customer', { type: 'person', name: 'Customer' });
const shop = m.node('shop', { type: 'system', name: 'Shop' });
const web = m.node('web', { type: 'service', name: 'Storefront' });
const api = m.node('api', { type: 'service', name: 'Orders API' });
const db = m.node('orders-db', { type: 'database', name: 'Orders DB' });
shop.contains(web, api, db);
m.relate(customer, web, { kind: 'sync', label: 'Browses' });
m.relate(web, api, { kind: 'sync', label: 'Places orders' });
m.relate(api, db, { kind: 'writes', label: 'Order rows' });
export default m;