# disic/numecodiag architecture

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

- Interactive diagram: https://gitdiagram.com/disic/numecodiag
- Repository: https://github.com/disic/numecodiag

## Overview

##### Main components
- Browser Environment – Represent the WebExtension running in the browser environment (e.g., Firefox, Chrome, Edge in the future).
- UI/Frontend (Popup Interface) – This component is built using Svelte. Note that under the src/ directory you have several UI components (e.g., App.svelte, About.svelte, AuditForm.svelte, Donut.svelte, Header.svelte, Navigation.svelte, Options.svelte, Results.svelte, Stats.svelte).
- Build System – This includes the NodeJS environment, package.json, package-lock.json, and rollup.config.js that compiles Svelte components into JavaScript.
- Public Resources – The public/ directory holds manifest files (manifest.json and manifest-chrome.json), the index.html file, and other necessary static assets. This folder represents what is loaded by the browser as part of the extension.
- Extension Manifest & Configuration – Represent the manifest files that specify how the extension integrates with the browser and its permissions.

##### Relationships and interactions
- The Build Process: Use the build system (NodeJS with NPM and Rollup) to compile the source Svelte components from the src/ directory into a final bundle that is deployed.
- UI Interaction: Within the browser, the extension’s popup (loaded via index.html from the public folder) calls the App.svelte component, which then orchestrates several subcomponents (e.g., AuditForm, Results, Stats). Illustrate data flow from user interaction (clicks, data entry) into these components.

##### Important architectural patterns and principles
- Component-Based Architecture: The Svelte frontend is divided into several modular UI components. Emphasize clear separation between view components (like Navigation, Header) and content-specific components (like Donut for visual presentation of results).
- Build & Deployment Separation: The use of a build configuration (rollup.config.js) indicates an organized separation between development (written in Svelte) and production (built static assets for the extension).
- Standards Compliance: The inclusion of standardized manifest files and adherence to WebExtension API conventions helps ensure cross-browser compatibility.

##### Relevancy of technologies and frameworks
- Svelte – Core framework for building reactive user interfaces.
- Rollup – Bundler responsible for compiling the Svelte code.
- NodeJS & NPM – For managing dependencies and executing the build process.
- Browser-specific WebExtension APIs – As dictated by the manifest files for integration with various browsers such as Firefox and Chrome.

– “Browser Environment (WebExtension)” for the deployment target.
– “UI/Frontend (Svelte Components)” with a nested list of individual components (App, Navigation, etc.).
– “Build System (NodeJS + Rollup)” indicating the build process.
– “Public Assets & Manifest Files” representing what is served to the browser.
– From user actions in the browser triggering the popup UI.
– From the build system processing source files into bundled output.
– From the manifest linking browser permissions and extension behavior to the compiled code.

## Diagram (Mermaid)

```mermaid
graph TD
    S["User"]:::user

    subgraph "UI/Frontend (Svelte Components)"
        A["src/App.svelte"]:::ui
        B["src/components/About.svelte"]:::ui
        C["src/components/AuditForm.svelte"]:::ui
        D["src/components/Donut.svelte"]:::ui
        E["src/components/Header.svelte"]:::ui
        F["src/components/Navigation.svelte"]:::ui
        G["src/components/Options.svelte"]:::ui
        H["src/components/Results.svelte"]:::ui
        I["src/components/Stats.svelte"]:::ui
    end

    subgraph "Build System (NodeJS + Rollup)"
        J["package.json"]:::build
        K["package-lock.json"]:::build
        L["rollup.config.js"]:::build
    end

    subgraph "Public Assets & Manifest Files"
        M["public/index.html"]:::public
        N["public/static"]:::public
        O["public/rgesn (v1.json)"]:::public
        P["public/manifest.json"]:::public
        Q["public/manifest-chrome.json"]:::public
    end

    subgraph "Browser Environment (WebExtension)"
        R["Browser Environment (WebExtension)"]:::browser
    end

    S -->|"interacts"| R
    A -->|"source"| J
    %% Representing that other UI components work in composition with App.svelte
    B --- A
    C --- A
    D --- A
    E --- A
    F --- A
    G --- A
    H --- A
    I --- A
    L -->|"bundles to"| M
    J --- K
    M -->|"loads_popup"| R
    P -->|"configures"| R
    Q -->|"configures"| R

    click A "https://github.com/disic/numecodiag/blob/main/src/App.svelte"
    click B "https://github.com/disic/numecodiag/blob/main/src/components/About.svelte"
    click C "https://github.com/disic/numecodiag/blob/main/src/components/AuditForm.svelte"
    click D "https://github.com/disic/numecodiag/blob/main/src/components/Donut.svelte"
    click E "https://github.com/disic/numecodiag/blob/main/src/components/Header.svelte"
    click F "https://github.com/disic/numecodiag/blob/main/src/components/Navigation.svelte"
    click G "https://github.com/disic/numecodiag/blob/main/src/components/Options.svelte"
    click H "https://github.com/disic/numecodiag/blob/main/src/components/Results.svelte"
    click I "https://github.com/disic/numecodiag/blob/main/src/components/Stats.svelte"
    click J "https://github.com/disic/numecodiag/blob/main/package.json"
    click K "https://github.com/disic/numecodiag/blob/main/package-lock.json"
    click L "https://github.com/disic/numecodiag/blob/main/rollup.config.js"
    click M "https://github.com/disic/numecodiag/blob/main/public/index.html"
    click N "https://github.com/disic/numecodiag/tree/main/public/static"
    click O "https://github.com/disic/numecodiag/tree/main/public/rgesn"
    click P "https://github.com/disic/numecodiag/blob/main/public/manifest.json"
    click Q "https://github.com/disic/numecodiag/blob/main/public/manifest-chrome.json"

    classDef ui fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef build fill:#ffe082,stroke:#f57f17,stroke-width:2px;
    classDef public fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef browser fill:#f8bbd0,stroke:#c2185b,stroke-width:2px;
    classDef user fill:#ffccbc,stroke:#d84315,stroke-width:2px;
```
