# adharshkokkula/space-sustainability architecture

> Architecture diagram of the GitHub repository adharshkokkula/space-sustainability, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adharshkokkula/space-sustainability
- Repository: https://github.com/adharshkokkula/space-sustainability

## Overview

The product is a browser-based satellite collision viewer with a Flask analysis backend and AI-assisted reporting. Users load satellite orbital data, inspect a 3D view, select a satellite, and request collision-risk results; reports can then be generated and displayed or exported. The sampled backend also shows configuration, caching, and LLM-client layers. The README documents health checks and Space-Track data use, but sampled excerpts do not establish every backend route or data-source connection.

Main entry points: [`backend/server.py`](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/server.py) (Analysis API), [`index.js`](https://github.com/adharshkokkula/space-sustainability/blob/main/index.js) (Viewer and selection), [`renderer.js`](https://github.com/adharshkokkula/space-sustainability/blob/main/renderer.js) (3D renderer), [`backend/config/config_loader.py`](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/config/config_loader.py) (LLM configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Satellite viewer"]
  node_viewer["Viewer and selection<br/>[index.js]"]
  node_tle["Orbital data<br/>[tle.20171129.txt]"]
  node_metadata["Satellite metadata<br/>[oio.20171129.txt]"]
  node_render["3D renderer<br/>[renderer.js]"]
  node_propagation["Orbit propagation<br/>[worker.js]"]
end

subgraph group_analysis["Collision analysis"]
  node_backend["Analysis API<br/>[server.py]"]
  node_config["LLM configuration<br/>[config_loader.py]"]
  node_llmconfig["LLM settings<br/>[llm_config.json]"]
end

subgraph group_reporting["Risk reporting"]
  node_cache[("Report cache<br/>[cache_manager.py]")]
  node_report_service["Report generation<br/>[report_service.py]"]
  node_llm_client["LLM client<br/>[llm_client.py]"]
  node_report_ui["Report display and export"]
end

subgraph group_integration["External services"]
  node_hf["Hugging Face API"]
  node_spacetrack["Space-Track.org"]
end

node_user(("Satellite analyst"))

node_user -->|"selects satellite"| node_viewer
node_viewer -->|"loads orbital data"| node_tle
node_viewer -->|"loads metadata"| node_metadata
node_viewer -.->|"shows 3D view"| node_render
node_render -->|"starts worker"| node_propagation
node_viewer -->|"requests collision analysis"| node_backend
node_backend -->|"loads settings"| node_config
node_config -->|"reads settings"| node_llmconfig
node_backend -->|"initializes cache"| node_cache
node_backend -->|"initializes service"| node_report_service
node_report_service -->|"generates text"| node_llm_client
node_backend -.->|"serves report requests"| node_report_ui
node_report_ui -->|"requests report"| node_backend
node_llm_client -->|"sends generation request"| node_hf
node_backend -.->|"retrieves TLE data"| node_spacetrack

click node_viewer "https://github.com/adharshkokkula/space-sustainability/blob/main/index.js"
click node_tle "https://github.com/adharshkokkula/space-sustainability/blob/main/data/tle.20171129.txt"
click node_metadata "https://github.com/adharshkokkula/space-sustainability/blob/main/data/oio.20171129.txt"
click node_render "https://github.com/adharshkokkula/space-sustainability/blob/main/renderer.js"
click node_propagation "https://github.com/adharshkokkula/space-sustainability/blob/main/worker.js"
click node_backend "https://github.com/adharshkokkula/space-sustainability/blob/main/backend/server.py"
click node_config "https://github.com/adharshkokkula/space-sustainability/blob/main/backend/config/config_loader.py"
click node_llmconfig "https://github.com/adharshkokkula/space-sustainability/blob/main/backend/config/llm_config.json"
click node_cache "https://github.com/adharshkokkula/space-sustainability/blob/main/backend/services/cache_manager.py"
click node_report_service "https://github.com/adharshkokkula/space-sustainability/blob/main/backend/services/report_service.py"
click node_llm_client "https://github.com/adharshkokkula/space-sustainability/blob/main/backend/services/llm_client.py"
click node_report_ui "https://github.com/adharshkokkula/space-sustainability/blob/main/report_generator.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_viewer,node_tle,node_metadata,node_render,node_propagation toneBlue
class node_backend,node_config,node_llmconfig toneAmber
class node_cache,node_report_service,node_llm_client,node_report_ui toneMint
class node_hf,node_spacetrack toneRose
class node_user toneIndigo
```

## Components

### Satellite viewer

- [Viewer and selection](https://github.com/adharshkokkula/space-sustainability/blob/main/index.js): `index.js`
- [Orbital data](https://github.com/adharshkokkula/space-sustainability/blob/main/data/tle.20171129.txt): `data/tle.20171129.txt`
- [Satellite metadata](https://github.com/adharshkokkula/space-sustainability/blob/main/data/oio.20171129.txt): `data/oio.20171129.txt`
- [3D renderer](https://github.com/adharshkokkula/space-sustainability/blob/main/renderer.js): `renderer.js`
- [Orbit propagation](https://github.com/adharshkokkula/space-sustainability/blob/main/worker.js): `worker.js`

### Collision analysis

- [Analysis API](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/server.py): `backend/server.py`
- [LLM configuration](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/config/config_loader.py): `backend/config/config_loader.py`
- [LLM settings](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/config/llm_config.json): `backend/config/llm_config.json`

### Risk reporting

- [Report cache](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/services/cache_manager.py): `backend/services/cache_manager.py`
- [Report generation](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/services/report_service.py): `backend/services/report_service.py`
- [LLM client](https://github.com/adharshkokkula/space-sustainability/blob/main/backend/services/llm_client.py): `backend/services/llm_client.py`
- [Report display and export](https://github.com/adharshkokkula/space-sustainability/blob/main/report_generator.js): `report_generator.js`

### External services

- **Hugging Face API**
- **Space-Track.org**

### Other components

- **Satellite analyst**

## Connections

- Satellite analyst → Viewer and selection: selects satellite (evidence: `README.md`)
- Viewer and selection → Orbital data: loads orbital data (evidence: `index.js`)
- Viewer and selection → Satellite metadata: loads metadata (evidence: `index.js`)
- Viewer and selection → 3D renderer: shows 3D view
- 3D renderer → Orbit propagation: starts worker (evidence: `renderer.js`)
- Viewer and selection → Analysis API: requests collision analysis (evidence: `index.js`)
- Analysis API → LLM configuration: loads settings (evidence: `backend/server.py`)
- LLM configuration → LLM settings: reads settings (evidence: `backend/config/config_loader.py`)
- Analysis API → Report cache: initializes cache (evidence: `backend/server.py`)
- Analysis API → Report generation: initializes service (evidence: `backend/server.py`)
- Report generation → LLM client: generates text (evidence: `backend/services/report_service.py`)
- Analysis API → Report display and export: serves report requests
- Report display and export → Analysis API: requests report (evidence: `report_generator.js`)
- LLM client → Hugging Face API: sends generation request (evidence: `backend/services/llm_client.py`)
- Analysis API → Space-Track.org: retrieves TLE data (evidence: `README.md`)
