# anupongmju/space-weather-monitoring architecture

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

- Interactive diagram: https://gitdiagram.com/anupongmju/space-weather-monitoring
- Repository: https://github.com/anupongmju/space-weather-monitoring

## Overview

This is a space-weather monitoring and analysis application: users explore live conditions and historical measurements through dashboards, instrument pages, cosmic-ray and radiation views, and specialist Mars/Moon pages. Backend fetchers collect and normalize external observations into PostgreSQL; FastAPI routes expose domain data, while a scheduler refreshes selected feeds. The frontend routes users to visualizations and uses domain services to retrieve data. Evidence is strongest for application wiring, selected fetcher-to-database writes, and sampled page/service dependencies; unsampled domain links are omitted rather than inferred.

Main entry points: [`backend/scheduler.py`](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/scheduler.py) (Refresh scheduler), [`backend/database.py`](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/database.py) (PostgreSQL database), [`frontend/src/App.tsx`](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/App.tsx) (Application routes), [`backend/main.py`](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web experience"]
  node_app["Application routes<br/>[App.tsx]"]
  node_dash["Conditions dashboard<br/>[Dashboard.tsx]"]
  node_radpage["Radiation monitoring"]
  node_psnmpage["Neutron monitor<br/>[PsnmIndex.tsx]"]
  node_marsmoon["Mars and Moon views"]
  node_studio["Custom chart studio<br/>[CustomStudio.tsx]"]
  node_radservice["Radiation data service"]
  node_cosmicservice["Cosmic data service<br/>[cosmicService.ts]"]
  node_psnmservice["PSNM data service<br/>[psnmService.ts]"]
  node_marsservice["Mars data service<br/>[marsService.ts]"]
  node_moonservice["Moon data service<br/>[moonService.ts]"]
end

subgraph group_api["API and orchestration"]
  node_apiapp["FastAPI application<br/>[main.py]"]
  node_domainroutes["Domain API routes"]
  node_scheduler["Refresh scheduler<br/>[scheduler.py]"]
end

subgraph group_ingest["Data ingestion"]
  node_acefetch["ACE feed ingestion<br/>[ace_fetcher.py]"]
  node_cosmicfetch["Cosmic-ray ingestion<br/>[cosmic_fetcher.py]"]
  node_marsfetch["Mars RAD ingestion"]
  node_solarfetch["Solar wind ingestion<br/>[solar1_fetcher.py]"]
  node_goesfetch["GOES ingestion<br/>[goes_fetcher.py]"]
end

subgraph group_persistence["Persistence"]
  node_store[("PostgreSQL database<br/>[database.py]")]
end

node_visitor(("Space-weather user"))
node_externaldata(("External data providers"))

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_dash
node_app -->|"routes to"| node_radpage
node_app -->|"routes to"| node_psnmpage
node_app -->|"routes to"| node_studio
node_radpage -->|"requests data"| node_radservice
node_radpage -->|"requests data"| node_cosmicservice
node_psnmpage -->|"requests data"| node_psnmservice
node_marsmoon -.->|"requests data"| node_marsservice
node_marsmoon -.->|"requests data"| node_moonservice
node_apiapp -->|"registers"| node_domainroutes
node_apiapp -->|"starts"| node_scheduler
node_apiapp -->|"initializes"| node_store
node_scheduler -->|"runs"| node_acefetch
node_scheduler -->|"runs"| node_cosmicfetch
node_scheduler -->|"runs"| node_marsfetch
node_scheduler -->|"runs"| node_solarfetch
node_scheduler -->|"runs"| node_goesfetch
node_acefetch -->|"writes"| node_store
node_cosmicfetch -->|"writes"| node_store
node_marsfetch -->|"writes"| node_store
node_solarfetch -->|"writes"| node_store
node_goesfetch -.->|"writes"| node_store
node_externaldata -->|"supplies observations"| node_acefetch
node_externaldata -->|"supplies observations"| node_cosmicfetch
node_externaldata -->|"supplies observations"| node_marsfetch
node_externaldata -->|"supplies observations"| node_solarfetch

click node_app "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/App.tsx"
click node_dash "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/Dashboard.tsx"
click node_radpage "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/RadiationMonitoring.tsx"
click node_psnmpage "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/cosmic/PsnmIndex.tsx"
click node_marsmoon "https://github.com/anupongmju/space-weather-monitoring/tree/main/frontend/src/pages"
click node_studio "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/studio/CustomStudio.tsx"
click node_radservice "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/radiationService.ts"
click node_cosmicservice "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/cosmicService.ts"
click node_psnmservice "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/psnmService.ts"
click node_marsservice "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/marsService.ts"
click node_moonservice "https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/moonService.ts"
click node_apiapp "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/main.py"
click node_domainroutes "https://github.com/anupongmju/space-weather-monitoring/tree/main/backend/routers"
click node_scheduler "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/scheduler.py"
click node_acefetch "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/ace_fetcher.py"
click node_cosmicfetch "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/cosmic_fetcher.py"
click node_marsfetch "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/mars_rad_fetcher.py"
click node_solarfetch "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/solar1_fetcher.py"
click node_goesfetch "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/goes_fetcher.py"
click node_store "https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/database.py"

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_app,node_dash,node_radpage,node_psnmpage,node_marsmoon,node_studio,node_radservice,node_cosmicservice,node_psnmservice,node_marsservice,node_moonservice,node_visitor toneBlue
class node_apiapp,node_domainroutes,node_scheduler toneAmber
class node_acefetch,node_cosmicfetch,node_marsfetch,node_solarfetch,node_goesfetch toneMint
class node_store toneRose
class node_externaldata toneIndigo
```

## Components

### Web experience

- [Application routes](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Conditions dashboard](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Radiation monitoring](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/RadiationMonitoring.tsx): `frontend/src/pages/RadiationMonitoring.tsx`
- [Neutron monitor](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/cosmic/PsnmIndex.tsx): `frontend/src/pages/cosmic/PsnmIndex.tsx`
- [Mars and Moon views](https://github.com/anupongmju/space-weather-monitoring/tree/main/frontend/src/pages): `frontend/src/pages`
- [Custom chart studio](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/pages/studio/CustomStudio.tsx): `frontend/src/pages/studio/CustomStudio.tsx`
- [Radiation data service](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/radiationService.ts): `frontend/src/services/radiationService.ts`
- [Cosmic data service](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/cosmicService.ts): `frontend/src/services/cosmicService.ts`
- [PSNM data service](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/psnmService.ts): `frontend/src/services/psnmService.ts`
- [Mars data service](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/marsService.ts): `frontend/src/services/marsService.ts`
- [Moon data service](https://github.com/anupongmju/space-weather-monitoring/blob/main/frontend/src/services/moonService.ts): `frontend/src/services/moonService.ts`

### API and orchestration

- [FastAPI application](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/main.py): `backend/main.py`
- [Domain API routes](https://github.com/anupongmju/space-weather-monitoring/tree/main/backend/routers): `backend/routers`
- [Refresh scheduler](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/scheduler.py): `backend/scheduler.py`

### Data ingestion

- [ACE feed ingestion](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/ace_fetcher.py): `backend/fetchers/ace_fetcher.py`
- [Cosmic-ray ingestion](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/cosmic_fetcher.py): `backend/fetchers/cosmic_fetcher.py`
- [Mars RAD ingestion](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/mars_rad_fetcher.py): `backend/fetchers/mars_rad_fetcher.py`
- [Solar wind ingestion](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/solar1_fetcher.py): `backend/fetchers/solar1_fetcher.py`
- [GOES ingestion](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/fetchers/goes_fetcher.py): `backend/fetchers/goes_fetcher.py`

### Persistence

- [PostgreSQL database](https://github.com/anupongmju/space-weather-monitoring/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Space-weather user**
- **External data providers**

## Connections

- Space-weather user → Application routes: opens (evidence: `frontend/src/App.tsx`)
- Application routes → Conditions dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Radiation monitoring: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Neutron monitor: routes to (evidence: `frontend/src/App.tsx`)
- Application routes → Custom chart studio: routes to (evidence: `frontend/src/App.tsx`)
- Radiation monitoring → Radiation data service: requests data (evidence: `frontend/src/pages/RadiationMonitoring.tsx`)
- Radiation monitoring → Cosmic data service: requests data (evidence: `frontend/src/pages/RadiationMonitoring.tsx`)
- Neutron monitor → PSNM data service: requests data (evidence: `frontend/src/pages/cosmic/PsnmIndex.tsx`)
- Mars and Moon views → Mars data service: requests data
- Mars and Moon views → Moon data service: requests data
- FastAPI application → Domain API routes: registers (evidence: `backend/main.py`)
- FastAPI application → Refresh scheduler: starts (evidence: `backend/main.py`)
- FastAPI application → PostgreSQL database: initializes (evidence: `backend/main.py`)
- Refresh scheduler → ACE feed ingestion: runs (evidence: `backend/scheduler.py`)
- Refresh scheduler → Cosmic-ray ingestion: runs (evidence: `backend/scheduler.py`)
- Refresh scheduler → Mars RAD ingestion: runs (evidence: `backend/scheduler.py`)
- Refresh scheduler → Solar wind ingestion: runs (evidence: `backend/scheduler.py`)
- Refresh scheduler → GOES ingestion: runs (evidence: `backend/scheduler.py`)
- ACE feed ingestion → PostgreSQL database: writes (evidence: `backend/fetchers/ace_fetcher.py`)
- Cosmic-ray ingestion → PostgreSQL database: writes (evidence: `backend/fetchers/cosmic_fetcher.py`)
- Mars RAD ingestion → PostgreSQL database: writes (evidence: `backend/fetchers/mars_rad_fetcher.py`)
- Solar wind ingestion → PostgreSQL database: writes (evidence: `backend/fetchers/solar1_fetcher.py`)
- GOES ingestion → PostgreSQL database: writes (evidence: `backend/fetchers/goes_fetcher.py`)
- External data providers → ACE feed ingestion: supplies observations (evidence: `backend/fetchers/ace_fetcher.py`)
- External data providers → Cosmic-ray ingestion: supplies observations (evidence: `backend/fetchers/cosmic_fetcher.py`)
- External data providers → Mars RAD ingestion: supplies observations (evidence: `backend/fetchers/mars_rad_fetcher.py`)
- External data providers → Solar wind ingestion: supplies observations (evidence: `backend/fetchers/solar1_fetcher.py`)
