Skip to content

Architecture & Tech Stack

SpaceEngineerSS edited this page Dec 29, 2025 · 2 revisions

Architecture & Tech Stack πŸ—οΈ

OrbitView is designed for high performance and scientific accuracy. Here is an overview of the technical components and architecture.

πŸ› οΈ Technology Stack

Layer Technology Purpose
Core Framework Next.js 16 Modern React framework with Turbopack for performance.
Graphics Engine CesiumJS World-class 3D geospatial engine for planetary visualization.
React Components Resium React bindings for CesiumJS.
Physics Engine satellite.js SGP4/SDP4 implementations for orbital propagation.
Spatial Hashing Web Workers O(N) collision/link detection with 1000kmΒ³ grid cells.
State Management Zustand High-performance atomic state for UI sync.
Styling Tailwind CSS 4 Utility-first CSS for the modern HUD (Heads-Up Display).
Animations Framer Motion Fluid transitions and micro-interactions.

πŸ›°οΈ System Architecture

1. Data Ingestion (TLE Hub)

OrbitView fetches Two-Line Element (TLE) data from multiple sources to ensure reliability:

  • Primary: Space-Track.org (via API)
  • Secondary: CelesTrak (CSV/JSON fallbacks)
  • Tertiary: Local static cache for offline/dev modes.

2. Propagation Layer

To maintain a responsive UI with thousands of objects, propagation (calculating position vs. time) is handled via Web Workers. This prevents the main UI thread from locking up during complex math.

3. Rendering Pipeline

  • LOD (Level of Detail): Satellites are rendered as simple points when zoomed out and transition to high-detail models/paths when approached.
  • Dynamic Layers: Specialized sub-components handle Ground Tracks, Footprints, and Orbit Paths separately to optimize React re-renders.

πŸš„ Performance Optimization (v2.0)

State Management Architecture

React Context API created performance bottlenecks when managing high-frequency time data (clock sync). To solve this, Zustand was adopted for atomic state management:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    CESIUM CLOCK (Master)                     β”‚
β”‚                    60fps Animation Loop                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ 100ms throttle
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ZUSTAND STORE (UI Sync)                   β”‚
β”‚     currentTime | isPlaying | multiplier | timelinePos      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ React renders
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    UI COMPONENTS                             β”‚
β”‚   MissionControl | TimeScrubber | TelemetryDeck | InfoPanel β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Spatial Hashing Physics Engine

To prevent O(NΒ²) complexity when checking satellite links/conjunctions, a Spatial Hash Grid was implemented in satellite.worker.ts:

  • Cell Size: 1000km Γ— 1000km Γ— 1000km
  • Algorithm: Assign each satellite to a bucket, only check 27 neighboring cells for links
  • Complexity: Reduced from O(NΒ²) to O(N Γ— k) where k = average neighbors per cell
/**
 * Spatial Hash Grid Implementation
 * @scientific_reference Teschner, M. et al. "Optimized Spatial Hashing for Collision Detection"
 * 
 * Cell size of 1000km chosen to exceed maximum inter-satellite link range (2500km)
 * ensuring all potential links are captured in adjacent cell checks.
 */

Render Loop Decoupling

The React render cycle and Cesium render loop are explicitly decoupled:

  • Cesium: Runs at native 60fps via requestAnimationFrame
  • React: UI updates throttled to 100ms intervals
  • Result: Smooth animations without React re-render overhead

πŸ“Š Performance Benchmarks

Metric v1.0 v2.0 Improvement
Link calculation (25k sats) 312ms 18ms 17Γ— faster
UI update frequency Every frame 100ms throttle 6Γ— fewer renders
Memory usage (heap) 245MB 198MB 19% reduction