Premium React application for real-time aircraft tracking and monitoring
🎯 Overview
The SkySpy frontend is a modern React application built with Vite, delivering a real-time aircraft tracking and monitoring dashboard. Features include a modular component architecture, Socket.IO-based real-time data streaming, and responsive design for desktop and mobile.
📸
Screenshot PlaceholderThe main dashboard showing live aircraft tracking with real-time updates
Military aircraft, Emergency status, Law enforcement, Helicopter
📱 Mobile
Proximity detection (Cannonball mode)
📊 Stats Dashboard Layout
📸
Screenshot PlaceholderBento grid layout with live data, charts, and system status
graph LR
subgraph StatsView["📊 StatsView - Bento Grid"]
subgraph Left["📋 Left Column"]
Leaderboard["🏆 LeaderboardCard"]
Squawk["📡 SquawkWatchlist"]
end
subgraph Center["📈 Center Column"]
KPI["📊 KPI Cards"]
Sparkline["📈 LiveSparklines"]
Bar["📊 HorizontalBarChart"]
Acars["📨 AcarsSection"]
Antenna["📡 Antenna Analytics"]
end
subgraph Right["⚙️ Right Column"]
System["💻 SystemStatusCard"]
Safety["⚠️ SafetyAlertsSummary"]
Conn["🔌 ConnectionStatusCard"]
end
end
🎯 Cannonball Mode (Mobile)
📸
Screenshot PlaceholderFullscreen mobile proximity detection with HUD overlay
A fullscreen mobile-optimized mode for proximity-based aircraft detection:
Component
Purpose
Icon
CannonballMode.jsx
Main container
🎯
HeadsUpDisplay.jsx
HUD-style overlay
🎮
RadarView.jsx
Radar-style display
📡
ThreatDisplay.jsx
Proximity threat cards
⚠️
ThreatList.jsx
Sorted threat list
📋
StatusBar.jsx
GPS and connection status
📍
EdgeIndicators.jsx
Off-screen aircraft indicators
↗️
🔄 State Management
State Flow Diagram
flowchart TB
subgraph Sources["📡 Data Sources"]
WS1["🔌 Main Socket.IO"]
WS2["🔌 Position Socket.IO"]
API["🌐 REST API"]
LS["💾 localStorage"]
end
subgraph State["⚛️ React State"]
Context["🔑 AuthContext"]
Local["📍 Local State"]
Ref["🔗 useRef"]
end
subgraph UI["🖼️ UI Components"]
Views["👁️ Views"]
Map["🗺️ Map"]
Lists["📋 Lists"]
end
WS1 -->|"aircraft, safety, alerts"| Local
WS2 -->|"positions (60fps)"| Ref
API -->|"fetch"| Local
LS -->|"config"| Context
Context --> Views
Local --> Views
Ref --> Map
🔑 AuthContext API
const {
// 📊 State
status, // 'loading' | 'anonymous' | 'authenticated'
user, // User object with permissions
config, // Auth configuration
error, // Last auth error
isAuthenticated, // Boolean shorthand
// 🔧 Methods
login, // Username/password login
logout, // Clear session
loginWithOIDC, // OAuth/OIDC popup flow
authFetch, // Authenticated fetch wrapper
hasPermission, // Check single permission
hasAnyPermission, // Check any of the permissions
hasAllPermissions,// Check all permissions
canAccessFeature, // Feature-based access check
getAccessToken, // Get JWT for Socket.IO
} = useAuth();
🔌 Socket.IO State
sequenceDiagram
participant B as 🖥️ Backend
participant M as 📡 Main Socket
participant P as 📍 Position Socket
participant R as ⚛️ React
B->>M: aircraft:snapshot
M->>R: setState(aircraft)
B->>M: safety:event
M->>R: setState(events)
B->>P: position:update (1Hz)
P->>R: positionsRef.current = positions
Note over R: No re-render! 🚀
# 📦 Install dependencies
npm install
# 🚀 Start development server
npm run dev
# 🏗️ Build for production
npm run build
# 👁️ Preview production build
npm run preview
# 🔍 Lint code
npm run lint
🌍 Environment Variables
Variable
Purpose
Default
VITE_API_TARGET
Backend API URL for dev proxy
http://localhost:8000
📝
Note
In production, the frontend is served by Django using relative URLs. VITE_API_TARGET is only used for the Vite dev server proxy.
⚡ Performance Optimization
✅
Performance Tips
SkySpy is optimized for real-time data at 60fps. Here's how:
🚀 Virtual Scrolling
Large lists use the VirtualList component to render only visible items, enabling smooth scrolling with thousands of aircraft.
sequenceDiagram
participant U as 👤 User
participant A as ⚛️ App
participant B as 🖥️ Backend
U->>A: Login
A->>B: POST /api/auth/login
B->>A: JWT tokens
A->>A: Store in localStorage
A->>A: Schedule refresh (30s before expiry)
Note over A: Token expires in 30s...
A->>B: POST /api/auth/refresh
B->>A: New JWT tokens
A->>A: Update localStorage