# amirisufi/atlas architecture

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

- Interactive diagram: https://gitdiagram.com/amirisufi/atlas
- Repository: https://github.com/amirisufi/atlas

## Overview

Atlas is an emergency incident reporting and operations dashboard. The visible workflow runs from incident reporting and live monitoring through AI-assisted triage and duplicate-event clustering, then presents reports on a map with team and station guidance. The dashboard also supports cluster review and resolution, while a separate navigation view provides station-based routing. Some page behavior and supporting modules were not sampled, so the graph includes only relationships shown in excerpts or the SOURCE INDEX.

Main entry points: [`app/dashboard/page.js`](https://github.com/amirisufi/atlas/blob/main/app/dashboard/page.js) (Live dashboard), [`lib/supabaseClient.js`](https://github.com/amirisufi/atlas/blob/main/lib/supabaseClient.js) (Supabase client), [`lib/incidentClusters.js`](https://github.com/amirisufi/atlas/blob/main/lib/incidentClusters.js) (Map cluster grouping), [`lib/incidentMarkers.js`](https://github.com/amirisufi/atlas/blob/main/lib/incidentMarkers.js) (Incident markers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_reporting["Incident reporting<br/>[page.js]"]
  node_dashboard["Live dashboard<br/>[page.js]"]
  node_cluster_drawer["Cluster review<br/>[ClusterDrawer.js]"]
  node_navigation["Station navigation<br/>[page.js]"]
end

subgraph group_incident_ops["Incident operations"]
  node_triage_api["AI triage API<br/>[route.js]"]
  node_cluster_api["Incident clustering API<br/>[route.js]"]
  node_cluster_match["Event matching<br/>[clusterMatch.js]"]
  node_gemini_client["Gemini client<br/>[geminiClient.js]"]
end

subgraph group_map_support["Map and dispatch support"]
  node_map_layers["Map layers"]
  node_markers["Incident markers<br/>[incidentMarkers.js]"]
  node_display_clusters["Map cluster grouping"]
  node_geo["Geospatial calculations<br/>[geo.js]"]
  node_team_guidance["Team guidance<br/>[incidentTeams.js]"]
  node_stations["Emergency stations"]
end

subgraph group_platform["Runtime and storage"]
  node_env_bootstrap["Browser config bootstrap<br/>[EnvBootstrap.js]"]
  node_config_api["Public config API<br/>[route.js]"]
  node_public_env["Public environment<br/>[publicEnv.js]"]
  node_supabase_client["Supabase client<br/>[supabaseClient.js]"]
  node_incident_store[("Incident database<br/>[schema.sql]")]
end

node_operator(("Operator or reporter"))
node_supabase_service[("Supabase service")]
node_gemini_service["Google Gemini"]

node_operator -->|"submits report"| node_reporting
node_reporting -->|"uses data client"| node_supabase_client
node_dashboard -->|"reads live data"| node_supabase_client
node_dashboard -->|"subscribes realtime"| node_supabase_client
node_dashboard -->|"binds interactions"| node_map_layers
node_dashboard -->|"groups reports"| node_display_clusters
node_dashboard -->|"renders incidents"| node_markers
node_dashboard -->|"shows teams"| node_team_guidance
node_dashboard -->|"uses station data"| node_stations
node_dashboard -->|"opens review"| node_cluster_drawer
node_cluster_drawer -->|"shows teams"| node_team_guidance
node_markers -->|"formats teams"| node_team_guidance
node_display_clusters -->|"reads coordinates"| node_markers
node_display_clusters -->|"calculates distance"| node_geo
node_map_layers -->|"uses marker data"| node_markers
node_map_layers -->|"uses cluster groups"| node_display_clusters
node_navigation -->|"finds nearest station"| node_stations
node_navigation -->|"reads map config"| node_public_env
node_operator -->|"monitors incidents"| node_dashboard
node_operator -.->|"requests directions"| node_navigation
node_triage_api -->|"updates incident"| node_supabase_client
node_triage_api -->|"requests triage"| node_gemini_service
node_cluster_api -->|"queries and links"| node_supabase_client
node_cluster_api -->|"checks proximity"| node_geo
node_cluster_api -->|"evaluates candidates"| node_cluster_match
node_cluster_match -->|"uses model client"| node_gemini_client
node_gemini_client -->|"creates API client"| node_gemini_service
node_env_bootstrap -->|"fetches config"| node_config_api
node_config_api -->|"gets runtime values"| node_public_env
node_supabase_client -->|"reads credentials"| node_public_env
node_supabase_client -->|"connects to"| node_supabase_service
node_supabase_service -.->|"stores incident data"| node_incident_store

click node_reporting "https://github.com/amirisufi/atlas/blob/main/app/page.js"
click node_dashboard "https://github.com/amirisufi/atlas/blob/main/app/dashboard/page.js"
click node_cluster_drawer "https://github.com/amirisufi/atlas/blob/main/app/dashboard/ClusterDrawer.js"
click node_navigation "https://github.com/amirisufi/atlas/blob/main/app/dashboard/navigation/page.js"
click node_triage_api "https://github.com/amirisufi/atlas/blob/main/app/api/triage/route.js"
click node_cluster_api "https://github.com/amirisufi/atlas/blob/main/app/api/cluster/route.js"
click node_cluster_match "https://github.com/amirisufi/atlas/blob/main/lib/clusterMatch.js"
click node_gemini_client "https://github.com/amirisufi/atlas/blob/main/lib/geminiClient.js"
click node_map_layers "https://github.com/amirisufi/atlas/blob/main/lib/incidentMapLayers.js"
click node_markers "https://github.com/amirisufi/atlas/blob/main/lib/incidentMarkers.js"
click node_display_clusters "https://github.com/amirisufi/atlas/blob/main/lib/incidentClusters.js"
click node_geo "https://github.com/amirisufi/atlas/blob/main/lib/geo.js"
click node_team_guidance "https://github.com/amirisufi/atlas/blob/main/lib/incidentTeams.js"
click node_stations "https://github.com/amirisufi/atlas/blob/main/lib/emergencyStations.js"
click node_env_bootstrap "https://github.com/amirisufi/atlas/blob/main/app/EnvBootstrap.js"
click node_config_api "https://github.com/amirisufi/atlas/blob/main/app/api/config/route.js"
click node_public_env "https://github.com/amirisufi/atlas/blob/main/lib/publicEnv.js"
click node_supabase_client "https://github.com/amirisufi/atlas/blob/main/lib/supabaseClient.js"
click node_incident_store "https://github.com/amirisufi/atlas/blob/main/supabase/schema.sql"

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_reporting,node_dashboard,node_cluster_drawer,node_navigation toneBlue
class node_triage_api,node_cluster_api,node_cluster_match,node_gemini_client,node_supabase_service toneAmber
class node_map_layers,node_markers,node_display_clusters,node_geo,node_team_guidance,node_stations toneMint
class node_env_bootstrap,node_config_api,node_public_env,node_supabase_client,node_incident_store toneRose
class node_operator,node_gemini_service toneIndigo
```

## Components

### User experience

- [Incident reporting](https://github.com/amirisufi/atlas/blob/main/app/page.js): `app/page.js`
- [Live dashboard](https://github.com/amirisufi/atlas/blob/main/app/dashboard/page.js): `app/dashboard/page.js`
- [Cluster review](https://github.com/amirisufi/atlas/blob/main/app/dashboard/ClusterDrawer.js): `app/dashboard/ClusterDrawer.js`
- [Station navigation](https://github.com/amirisufi/atlas/blob/main/app/dashboard/navigation/page.js): `app/dashboard/navigation/page.js`

### Incident operations

- [AI triage API](https://github.com/amirisufi/atlas/blob/main/app/api/triage/route.js): `app/api/triage/route.js`
- [Incident clustering API](https://github.com/amirisufi/atlas/blob/main/app/api/cluster/route.js): `app/api/cluster/route.js`
- [Event matching](https://github.com/amirisufi/atlas/blob/main/lib/clusterMatch.js): `lib/clusterMatch.js`
- [Gemini client](https://github.com/amirisufi/atlas/blob/main/lib/geminiClient.js): `lib/geminiClient.js`

### Map and dispatch support

- [Map layers](https://github.com/amirisufi/atlas/blob/main/lib/incidentMapLayers.js): `lib/incidentMapLayers.js`
- [Incident markers](https://github.com/amirisufi/atlas/blob/main/lib/incidentMarkers.js): `lib/incidentMarkers.js`
- [Map cluster grouping](https://github.com/amirisufi/atlas/blob/main/lib/incidentClusters.js): `lib/incidentClusters.js`
- [Geospatial calculations](https://github.com/amirisufi/atlas/blob/main/lib/geo.js): `lib/geo.js`
- [Team guidance](https://github.com/amirisufi/atlas/blob/main/lib/incidentTeams.js): `lib/incidentTeams.js`
- [Emergency stations](https://github.com/amirisufi/atlas/blob/main/lib/emergencyStations.js): `lib/emergencyStations.js`

### Runtime and storage

- [Browser config bootstrap](https://github.com/amirisufi/atlas/blob/main/app/EnvBootstrap.js): `app/EnvBootstrap.js`
- [Public config API](https://github.com/amirisufi/atlas/blob/main/app/api/config/route.js): `app/api/config/route.js`
- [Public environment](https://github.com/amirisufi/atlas/blob/main/lib/publicEnv.js): `lib/publicEnv.js`
- [Supabase client](https://github.com/amirisufi/atlas/blob/main/lib/supabaseClient.js): `lib/supabaseClient.js`
- [Incident database](https://github.com/amirisufi/atlas/blob/main/supabase/schema.sql): `supabase/schema.sql`

### Other components

- **Operator or reporter**
- **Supabase service**
- **Google Gemini**

## Connections

- Operator or reporter → Incident reporting: submits report (evidence: `app/page.js`)
- Incident reporting → Supabase client: uses data client (evidence: `app/page.js`)
- Live dashboard → Supabase client: reads live data (evidence: `app/dashboard/page.js`)
- Live dashboard → Supabase client: subscribes realtime (evidence: `app/dashboard/page.js`)
- Live dashboard → Map layers: binds interactions (evidence: `app/dashboard/page.js`)
- Live dashboard → Map cluster grouping: groups reports (evidence: `app/dashboard/page.js`)
- Live dashboard → Incident markers: renders incidents (evidence: `app/dashboard/page.js`)
- Live dashboard → Team guidance: shows teams (evidence: `app/dashboard/page.js`)
- Live dashboard → Emergency stations: uses station data (evidence: `app/dashboard/page.js`)
- Live dashboard → Cluster review: opens review (evidence: `app/dashboard/page.js`)
- Cluster review → Team guidance: shows teams (evidence: `app/dashboard/ClusterDrawer.js`)
- Incident markers → Team guidance: formats teams (evidence: `lib/incidentMarkers.js`)
- Map cluster grouping → Incident markers: reads coordinates (evidence: `lib/incidentClusters.js`)
- Map cluster grouping → Geospatial calculations: calculates distance (evidence: `lib/incidentClusters.js`)
- Map layers → Incident markers: uses marker data (evidence: `lib/incidentMapLayers.js`)
- Map layers → Map cluster grouping: uses cluster groups (evidence: `lib/incidentMapLayers.js`)
- Station navigation → Emergency stations: finds nearest station (evidence: `app/dashboard/navigation/page.js`)
- Station navigation → Public environment: reads map config (evidence: `app/dashboard/navigation/page.js`)
- Operator or reporter → Live dashboard: monitors incidents (evidence: `app/dashboard/page.js`)
- Operator or reporter → Station navigation: requests directions
- AI triage API → Supabase client: updates incident (evidence: `app/api/triage/route.js`)
- AI triage API → Google Gemini: requests triage (evidence: `app/api/triage/route.js`)
- Incident clustering API → Supabase client: queries and links (evidence: `app/api/cluster/route.js`)
- Incident clustering API → Geospatial calculations: checks proximity (evidence: `app/api/cluster/route.js`)
- Incident clustering API → Event matching: evaluates candidates (evidence: `app/api/cluster/route.js`)
- Event matching → Gemini client: uses model client (evidence: `lib/clusterMatch.js`)
- Gemini client → Google Gemini: creates API client (evidence: `lib/geminiClient.js`)
- Browser config bootstrap → Public config API: fetches config (evidence: `app/EnvBootstrap.js`)
- Public config API → Public environment: gets runtime values (evidence: `app/api/config/route.js`)
- Supabase client → Public environment: reads credentials (evidence: `lib/supabaseClient.js`)
- Supabase client → Supabase service: connects to (evidence: `lib/supabaseClient.js`)
- Supabase service → Incident database: stores incident data
