Core Architecture Principles
Modular Design
Separate modules for distinct features (globe, form, gallery)
No Build Step
Pure vanilla JavaScript - no transpilation or bundling
Static Hosting
Deployed on GitHub Pages as static HTML/CSS/JS
Real-Time Data
Supabase backend for data storage and retrieval
Application Flow
The application follows a straightforward initialization and rendering pipeline:app.js
Page Load
HTML loads and initializes the DOM structure with the globe container, form, and gallery elements.
Script Loading
External libraries load first (Bootstrap, Supabase, Globe.gl, TopoJSON), followed by data files (i18n, constants, ISO tables, countries), then modules, and finally app.js.
State Initialization
Global state variables are initialized in
modules/state.js including allMates[], countriesColored[], and countriesGeo[].Data Fetching
loadMates() fetches approved mate submissions from Supabase and triggers rendering functions.Module System
The application is divided into eight distinct modules, each with a specific responsibility:Data Flow Diagram
State Management
All global application state is centralized inmodules/state.js:
state.js
The state module uses
let declarations to allow updates from any module. While this creates global mutable state, it keeps the architecture simple and avoids the complexity of a state management library.Rendering Pipeline
1. Polygon Rendering
Countries are colored based on whether they have mate submissions:globe.js:74
2. Marker Rendering with Jitter
Mate markers are dispersed using a jitter algorithm to prevent overlap:globe.js:103
3. Arc Animation System
Arcs connect consecutive mate submissions in an animated sequence:globe.js:192
Performance Considerations
Debounced Rendering
Debounced Rendering
Polygon rendering is debounced with a 60ms timeout to prevent excessive redraws during rapid state changes.
Marker Caching
Marker Caching
Markers are only re-rendered when the
lastMarkerIds cache key changes, preventing unnecessary DOM manipulation.Arc Intervals
Arc Intervals
Only one arc is rendered at a time, cycling through connections every 2.5 seconds to minimize GPU load.
Auto-Refresh Strategy
Auto-Refresh Strategy
Data refreshes every 30 seconds using
setInterval, striking a balance between freshness and server load.Technology Stack
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Vanilla JavaScript | Core application logic |
| 3D Globe | Globe.gl | WebGL-based globe visualization |
| UI Framework | Bootstrap 5.3 | Responsive layout and components |
| Backend | Supabase | PostgreSQL database + auth + storage |
| Geo Data | World Atlas TopoJSON | Country boundaries |
| Hosting | GitHub Pages | Static site deployment |
| Fonts | DM Sans (Google Fonts) | Typography |
Next Steps
Module Details
Explore each module’s functions and responsibilities
Globe Visualization
Deep dive into the Globe.gl integration
Data Structures
Understand the data models and formats
Supabase Integration
Learn about the backend setup