# didouougha/tariki architecture

> Architecture diagram of the GitHub repository didouougha/tariki, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/didouougha/tariki
- Repository: https://github.com/didouougha/tariki

## Overview

1. **Project shape**
   This repository is a **static front-end application** with a small set of ES module scripts and a build-time CSS pipeline. The app is centered around a single `index.html` entry point and is meant to run in the browser, then be deployed as static assets on **Cloudflare Pages**.

2. **Entry point and UI composition**
   `index.html` is the shell that wires the whole experience together: page layout, map container, alert areas, and script/style inclusion. There is no server-rendered backend in this repo; all dynamic behavior happens client-side.

3. **Styling subsystem**
   Styling is split between:
   - `src/input.css` as the Tailwind v4 source/input file
   - `assets/css/style.css` as the generated output consumed by the page  
   This indicates a build step that compiles utility-first CSS into a browser-ready stylesheet, reducing runtime styling complexity.

4. **JavaScript module boundaries**
   The front-end logic is intentionally separated into small modules under `assets/js/`:
   - `main.js` is the application bootstrap/orchestration layer
   - `ui.js` handles DOM updates and interface state
   - `map.js` owns map initialization and map-specific rendering
   - `api.js` is the data-access layer for fetching external content  
   This is the main architectural boundary in the repo: presentation, map behavior, and remote-data access are decoupled.

5. **Map subsystem**
   `map.js` is the dedicated mapping layer. Per the README, it uses **Leaflet.js** with **OpenStreetMap** tiles and custom marker/icon rendering for traffic-related conditions such as accidents, roadworks, and weather events. This subsystem is likely responsible for translating data records into map overlays and marker state.

6. **Live alerts / external data subsystem**
   `api.js` is the boundary to external live content. The README says the app fetches updates from the official Facebook page via a **Cloudflare Worker** that acts as an RSS-to-JSON proxy and CORS-safe endpoint. In architecture terms, the browser never talks directly to the source feed; it consumes a normalized API provided by the worker.

7. **Data flow through the app**
   The runtime flow is:
   external traffic/news source → Cloudflare Worker proxy → `api.js` fetches JSON → `main.js` coordinates updates → `ui.js` renders alerts/news ticker and sidebar → `map.js` updates map markers/overlays.  
   This is the key end-to-end pipeline to capture in an architecture diagram.

8. **Client-side orchestration**
   `main.js` appears to be the integration point that ties together the other modules after page load. It likely initializes the map, triggers data fetches, and schedules UI refreshes or periodic updates. This makes it the central runtime coordinator, but not a data or rendering layer itself.

9. **Browser/runtime constraints**
   The project relies on **ES6 modules**, which is why the README notes running it through a local server rather than opening files directly. The app is therefore browser-native and static, but still depends on HTTP delivery for module loading.

10. **Build and packaging boundary**
   `package.json` and `package-lock.json` define the Node-based tooling used only for development/building, not for runtime serving logic. The main build artifact of interest is the compiled CSS in `assets/css/style.css`; the rest of the site is shipped as static HTML, JS, and assets.

11. **Infrastructure boundary**
   The only backend-like component is external to this repo: **Cloudflare Workers**. That worker exists to normalize third-party data and avoid CORS issues. Cloudflare Pages serves the front-end, but there is no in-repo application server or database.

12. **What to show in an architecture diagram**
   A clear diagram would have:
   - Browser/client as the main runtime
   - Static assets originating from this repo
   - A CSS build pipeline feeding `assets/css/style.css`
   - A modular JS layer with `main.js` coordinating `ui.js`, `map.js`, and `api.js`
   - An external worker/API boundary for live alerts
   - Leaflet/OpenStreetMap as the map rendering dependency
   - Cloudflare Pages as the static hosting target

Main entry points: [`assets/js/main.js`](https://github.com/didouougha/tariki/blob/main/assets/js/main.js) (main.js), [`assets/js/map.js`](https://github.com/didouougha/tariki/blob/main/assets/js/map.js) (map.js), [`index.html`](https://github.com/didouougha/tariki/blob/main/index.html) (index.html), [`assets/js/api.js`](https://github.com/didouougha/tariki/blob/main/assets/js/api.js) (api.js)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_browser["Browser app"]
  node_main_js["main.js<br/>runtime orchestrator<br/>[main.js]"]
  node_ui_js["ui.js<br/>ui renderer<br/>[ui.js]"]
  node_map_js["map.js<br/>map layer<br/>[map.js]"]
  node_api_js["api.js<br/>data client<br/>[api.js]"]
end

subgraph group_grp_frontend["Repo assets"]
  node_index_html["index.html<br/>entry shell<br/>[index.html]"]
  node_style_css["style.css<br/>compiled css<br/>[style.css]"]
end

subgraph group_grp_build["Build toolchain"]
  node_input_css["input.css<br/>tailwind source<br/>[input.css]"]
  node_package_json["package.json<br/>tooling manifest<br/>[package.json]"]
end

subgraph group_grp_external["External services"]
  node_leaflet["Leaflet<br/>mapping library"]
  node_osm["OpenStreetMap<br/>tile service"]
  node_worker_api["Worker API<br/>cloudflare worker"]
  node_cloudflare_pages["Pages<br/>static hosting"]
end

node_index_html -->|"loads"| node_style_css
node_index_html -->|"boots"| node_main_js
node_main_js -->|"coordinates"| node_ui_js
node_main_js -->|"coordinates"| node_map_js
node_main_js -->|"fetches"| node_api_js
node_api_js -->|"requests"| node_worker_api
node_worker_api -.->|"normalizes data"| node_osm
node_map_js -->|"uses"| node_leaflet
node_map_js -->|"tiles"| node_osm
node_main_js -->|"renders alerts"| node_ui_js
node_main_js -->|"updates markers"| node_map_js
node_input_css -->|"builds into"| node_style_css
node_package_json -->|"builds"| node_input_css
node_cloudflare_pages -->|"hosts"| node_index_html

click node_index_html "https://github.com/didouougha/tariki/blob/main/index.html"
click node_main_js "https://github.com/didouougha/tariki/blob/main/assets/js/main.js"
click node_ui_js "https://github.com/didouougha/tariki/blob/main/assets/js/ui.js"
click node_map_js "https://github.com/didouougha/tariki/blob/main/assets/js/map.js"
click node_api_js "https://github.com/didouougha/tariki/blob/main/assets/js/api.js"
click node_style_css "https://github.com/didouougha/tariki/blob/main/assets/css/style.css"
click node_input_css "https://github.com/didouougha/tariki/blob/main/src/input.css"
click node_package_json "https://github.com/didouougha/tariki/blob/main/package.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_js,node_ui_js,node_map_js,node_api_js toneBlue
class node_index_html,node_style_css toneAmber
class node_input_css,node_package_json toneMint
class node_leaflet,node_osm,node_worker_api,node_cloudflare_pages toneRose
```

## Components

### Browser app

Client-side runtime and UI composition.

- [main.js](https://github.com/didouougha/tariki/blob/main/assets/js/main.js): runtime orchestrator · Bootstraps the app and coordinates data, UI, and map updates. · `assets/js/main.js`
- [ui.js](https://github.com/didouougha/tariki/blob/main/assets/js/ui.js): ui renderer · Updates alerts, sidebar state, and other DOM-facing interface pieces. · `assets/js/ui.js`
- [map.js](https://github.com/didouougha/tariki/blob/main/assets/js/map.js): map layer · Initializes Leaflet map behavior and renders markers/overlays. · `assets/js/map.js`
- [api.js](https://github.com/didouougha/tariki/blob/main/assets/js/api.js): data client · Fetches normalized live content from the external proxy endpoint. · `assets/js/api.js`

### Repo assets

Static HTML, styles, and browser modules shipped from the repository.

- [index.html](https://github.com/didouougha/tariki/blob/main/index.html): entry shell · Single-page document that wires layout, styles, and scripts. · `index.html`
- [style.css](https://github.com/didouougha/tariki/blob/main/assets/css/style.css): compiled css · Browser-ready stylesheet generated from the Tailwind source. · `assets/css/style.css`

### Build toolchain

Node-based styling pipeline and packaging support.

- [input.css](https://github.com/didouougha/tariki/blob/main/src/input.css): tailwind source · Authoring source for the CSS build pipeline. · `src/input.css`
- [package.json](https://github.com/didouougha/tariki/blob/main/package.json): tooling manifest · Defines Node-based development and build tooling. · `package.json`

### External services

Hosting, mapping, and live-data dependencies outside the repo.

- **Leaflet**: mapping library · Client-side map rendering dependency used by the map subsystem.
- **OpenStreetMap**: tile service · Map tile source consumed by the Leaflet map.
- **Worker API**: cloudflare worker · External RSS-to-JSON proxy that normalizes live alerts and avoids CORS issues.
- **Pages**: static hosting · Deployment target for the static front-end assets.

## Connections

- index.html → style.css: loads · The HTML shell includes the compiled stylesheet.
- index.html → main.js: boots · The entry page loads the application bootstrap module.
- main.js → ui.js: coordinates · Main orchestrates interface updates through the UI module.
- main.js → map.js: coordinates · Main initializes and refreshes the mapping subsystem.
- main.js → api.js: fetches · Main triggers data retrieval through the API client.
- api.js → Worker API: requests · Browser code consumes the normalized external endpoint.
- Worker API → OpenStreetMap: normalizes data · External worker proxies live source information into app-ready JSON.
- map.js → Leaflet: uses · Map behavior is implemented on top of Leaflet.
- map.js → OpenStreetMap: tiles · Leaflet map renders against OpenStreetMap tiles.
- main.js → ui.js: renders alerts · Main drives alert and ticker refreshes through UI rendering.
- main.js → map.js: updates markers · Main passes new live data into map overlays and marker state.
- input.css → style.css: builds into · Tailwind source is compiled into the browser-ready stylesheet.
- package.json → input.css: builds · Project tooling manages the CSS build pipeline.
- Pages → index.html: hosts · Static site hosting serves the repository's browser assets.
