How blushft/go-diagrams works
File structure
Top-level components:
• cmd/gen/main.go
• nodes/ – definitions of individual node types grouped by provider/category
• aws/, azure/, gcp/, k8s/, generic/, saas/, etc.
• Each subfolder holds Go files that wrap asset metadata into a Node factory
• _examples/ – sample applications showing usage patterns (app, webservice, workers, kubernetes)
• pkg/ – misc packages (e.g., rand helper)
• go.mod, go.sum – Go module configuration
README for additional insights
• Provider nodes as plugins/factories (nodes/aws, nodes/gcp, …) backed by static assets
• CLI frontend (cmd/gen) that wires the core API to a command-line interface
• Output integration with Graphviz for DOT → image
a. Main components to represent:
• CLI entrypoint (“gen” binary)
• Node provider packages (“nodes” directory, subdivided by cloud/saas/etc.)
• Asset repository (“assets” directory)
• Example applications (clients of the library under _examples/)
• External dependency: Graphviz engine (dot)
b. Relationships & interactions:
• The CLI calls into the core API to parse flags/options and user code.
• Edges and Groups are built by the core API.
• The core API outputs a .dot file plus copied asset images into an output folder.
• An external Graphviz process (dot) consumes the .dot file to produce final PNG/SVG.
• Examples import the core API + nodes to demonstrate usage but do not feed back into core.
c. Architectural patterns/design principles:
• API-first library design: expose builder pattern with fluent Connect/Add/Group calls.
• Separation of concerns:
• nodes/ wrap assets into typed constructors
• cmd/ implements CLI glue
• Immutable data structures for nodes/edges, functional option pattern for configuration.
d. Technologies/frameworks/libraries:
• Go modules (go.mod)
• Graphviz DOT as output format
• Standard library for CLI flags/logging
Detailed element checklist
• CLI → Core API
• Core API → Providers
• Providers → Assets
• Core API → .dot file (output) → Graphviz
• Examples → Core API & Providers