Skip to main content
Version: 0.1.0-alpha.3

Architecture Overview

This section contains C4 model diagrams and supplementary architecture documentation for Invowk. These diagrams help developers understand the system structure, execution flows, and design decisions.

Diagram Overview

DiagramTypePurpose
C4 Context (C1)C4 ModelSystem boundaries, users, external systems
C4 Container (C2)C4 ModelInternal components and data stores
C4 Component: Runtime (C3)C4 ModelInternal structure of the runtime package
C4 Component: Container (C3)C4 ModelInternal structure of the container package
Command ExecutionSequenceTemporal flow from CLI to execution
Runtime SelectionFlowchartDecision tree for choosing runtime
Discovery PrecedenceFlowchartHow commands are found and conflicts resolved

Reading Order

For newcomers to the codebase:

  1. Start with C4 Context - Understand what Invowk is and what it interacts with
  2. Then C4 Container - See the major internal components
  3. Optionally explore Runtime Components or Container Components - Deep-dive into packages with non-trivial internal structure
  4. Read Command Execution - Follow the main user journey
  5. Reference others as needed - Runtime selection and discovery when debugging or extending

Diagram Technology

All diagrams use Mermaid syntax. Mermaid is a JavaScript-based diagramming tool that renders diagrams from text definitions, making them easy to version control and maintain.

Editing Diagrams

The Mermaid Live Editor is useful for testing changes before committing.

C4 Model Background

The C4 model provides a hierarchical way to describe software architecture:

LevelNameDescription
C1ContextSystem as black box with external actors
C2ContainerMajor deployable/runnable units
C3ComponentInternal modules within containers
C4CodeClass/code-level details

For Invowk (a single CLI binary), C1 and C2 are most valuable. C3 (Component) diagrams are provided selectively for packages whose internal structure is genuinely complex — specifically internal/runtime/ (interface segregation, registry pattern, 3 implementations) and internal/container/ (composition via embedding, decorator pattern, functional options). Other packages have flat enough structure that code documentation suffices.

Keeping Diagrams Updated

When making significant architectural changes:

  1. Check if diagrams need updates - New components, changed relationships, removed features
  2. Update the relevant diagram(s) - Keep changes focused
  3. Verify rendering - Test in Mermaid Live Editor or the website preview
  4. Update tables and text - Diagrams alone may not capture all context