Production-grade orbital intelligence platform combining a Next.js enterprise frontend with a modular FastAPI backend for live NEO analytics, mission economics, and interactive 3D telemetry.
- System Architecture
- Deployment Topology
- Phase 1 Completion: Security & Performance
- Phase 3 Completion: Live ML Ingestion Engine
- API Surface
- Repository Structure
- Local Development
- Environment Variables
- Operations: Running the Pipeline
- Legal & Disclaimer
SPECTRAVEIN is a decoupled, cloud-ready architecture:
- Frontend: Next.js 16 (App Router) on Vercel
- Backend: FastAPI (modular
app/structure) on Render - Data Layer: Live NASA/JPL SBDB ingestion merged into
backend/asteroid_labeled.csv - Visualization: Three.js /
@react-three/fiberorbital projection components
User Browser
│
▼
Next.js Frontend (Vercel)
- / Landing + hero visualization
- /dashboard Target intelligence table
- /analytics 3D orbital + finance + telemetry
│
▼
FastAPI Backend (Render)
- GET /api/targets
- POST /api/admin/pipeline/run (rate-limited)
│
├── Services Layer (physics, economics, orbital, ingestion)
├── Data Loader (CSV abstraction)
└── Models/Schemas (Pydantic)
│
▼
NASA JPL SBDB API (Live Telemetry)
The frontend and backend are independently deployable and communicate over API contracts, enabling horizontal scale and independent release cycles.
SPECTRAVEIN is actively deployed as two production services:
- Frontend: Vercel (global edge delivery for Next.js app)
- Backend: Render (FastAPI API service with environment-based configuration)
This separation provides operational isolation, lower blast radius, and clearer ownership boundaries between UI delivery and compute/data pipelines.
slowapirate limiting is integrated and active.- Sensitive admin route protection is enforced:
POST /api/admin/pipeline/runwith@limiter.limit("2/minute")
- CORS is environment-driven (
ALLOWED_ORIGINS) viapydantic-settings. - Wildcard CORS has been removed in favor of explicit allowed origins.
- Heavy 3D landing assets are loaded with dynamic imports (SSR disabled where required).
React.memois applied to orbital visualization wrappers/components inOrbitalOrrery.tsxto reduce avoidable re-renders.- Analytics UI was modularized into dedicated components for maintainability and rendering stability.
The live pipeline is implemented in:
backend/app/services/ingestion.py
- Fetches NEO telemetry from NASA JPL SBDB (
sbdb_query.api) - Cleans/transforms schema into internal target format
- Runs unsupervised K-Means (
k=3) on albedo - Maps cluster centers to spectral classes:
- lowest center ->
C - middle center ->
S - highest center ->
M
- lowest center ->
- Merges incoming records with existing dataset by stable asteroid ID
- Exports updated
backend/asteroid_labeled.csv
- Idempotent merge behavior: re-runs update overlaps and append only truly new asteroids.
- No destructive overwrite semantics: existing custom rows are preserved unless matching IDs are intentionally updated.
- Dynamic path resolution: CSV path resolved with
pathlibfor local and cloud runtime parity. - Operational logging: pipeline emits
stderrstatus logs for cloud observability.
The ingestion engine is exposed through an admin API:
POST /api/admin/pipeline/runThis route executes the full Fetch -> ETL -> ML -> Merge -> Export workflow and returns processed counts.
GET / Health check
GET /api/targets Computed target intelligence payload
POST /api/admin/pipeline/run Admin-triggered live ingestion pipeline (2/min)
SPECTRAVEIN/
├── backend/
│ ├── app/
│ │ ├── main.py
│ │ ├── core/config.py
│ │ ├── api/endpoints.py
│ │ ├── services/
│ │ │ ├── physics.py
│ │ │ ├── economics.py
│ │ │ ├── orbital.py
│ │ │ └── ingestion.py
│ │ ├── data/loader.py
│ │ └── models/schemas.py
│ ├── asteroid_labeled.csv
│ ├── pyproject.toml
│ └── requirements.txt
└── frontend/
├── app/
│ ├── layout.tsx
│ ├── page.tsx
│ ├── dashboard/page.tsx
│ └── analytics/page.tsx
├── components/
│ ├── analytics/
│ └── ui/OrbitalOrrery.tsx
└── package.json
cd backend
uv sync
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm run devFrontend runs on http://localhost:3000, backend on http://localhost:8000.
ALLOWED_ORIGINS=http://localhost:3000,https://your-vercel-domain.vercel.app
DATABASE_URL=
SUPABASE_DATABASE_URL=
SUPABASE_DATABASE_URL_DIRECT=
ENVIRONMENT=development
LOG_LEVEL=INFONEXT_PUBLIC_API_URL=http://localhost:8000Manual trigger example:
curl -X POST "https://<your-render-service>/api/admin/pipeline/run"Expected behavior:
- Pull latest NEO telemetry from NASA
- Reclassify incoming records (K-Means k=3)
- Merge into existing dataset without destructive replacement
- Return success payload with
asteroids_processed
All valuations, mission cost projections, net profit calculations, and ROI models produced by SPECTRAVEIN are theoretical economic simulations for research and demonstration purposes only. They do not constitute financial advice, investment advice, legal counsel, or operational mission-planning guidance.
The Planetary Defense Lock feature reflects the authors' good-faith interpretation of the Outer Space Treaty (1967), the Artemis Accords (2020), and current UN Committee on the Peaceful Uses of Outer Space (COPUOS) guidelines. It does not constitute legal counsel and should not be relied upon for actual regulatory compliance.