# green-software-foundation/learn architecture

> Architecture diagram of the GitHub repository green-software-foundation/learn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/green-software-foundation/learn
- Repository: https://github.com/green-software-foundation/learn

## Overview

##### Project type and purpose
- This is a static documentation website built with Docusaurus (a React-based static site generator).
- Purpose: Serve the “Green Software Training” course content, with multi-language support, custom React components, and CI/CD deployment to a static host.

##### File structure
- Top-level:
- docs/ – Markdown content (training modules)
- i18n/ – Translation files for each locale
- src/ – React-based UI components and CSS for custom features (HomepageFeatures, Quiz, TeamMember) and theme overrides under src/theme
- static/ – Static assets: images, CNAME for custom domain
- docusaurus.config.js, sidebars.js, babel.config.js, tsconfig.json – site configuration, routing/sidebars, build tooling
- .github/workflows/deploy-main.yml – CI/CD pipeline for building & deploying on main branch
- package.json, yarn.lock – dependencies and scripts

##### README for additional insights
- Confirms use of Docusaurus for SSG, Node.js and Yarn in local dev.
- Local workflow: `yarn install` → `yarn run docusaurus start` → live preview.
- Production build: `yarn run docusaurus build` → static output → deployed via GitHub Actions.

##### Main components
a. Content sources
- Markdown docs (docs/)
- Translations (i18n/)
b. Custom UI layer
- React components (src/components/)
- Theme overrides (src/theme/)
c. Configuration layer
- docusaurus.config.js (site metadata, plugins)
- sidebars.js (navigation)
- babel.config.js, tsconfig.json (build tooling)
d. Build system
- Docusaurus CLI & Webpack (bundles React + Markdown into static HTML/CSS/JS)
e. CI/CD pipeline
- GitHub Actions workflow (deploy-main.yml)
- Steps: checkout → yarn install → build → deploy
f. Hosting
- Static site hosting (GitHub Pages or other CDN)
- CNAME file for custom domain
g. End users
- Web browsers requesting pages/assets

##### Relationships & data flow
- Local dev: edits docs, i18n, React components → Docusaurus start → local server → browser.
- On push to main:
1) GitHub Actions triggers on main branch
2) Checkout code, install dependencies
3) Run `docusaurus build` → produce static assets in build/
4) Deploy to static host (e.g., GitHub Pages)
- End users’ browsers fetch static assets via CDN/domain

##### Architectural patterns/design principles
- Jamstack (pre-rendered static assets, CDN distribution)
- Component-based UI (React)
- Markdown-driven content with plugin integration (Docusaurus)
- i18n pipeline (directory per locale, plugin)

##### Detail
- Docusaurus plugins and config files under “Configuration Layer.”
- Call out the custom React components under “Presentation Layer.”
- GitHub Actions workflow file under “CI/CD.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Content Layer
    subgraph "Content Layer"
        direction TB
        Docs["Markdown Docs\ndocs/"]:::content
        I18n["Translations\ni18n/"]:::content
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Components["UI Components\nsrc/components"]:::code
        subgraph "Components"
            direction TB
            HF["HomepageFeatures"]:::code
            Quiz["Quiz"]:::code
            TM["TeamMember"]:::code
        end
        Theme["Theme Overrides\nsrc/theme"]:::code
        subgraph "Theme Overrides"
            direction TB
            DocContent["DocItem Content Override"]:::code
        end
    end

    %% Configuration Layer
    subgraph "Configuration Layer"
        direction TB
        Config["docusaurus.config.js"]:::code
        Sidebars["sidebars.js"]:::code
        Babel["babel.config.js"]:::code
        TS["tsconfig.json"]:::code
        Pkg["package.json\n(Docusaurus CLI)"]:::code
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        Repo["GitHub Repo"]:::pipeline
        CI["GitHub Actions\ndeploy-main.yml"]:::pipeline
    end

    %% Build System
    DocusaurusBuild["Docusaurus Build\n(Docusaurus CLI & Webpack)"]:::build

    %% Hosting
    subgraph "Hosting & Delivery"
        direction TB
        CDN["Static CDN\n(GitHub Pages)"]:::hosting
        CNAME["CNAME\nstatic/CNAME"]:::hosting
        NoJekyll[".nojekyll\nstatic/.nojekyll"]:::hosting
    end

    %% End User
    User["End User Browser"]:::user

    %% Connections
    Docs --> DocusaurusBuild
    I18n --> DocusaurusBuild
    Components --> DocusaurusBuild
    HF --> DocusaurusBuild
    Quiz --> DocusaurusBuild
    TM --> DocusaurusBuild
    Theme --> DocusaurusBuild
    DocContent --> DocusaurusBuild
    Config --> DocusaurusBuild
    Sidebars --> DocusaurusBuild
    Babel --> DocusaurusBuild
    TS --> DocusaurusBuild
    Pkg --> DocusaurusBuild

    Repo --> CI
    CI --> DocusaurusBuild
    DocusaurusBuild --> CDN
    DocusaurusBuild --> CNAME
    DocusaurusBuild --> NoJekyll
    CDN --> User

    %% Click Events
    click Docs "https://github.com/green-software-foundation/learn/tree/main/docs/"
    click I18n "https://github.com/green-software-foundation/learn/tree/main/i18n/"
    click Components "https://github.com/green-software-foundation/learn/tree/main/src/components/"
    click HF "https://github.com/green-software-foundation/learn/blob/main/src/components/HomepageFeatures/index.tsx"
    click Quiz "https://github.com/green-software-foundation/learn/blob/main/src/components/Quiz/index.tsx"
    click TM "https://github.com/green-software-foundation/learn/blob/main/src/components/TeamMember/index.tsx"
    click Theme "https://github.com/green-software-foundation/learn/tree/main/src/theme/"
    click DocContent "https://github.com/green-software-foundation/learn/blob/main/src/theme/DocItem/Content/index.js"
    click Config "https://github.com/green-software-foundation/learn/blob/main/docusaurus.config.js"
    click Sidebars "https://github.com/green-software-foundation/learn/blob/main/sidebars.js"
    click Babel "https://github.com/green-software-foundation/learn/blob/main/babel.config.js"
    click TS "https://github.com/green-software-foundation/learn/blob/main/tsconfig.json"
    click Pkg "https://github.com/green-software-foundation/learn/blob/main/package.json"
    click CNAME "https://github.com/green-software-foundation/learn/tree/main/static/CNAME"
    click NoJekyll "https://github.com/green-software-foundation/learn/blob/main/static/.nojekyll"
    click CI "https://github.com/green-software-foundation/learn/blob/main/.github/workflows/deploy-main.yml"

    %% Styles
    classDef content fill:#e0f7e9,stroke:#2e7d32,color:#1b5e20
    classDef code fill:#cce5ff,stroke:#004085,color:#002752
    classDef pipeline fill:#ffe5b4,stroke:#ff8c00,color:#cc5500
    classDef hosting fill:#e5ccff,stroke:#6a0dad,color:#4b0082
    classDef build fill:#fff2cc,stroke:#b8860b,color:#8b6508
    classDef user fill:#f0f0f0,stroke:#616161,color:#212121
```
