How quincy-dev/ukur-jarak works
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