# quincy-dev/ukur-jarak architecture

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

- Interactive diagram: https://gitdiagram.com/quincy-dev/ukur-jarak
- Repository: https://github.com/quincy-dev/ukur-jarak

## Overview

##### Project type and purpose
- This is a lightweight, single-page web application (SPA) focused on client-side rendering.
- It provides an interactive UI to calculate distances between two cities by consuming an external distance API.

##### File structure
- Top-level files:
- index.html – the sole entry point (contains HTML skeleton + links to styles and scripts)
- README.md – documentation
- LICENSE – MIT license
- No backend or server code in the repo → everything runs in the user’s browser

##### README for additional insights
- UI built with HTML5, CSS3 (including animations/transitions), and vanilla JavaScript
- External API endpoint: https://aemt.uk.to/jarak (GET, returns JSON with map URL and text description)
- Responsiveness + dark-mode styling + interactive animations (fadeIn, zoom-in, glow)

a. **Main Components**
1. User’s Browser (Client UI)
– index.html (markup)
– styles.css (modern, responsive, animations)
– script.js (logic to read inputs, fetch API, render results)
2. Static Asset Host
– GitHub Pages / Netlify / S3 bucket (serves index.html, CSS, JS, any assets/)
3. External Distance API
– Endpoint: https://aemt.uk.to/jarak
– Returns JSON containing status, data URL, and textual description
4. /Image CDN (if separate from API)
– Hosts the returned map image (e.g., aemt.uk.to/file/…)
b. **Relationships & Data Flows**
1. Browser requests index.html + CSS + JS from Static Host
2. User enters “origin” & “destination” → script.js issues HTTPS GET to External API
3. External API responds with JSON containing map URL & descriptive text
4. Browser fetches the map image from CDN (the URL in the JSON)
5. script.js updates the DOM: displays distance text + map with fadeIn/zoom animations
c. **Architectural Patterns & Principles**
- **Client-heavy/Thin-server**: All application logic and rendering happen client-side
- **Separation of Concerns**:
- UI/UX layer (HTML/CSS)
- Application logic layer (JS)
- Data layer (External API)
- **Decoupling**: The static host and the external API are independent services
d. **Key Technologies**
- HTML5, CSS3 (Flexbox/Grid, animations)
- Vanilla JavaScript (Fetch API or XMLHttpRequest)
- External REST API (JSON over HTTPS)
- (Optional) CDN or static-file hosting service

##### Additional Details to Capture
- **Responsiveness**: note the CSS media-query layer
- **Animation Layer**: annotate where fadeIn/zoom/glow effects occur in the client

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser and UI Components
    Browser(("User's Browser")):::client
    subgraph "Client UI"
        BrowserHTML["index.html"]:::client
        BrowserCSS["styles.css"]:::client
        BrowserJS["script.js"]:::client
    end

    %% Hosting Infrastructure
    StaticHost["Static Asset Host"]:::hosting
    README["README.md"]:::hosting
    LICENSENode["LICENSE"]:::hosting

    %% External Services
    API["External Distance API\n(GET /jarak)"]:::external
    CDN["Map/Image CDN"]:::external

    %% Data Flows
    Browser -->|"GET index.html, CSS, JS"| StaticHost
    StaticHost -->|"serves files"| Browser
    Browser -->|"loads HTML/CSS/JS"| BrowserHTML
    Browser -->|"loads HTML/CSS/JS"| BrowserCSS
    Browser -->|"loads HTML/CSS/JS"| BrowserJS

    BrowserJS -->|"GET /jarak?from=X&to=Y (GET JSON)"| API
    API -->|"JSON response\n(map URL + text)"| BrowserJS

    Browser -->|"GET map.png URL (GET PNG)"| CDN
    CDN -->|"serves image"| Browser

    %% Documentation Links
    StaticHost --> README
    StaticHost --> LICENSENode

    %% Click Events
    click BrowserHTML "https://github.com/quincy-dev/ukur-jarak/blob/main/index.html"
    click README "https://github.com/quincy-dev/ukur-jarak/blob/main/README.md"
    click LICENSENode "https://github.com/quincy-dev/ukur-jarak/tree/main/LICENSE"

    %% Styles
    classDef client fill:#add8e6,stroke:#000,stroke-width:1px
    classDef hosting fill:#98fb98,stroke:#000,stroke-width:1px
    classDef external fill:#ffa500,stroke:#000,stroke-width:1px
```
