# ianthebaptist/tut_staic_lenin architecture

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

- Interactive diagram: https://gitdiagram.com/ianthebaptist/tut_staic_lenin
- Repository: https://github.com/ianthebaptist/tut_staic_lenin

## Overview

##### Project Type and Purpose
- This is a pure front-end, static interactive map application (“tut_staic_lenin”) that displays geo-referenced photos of Lenin monuments in Belarus.
- There is no server-side code or database—everything is delivered as static assets (HTML, CSS, JS, GeoJSON, and image files) and hosted (e.g., via GitHub Pages).

##### Main Components
a. Client Browser
- Renders index.html, style.css, script.js
- Runs MapLibre GL JS to display the map and interactivity
- Loads and parses monuments.geojson
- Displays monument details and invokes a lightbox for photos
b. Static Asset Host
- Serves index.html, style.css, script.js, monuments.geojson, and photos/ folder
- Could be GitHub Pages, Netlify, S3, etc.
c. External Tile Service
- Provides map tiles (e.g., OpenStreetMap / MapTiler / MapLibre-compatible tiles)
- MapLibre fetches raster/vector tiles at runtime
d. Data Store (Static Files)
- monuments.geojson (feature collection of monument locations and metadata)
- photos/ (JPEG/PNG images referenced by GeoJSON properties)

##### Relationships & Data Flow
1. Browser → Asset Host : GET index.html, CSS, JS
2. Browser → Asset Host : GET monuments.geojson
3. Browser → Asset Host : GET photos when a popup/lightbox is opened
4. Browser → External Tile Service : GET map tiles as user pans/zooms
5. script.js (client logic) parses geojson, adds markers, listens for click events → injects photo URLs into the sidebar/lightbox

##### Architectural Patterns & Principles
- Client-Side Rendering: All UI and data processing happens in the browser.
- Static Hosting: No application server or database.
- Separation of Concerns:
- index.html for structure
- style.css for layout and responsive styles
- script.js for map logic and event handling
- Progressive Enhancement: The map is functional in modern browsers; fallback or basic content could appear if JS fails.

##### Technologies & Libraries
- HTML5, CSS3, JavaScript (ES6+)
- MapLibre GL JS for map rendering
- GeoJSON for spatial data
- Webmanifest for PWA metadata (photos/site.webmanifest)
- GitHub Pages (or equivalent) for hosting

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser Zone
    subgraph "Client Browser"
        direction TB
        ML["MapLibre GL JS"]:::client
        GP["GeoJSON Parser"]:::client
        LB["Lightbox UI"]:::client
    end

    Browser["Client Browser"]:::client

    %% Static Asset Host Zone
    subgraph "Static Asset Host"
        direction TB
        HTML["index.html"]:::host
        CSS["style.css"]:::host
        JS["script.js"]:::host
        GEO["monuments.geojson"]:::data
        PH["photos/"]:::folder
        WM["site.webmanifest"]:::host
    end

    %% External Tile Service Zone
    subgraph "External Tile Service"
        direction TB
        Tile["/tiles/{z}/{x}/{y}.pbf"]:::external
    end

    %% Data Flow Connections
    Browser -->|"GET index.html"| HTML
    Browser -->|"GET style.css"| CSS
    Browser -->|"GET script.js"| JS
    Browser -->|"GET monuments.geojson"| GEO
    Browser -->|"GET photo when opened"| PH
    Browser -->|"GET /tiles/{z}/{x}/{y}.pbf"| Tile

    %% Client logic sequence
    JS -->|"initializes"| ML
    JS -->|"parses data"| GP
    JS -->|"opens photos"| LB

    %% Click Events
    click HTML "https://github.com/ianthebaptist/tut_staic_lenin/blob/main/index.html"
    click CSS "https://github.com/ianthebaptist/tut_staic_lenin/blob/main/style.css"
    click JS "https://github.com/ianthebaptist/tut_staic_lenin/blob/main/script.js"
    click GEO "https://github.com/ianthebaptist/tut_staic_lenin/blob/main/monuments.geojson"
    click PH "https://github.com/ianthebaptist/tut_staic_lenin/tree/main/photos/"
    click WM "https://github.com/ianthebaptist/tut_staic_lenin/blob/main/photos/site.webmanifest"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#333,stroke-width:1px;
    classDef host fill:#DFFFE0,stroke:#333,stroke-width:1px;
    classDef external fill:#FFE5CC,stroke:#333,stroke-width:1px;
    classDef data fill:#F0F0F0,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef folder fill:#F8F8F0,stroke:#333,stroke-width:1px;
```
