# informatics-sa/website architecture

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

- Interactive diagram: https://gitdiagram.com/informatics-sa/website
- Repository: https://github.com/informatics-sa/website

## Overview

##### Project type and purpose
- This is a **static website** for the Saudi Informatics Team (SIT), implemented as a Jekyll-powered site with a pre-processing step.
- Its purpose is to preserve and display SIT history: olympiads, participations, members, images, and contact details in a static, easy-to-host format.

##### File structure
- Top level:
- build.py (Python preprocessing script)
- Gemfile / Gemfile.lock (Ruby/Jekyll dependencies)
- .github/workflows/jekyll-gh-pages.yml (CI/CD for GitHub Pages)
- lib/utils.py (supporting Python code)
- “root/”: the Jekyll source:
- _layouts/ & _includes/ (Liquid templates for pages)
- _config.yml (Jekyll config)
- data/ (JSON/YAML files—site’s public data)
- img/ & resources/ (static assets and JS)
- index.md, 404.html
- No traditional backend or database—data is flat‐file JSON fed into templates.

##### README for additional insights
- Build process:
1. `python build.py` transforms or validates data.
2. `jekyll serve -s ./root` generates and serves static HTML from templates + data.
- CI/CD: GitHub Actions deploys to GitHub Pages.

##### Main components
a. **Data Layer**
- JSON files under `root/data/` (olympiads.json, people.json, etc.)
b. **Preprocessing**
- `build.py` & `lib/utils.py` (Python) read/transform data, write back to `root/data/` or to other source files.
c. **Templating Engine**
- **Jekyll** (Ruby) and its Liqu­­id templates in `_layouts/` and `_includes/`.
- Uses `_config.yml` settings.
d. **Static Asset Layer**
- `root/img/` and `root/resources/` (CSS, JS).
e. **CI/CD Pipeline**
- `.github/workflows/jekyll-gh-pages.yml`: on push → run `build.py` → install Ruby gems → run `jekyll build` → push `_site` to `gh-pages`.
f. **Hosting**
- GitHub Pages serves the generated static site.

##### Relationships and data flows
- **Developer Machine** → push code → **GitHub** → triggers **GitHub Actions**.
- **GitHub Actions**:
1. Check out repo
2. Run `python build.py` (data preprocessing).
3. Run `bundle install` & `jekyll build` (template rendering + static asset bundling).
4. Deploy output (`_site`) to GitHub Pages.
- **End-user Browser** requests pages from **GitHub Pages**.

##### Architectural patterns and principles
- **Static Site Generator**: strict separation of data, templates, and assets.
- **Pipeline Pattern**: Python step → Jekyll step → deploy step.
- **Convention over Configuration** via Jekyll’s file-naming and folder structure.

##### Technologies, frameworks, and libraries
- Python 3.x (`build.py`)
- Ruby + Jekyll (Liquid templating)
- Bundler (manages Jekyll dependencies)
- GitHub Actions (CI/CD)
- Flat JSON data (no dynamic server or database)

##### Essential elements
- Clear component names (Data Store, Preprocessor, Template Engine, CI/CD, Hosting)
- Optional zoom-in for “root/” folder structure (data vs. templates vs. assets)

- the static site generation pipeline,
- separation of concerns (data vs. templates vs. build tooling),
- CI/CD deployment flow, and
- the absence of a traditional dynamic server or database.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Developer["Developer Machine"]:::external
    GitHub["GitHub Repository"]:::external
    Developer -->|"push code"| GitHub

    subgraph CI/CD Pipeline
        Workflow["GitHub Actions Workflow"]:::cicd
        Checkout["Checkout Code"]:::cicd
        BuildPy["Python Preprocessing (build.py)"]:::processing
        JekyllDeps["Install Bundler Gems"]:::processing
        JekyllBuild["Jekyll Build"]:::processing
        Deploy["Deploy to GitHub Pages"]:::cicd
        Workflow --> Checkout --> BuildPy --> JekyllDeps --> JekyllBuild --> Deploy
    end
    GitHub -->|triggers| Workflow

    subgraph "Data & Source Files"
        Data["root/data/"]:::data
        BuildScript["build.py"]:::processing
        Utils["lib/utils.py"]:::processing
        Layouts["root/_layouts/"]:::templating
        Includes["root/_includes/"]:::templating
        Config["root/_config.yml"]:::templating
        Img["root/img/"]:::assets
        Resources["root/resources/"]:::assets
        Gemfile["Gemfile"]:::deps
        GemfileLock["Gemfile.lock"]:::deps
    end

    Checkout --> Data
    BuildPy --> Data
    BuildPy --> Utils
    JekyllDeps --> Gemfile
    JekyllDeps --> GemfileLock
    JekyllBuild --> Layouts
    JekyllBuild --> Includes
    JekyllBuild --> Config
    JekyllBuild --> Img
    JekyllBuild --> Resources

    subgraph Hosting
        Pages["GitHub Pages"]:::hosting
    end
    Deploy --> Pages
    Pages -->|"serves static site"| Browser["End-user Browser"]:::external

    click Data "https://github.com/informatics-sa/website/tree/main/root/data/"
    click BuildScript "https://github.com/informatics-sa/website/blob/main/build.py"
    click Utils "https://github.com/informatics-sa/website/blob/main/lib/utils.py"
    click Layouts "https://github.com/informatics-sa/website/tree/main/root/_layouts/"
    click Includes "https://github.com/informatics-sa/website/tree/main/root/_includes/"
    click Config "https://github.com/informatics-sa/website/blob/main/root/_config.yml"
    click Img "https://github.com/informatics-sa/website/tree/main/root/img/"
    click Resources "https://github.com/informatics-sa/website/tree/main/root/resources/"
    click Workflow "https://github.com/informatics-sa/website/blob/main/.github/workflows/jekyll-gh-pages.yml"
    click Gemfile "https://github.com/informatics-sa/website/tree/main/Gemfile"
    click GemfileLock "https://github.com/informatics-sa/website/blob/main/Gemfile.lock"

    classDef data fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef processing fill:#d4edda,stroke:#333,stroke-width:1px
    classDef templating fill:#d1ecf1,stroke:#333,stroke-width:1px
    classDef assets fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef deps fill:#f8d7da,stroke:#333,stroke-width:1px
    classDef cicd fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef hosting fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef external fill:#f5f5f5,stroke:#333,stroke-width:1px
```
