Skip to content

Code layout

Shin Sterneck edited this page Nov 8, 2026 · 1 revision

Stratagram is a Cargo workspace. Rust holds the model and all editing logic; QML (Qt Quick, via CXX-Qt) renders it on a Canvas and provides the toolbar and properties panel. core/ is the library stratagram-core: everything without a user interface, which also builds for WebAssembly. The desktop app (Qt) is the package at the top, web/ the browser editor, and netbox-plugin/ the NetBox plugin.

File Purpose
core/src/model.rs Devices, ports, links, notes, connection points, layers, stacking order, JSON format
core/src/geom.rs Link routing, arrowheads, label placement, colors (shared by screen and SVG)
core/src/editor.rs Hit testing, mouse/drag state machine, selection, undo/redo, property edits, scene JSON for the user interface
core/src/layout.rs Auto layouts (hierarchy, radial, circle, grid, force-directed, tidy)
core/src/config.rs Reads stratagram.conf (the frame defaults)
core/src/frame.rs The frame around the diagram: sizing, the templates and the logo, as shapes shared by the canvas and the exports
core/src/shape.rs Device outlines by type, as path data shared by the canvas and SVG export
core/src/theme.rs The light, dark and neon themes
core/src/svg.rs SVG export
core/src/drawio.rs draw.io export (also the clipboard copy)
core/src/drawio_import.rs Reading draw.io shapes for pasting
core/src/cml.rs Cisco Modeling Labs export
core/src/netbox.rs Diagrams from NetBox sites, and refreshing them
src/main.rs The desktop app's start and the command line
src/bridge.rs CXX-Qt DiagramController QObject exposed to QML
cpp/ What Qt offers only in C++: app setup, the clipboard, PNG rendering
qml/DiagramCanvas.qml Draws the scene, grid, pan/zoom, mouse and key input
qml/PropertiesPanel.qml Context-sensitive editor for the selection
qml/main.qml Window, toolbar, shortcuts, file dialogs, collapsible panel
web/src/lib.rs The editor for the browser (WebAssembly), like bridge.rs
web/www/canvas.js, panel.js, app.js The browser's canvas, panel and toolbar, ported from the QML
web/www/sw.js, manifest.webmanifest The installable app (offline use)
netbox-plugin/ The NetBox plugin: the Diagram tab, saving, the site's data
packaging/ Desktop files, the Windows installer, the AUR packages, the Linux download
site/ The homepage (stratagram.app)

The core has no Qt dependency and is covered by unit tests (cargo test -p stratagram-core). QML (and the browser's JavaScript) only converts mouse positions to world coordinates and paints what Rust sends.

Clone this wiki locally