# isaaceindhoven/plantuml-styler architecture

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

- Interactive diagram: https://gitdiagram.com/isaaceindhoven/plantuml-styler
- Repository: https://github.com/isaaceindhoven/plantuml-styler

## Overview

##### Project type and purpose
- PlantUML-styler is a single-page application (SPA) built with Angular.

##### File structure
- Top-level: Angular config (angular.json, tsconfig*), e2e tests, Dockerfile, CI/CD (Netlify badge), README.
- /src/app: the Angular app, organized into
- services/ (generate, styling, zip, import/export, utility, autonumber)
- core/helpers (HTTP interceptor)
- interfaces (typing for zip tasks, entries)
- /src/assets/lib/zip: client-side deflate/inflate & z-worker libraries.
- Environments for server URLs.

##### Extract architectural hints from the README
- Built entirely in the browser.
- Communicates with a PlantUML render server over HTTP.
- Uses themes (JSON + CSS/SCSS) stored or downloaded in a ZIP file.
- Hosted as static assets (e.g. Netlify).

##### Main components & relationships
a. Browser / Client (Angular SPA)
- UI Components:
– EditorComponent (text input for PlantUML code)
– DiagramComponent (renders image preview)
– NavbarComponent (theme selector, download/import buttons)
– TextAreaComponent (extended editor UI)
- Angular Module: AppModule + AppRoutingModule
- Services:
– GenerateService – orchestrates HTTP calls to PlantUML server
– ZipService – uses assets/lib/zip to package PNGs + metadata into a ZIP
– ImportExportService – unpacks imported ZIP into code + theme
– UtilityService & AutonumberService – helper logic
– JWTInterceptor – (configured but optional) intercepts HTTP for auth headers
b. External PlantUML Server
– Configurable via environment.ts
c. Hosting / Delivery
– Static asset host (e.g. Netlify, Dockerfile hints) serves index.html + bundle
d. Build Pipeline (Angular CLI & Webpack)
– Transpile TS → JS, bundle SCSS + assets, output /dist

##### Architectural patterns & design principles
- Component-Service separation (UI vs. business logic)
- Dependency Injection for services
- Single HTTP layer via interceptor
- Lazy loading (if added later) via Angular routing
- Asset bundling for third-party libs (zip-inflate/deflate)

##### Essential elements
- Angular module boundary
- Component → Service dependencies
- HTTP layer → external PlantUML server
- Client-side ZIP library integration
- Hosting layer that delivers the SPA
- Configurable environment switch for the render server

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Angular SPA"
        subgraph "Presentation Layer"
            Editor["EditorComponent"]:::frontend
            Diagram["DiagramComponent"]:::frontend
            Navbar["NavbarComponent"]:::frontend
            TextArea["TextAreaComponent"]:::frontend
        end
        subgraph "Service Layer"
            Generate["GenerateService"]:::frontend
            Styling["StylingService"]:::frontend
            Zip["ZipService"]:::frontend
            ImportExport["ImportExportService"]:::frontend
            Utility["UtilityService"]:::frontend
            Autonumber["AutonumberService"]:::frontend
            JWTInt["JWTInterceptor"]:::frontend
            Env["Environment Config"]:::frontend
        end
    end

    PlantUMLServer["PlantUML Render Server"]:::backend
    AssetLib["ZIP Library Assets"]:::local
    Download["Download (File System)"]:::local
    Netlify["Netlify / Static Host"]:::local

    Editor --> Generate
    Navbar --> Styling
    Navbar --> Zip
    Navbar --> ImportExport
    TextArea --> Utility
    Generate --> JWTInt
    Generate -->|"renderRequest(code)"| PlantUMLServer
    PlantUMLServer -->|"renderResult(SVG)"| Generate
    Generate -->|"renderResult"| Diagram
    Styling -->|"applyTheme(css)"| Diagram
    Zip --> AssetLib
    Zip -->|"packageZIP()"| Download
    ImportExport --> AssetLib
    ImportExport -->|"unpackZIP()"| Editor
    ImportExport -->|"applyTheme()"| Styling
    Env --> Generate
    Netlify -->|"serves bundle"| Editor

    click Editor "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/components/editor/editor.component.ts"
    click Diagram "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/components/diagram/diagram.component.ts"
    click Navbar "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/components/navbar/navbar.component.ts"
    click TextArea "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/components/text-area/text-area.component.ts"
    click Generate "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/services/generate.service.ts"
    click Styling "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/services/styling.service.ts"
    click Zip "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/services/zip.service.ts"
    click ImportExport "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/services/importexport.service.ts"
    click Utility "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/services/utility.service.ts"
    click Autonumber "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/services/autonumber.service.ts"
    click JWTInt "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/app/core/helpers/jwt.interceptor.ts"
    click AssetLib "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/assets/lib/zip/deflatezip.js"
    click AssetLib "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/assets/lib/zip/inflate.js"
    click AssetLib "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/assets/lib/zip/zip.js"
    click AssetLib "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/assets/lib/zip/z-worker.js"
    click Env "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/environments/environment.ts"
    click Env "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/environments/environment.prod.ts"
    click Netlify "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/index.html"
    click Netlify "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/main.ts"
    click Netlify "https://github.com/isaaceindhoven/plantuml-styler/blob/master/src/styles.scss"

    classDef frontend fill:#cce5ff,stroke:#004085
    classDef backend fill:#d4edda,stroke:#155724
    classDef local fill:#fff3cd,stroke:#856404
```
