# 8t4/c4sharp architecture

> Architecture diagram of the GitHub repository 8t4/c4sharp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/8t4/c4sharp
- Repository: https://github.com/8t4/c4sharp

## Overview

##### Project type and purpose
- It provides:
- A command-line tool (`src/C4Sharp.Tools`) exposing build and export commands.

##### File structure
- Top-level folders:
- `.github` / CI workflows & funding
- `docs` / C4 definitions, images, UML templates
- `src` / two modules:
– `C4Sharp` (core library)
– `C4Sharp.Tools` (CLI entrypoint)
- Within `C4Sharp`:
- `Commons` / extensions & file-system helpers
- `Elements` / domain abstractions (Person, Container, SoftwareSystem, Relationship)
- `Plantuml` / PlantUML DSL generation, resources, exceptions
- `Themes` / default and customizable styling
- There is a `.sln`, NuGet package references, Java requirement (PlantUML JAR), and build scripts in GitHub Actions.

##### README for additional insights
- Confirms .NET 5+ and Java prerequisites.
- Describes two build approaches: self-compile via code or using the `c4scli` tool (ideal for CI).

##### Elements
- Clear labels: e.g., “C4Sharp.Core”, “C4SCLI”, “ModelDiagrams Sample”, “PlantUML (Java)”.
- Developer → (consumes) → NuGet packages
- CLI → (calls) → Core Library API
- Core Library → (executes) → PlantUML JAR
- Core Library → (reads/writes) → Resource files & output folder

##### Detailed capture of essential architectural elements
- Don’t omit the Java/PlantUML dependency—they are critical for output.
- How theming ties into the builder before export.
- Configuration sources: sample code overrides default styles.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors and External Systems
    Developer["Developer"]:::actor
    DevOpsPipeline["DevOps Pipeline (GitHub Actions)"]:::external
    JavaPlantUML["Java / PlantUML JAR"]:::external
    FileSystem["File System (Repo & Output)"]:::external

    %% C4Sharp Platform Container
    subgraph "C4Sharp Platform"
        direction TB
        CoreLibrary["Core Library (C4Sharp)"]:::library
        CLITool["CLI Tool (C4SCLI)"]:::cli
        SampleProject["ModelDiagrams Sample"]:::sample
        DocsPipeline["Docs Pipeline"]:::pipeline
    end

    %% Core Library Components
    subgraph "Core Library (C4Sharp) Components"
        direction TB
        Commons["Commons Module"]:::library
        Elements["Elements Module"]:::library
        Diagrams["Diagrams Module"]:::library
        PlantumlIntegration["PlantUML Integration"]:::library
        Themes["Themes Module"]:::library
    end

    %% Relationships
    Developer -->|consumes NuGet| CoreLibrary
    Developer -->|uses CLI| CLITool
    CLITool -->|calls API| CoreLibrary
    CoreLibrary -->|executes| PlantumlIntegration
    PlantumlIntegration -->|spawns process| JavaPlantUML
    CoreLibrary -->|reads/writes| FileSystem
    SampleProject -->|references| CoreLibrary
    SampleProject -->|exports diagrams to| DocsPipeline
    DevOpsPipeline -->|runs build & c4scli| CLITool
    DevOpsPipeline -->|deploys docs to| DocsPipeline

    %% Core Library Internal Relationships
    CoreLibrary -->|contains| Commons
    CoreLibrary -->|contains| Elements
    CoreLibrary -->|contains| Diagrams
    CoreLibrary -->|contains| PlantumlIntegration
    CoreLibrary -->|contains| Themes
    Diagrams -->|uses| PlantumlIntegration
    Diagrams -->|uses| Themes

    %% Click Events for Component Mapping
    click CoreLibrary "https://github.com/8t4/c4sharp/blob/main/src/C4Sharp/C4Sharp.csproj"
    click Commons "https://github.com/8t4/c4sharp/tree/main/src/C4Sharp/Commons"
    click Elements "https://github.com/8t4/c4sharp/tree/main/src/C4Sharp/Elements"
    click Diagrams "https://github.com/8t4/c4sharp/tree/main/src/C4Sharp/Diagrams"
    click PlantumlIntegration "https://github.com/8t4/c4sharp/tree/main/src/C4Sharp/Diagrams/Plantuml"
    click Themes "https://github.com/8t4/c4sharp/tree/main/src/C4Sharp/Diagrams/Themes"
    click JavaPlantUML "https://github.com/8t4/c4sharp/blob/main/src/C4Sharp/Resources/plantuml.jar"
    click CLITool "https://github.com/8t4/c4sharp/blob/main/src/C4Sharp.Tools/C4Sharp.Tools.csproj"
    click SampleProject "https://github.com/8t4/c4sharp/blob/main/samples/ModelDiagrams/ModelDiagrams.csproj"
    click DocsPipeline "https://github.com/8t4/c4sharp/blob/main/.github/workflows/dotnet.yml"

    %% Styles
    classDef actor fill:#FFFFFF,stroke:#000000,stroke-width:1px
    classDef library fill:#ADD8E6,stroke:#000080,stroke-width:1px
    classDef cli fill:#90EE90,stroke:#006400,stroke-width:1px
    classDef sample fill:#FFFACD,stroke:#DAA520,stroke-width:1px
    classDef pipeline fill:#E6E6FA,stroke:#9370DB,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#696969,stroke-width:1px
```
