# adrienm7/ergopti architecture

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

- Interactive diagram: https://gitdiagram.com/adrienm7/ergopti
- Repository: https://github.com/adrienm7/ergopti

## Overview

##### Main Components
- Frontend Application – Built with SvelteKit using Svelte components. The application’s UI is organized into routes (under src/routes) for pages such as accueil, benchmarks, ergopti-plus, informations, and telechargements.
- UI Component Library – Under src/lib, you have:
- The “clavier” module: Svelte components and helper JavaScript modules (e.g., BlocClavier.svelte, EmulationClavier.svelte, Clavier.js, getData.js) that create the keyboard matrices and handle dynamic generation based on JSON configurations.
- General components (composants folder) for header, footer, naming elements, etc.
- Data & Layout Configurations – Several JSON files (like characterFrequencies.json and remplacementsMagique.json) and a vast collection of static disposition files, benchmarks, and corpus data under the static folder provide the raw data and configuration for the keyboard layouts.
- Build & Deployment Tools – The configuration files (svelte.config.js, vite.config.js, ESLint/Prettier configurations, and GitHub workflows under .github/workflows) indicate automated testing, development, and deployment pipelines.

##### Relationships and Interactions
- The SvelteKit routing system (src/routes) acts as the entry point where end users navigate different pages. Each route interacts with the UI components defined in src/lib.
- The keyboard generation logic (in src/lib/clavier) reads data from JSON files and applies the keyboard matrix algorithms to dynamically fill the 16×7 grid based on factors like the chosen layer, AltGr configuration, and additional Ergopti+ features.
- Static assets (images, PDF benchmarks, and disposition JSONs) are served from the static folder and are used by the UI to show visual examples, documentation, and download links.
- Deployment mechanisms (GitHub workflows and build scripts) orchestrate the processes of building, previewing, and deploying the production version of the site.

##### Architectural Patterns and Design Principles
- Component-Based UI Architecture – The project follows component separation with reusable Svelte components (for instance, separate files for keyboard blocks and control elements) that improve modularity and maintainability.
- Data-Driven Rendering – The keyboard is generated dynamically using JSON configuration files. This separation of data from layout logic is critical, as explained in the README.
- Integration of Static and Dynamic Assets – The system cleanly separates front-end routes, static assets (fonts, images, benchmark data), and the configuration of keyboard layouts.

##### Technologies, Frameworks, and Libraries
- Svelte and SvelteKit: For building the reactive UI and managing routes.
- Vite: As the build tool bundler for fast development.
- ESLint and Prettier: For code quality and style enforcement.
- Node Package Manager (npm, pnpm, yarn): For dependency management.

##### Final Recommendations
- Data input (JSON configurations, corpus, and dispositions) and data output (rendered keyboard layout and downloadable assets) are clearly represented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Application"
        FT("SvelteKit Routes"):::frontend
    end

    %% UI Components Layer
    subgraph "UI Components"
        CM("Clavier Module"):::component
        GC("General Components"):::component
        CSS("CSS Styling"):::component
        ICON("Icons"):::component
    end

    %% Data & Layout Configurations Layer
    subgraph "Data & Layout Configurations"
        DATA1("characterFrequencies.json"):::data
        DATA2("remplacementsMagique.json"):::data
        STATIC1("Dispositions"):::data
        STATIC2("Benchmarks"):::data
        STATIC3("Corpus"):::data
    end

    %% Build & Deployment Pipeline
    subgraph "Build & Deployment Pipeline"
        DEP1("svelte.config.js"):::deployment
        DEP2("vite.config.js"):::deployment
        DEP3("GitHub Workflows"):::deployment
    end

    %% Relationships
    FT -->|"renders"| CM
    FT -->|"renders"| GC
    FT -->|"includes"| CSS
    FT -->|"includes"| ICON

    CM -->|"reads"| DATA1
    CM -->|"reads"| DATA2
    CM -->|"utilizes"| STATIC1
    CM -->|"utilizes"| STATIC2
    CM -->|"utilizes"| STATIC3

    %% Data flow note from static configurations to UI components
    DATA1 ---|"data input"| CM
    DATA2 ---|"data input"| CM
    STATIC1 ---|"asset"| CM
    STATIC2 ---|"asset"| CM
    STATIC3 ---|"asset"| CM

    %% Deployment influences application build
    DEP1 ---|"build config"| FT
    DEP2 ---|"build config"| FT
    DEP3 ---|"automates"| FT

    %% Click Events
    click FT "https://github.com/adrienm7/ergopti/tree/main/src/routes"
    click CM "https://github.com/adrienm7/ergopti/tree/main/src/lib/clavier"
    click GC "https://github.com/adrienm7/ergopti/tree/main/src/lib/composants"
    click CSS "https://github.com/adrienm7/ergopti/tree/main/src/lib/css"
    click ICON "https://github.com/adrienm7/ergopti/tree/main/src/lib/icons"
    click DATA1 "https://github.com/adrienm7/ergopti/blob/main/src/lib/clavier/characterFrequencies.json"
    click DATA2 "https://github.com/adrienm7/ergopti/blob/main/src/lib/clavier/remplacementsMagique.json"
    click STATIC1 "https://github.com/adrienm7/ergopti/tree/main/static/dispositions"
    click STATIC2 "https://github.com/adrienm7/ergopti/tree/main/static/benchmarks"
    click STATIC3 "https://github.com/adrienm7/ergopti/tree/main/static/corpus"
    click DEP1 "https://github.com/adrienm7/ergopti/blob/main/svelte.config.js"
    click DEP2 "https://github.com/adrienm7/ergopti/blob/main/vite.config.js"
    click DEP3 "https://github.com/adrienm7/ergopti/tree/main/.github/workflows"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,stroke-width:2px;
    classDef component fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef data fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;
    classDef deployment fill:#fce4ec,stroke:#c2185b,stroke-width:2px;
```
