# nikita07arya-cloud/blue-trace architecture

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

- Interactive diagram: https://gitdiagram.com/nikita07arya-cloud/blue-trace
- Repository: https://github.com/nikita07arya-cloud/blue-trace

## Overview

This is an oil-spill response coordination platform. The documented workflow is agency task assignment, worker progress updates, and dashboard status monitoring; the sampled backend also exposes spill reporting and task proof/payment lifecycle operations. The graph shows the FastAPI routing, ORM models, and SQLite persistence layer. README capabilities such as JWT/OAuth2 are not represented as implemented components because no supporting source was shown; detection integration is explicitly future scope. Frontend-to-API wiring was not established by the excerpts.

Main entry points: [`frontend/app.py`](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/app.py) (FastAPI App), [`frontend/database/connection.py`](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/database/connection.py) (ORM Base), [`frontend/routes/stats.py`](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/stats.py) (Response Statistics), [`frontend/models/spill.py`](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/models/spill.py) (Spill Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Interface"]
  node_dashboard["Dashboard<br/>[dashboard.js]"]
  node_map["Spill Map<br/>[map.js]"]
  node_task_list["Task Listing<br/>[tasks.js]"]
end

subgraph group_api["API Workflows"]
  node_fastapi["FastAPI App<br/>[app.py]"]
  node_spill_routes["Spill Reporting<br/>[spills.py]"]
  node_task_routes["Task Operations<br/>[tasks.py]"]
  node_stats_routes["Response Statistics<br/>[stats.py]"]
end

subgraph group_domain["Response Domain"]
  node_spill_model["Spill Records<br/>[spill.py]"]
  node_task_model["Task Lifecycle<br/>[task.py]"]
end

subgraph group_storage["Persistence"]
  node_orm_base["ORM Base<br/>[connection.py]"]
  node_sqlite[("SQLite Database<br/>[connection.py]")]
end

node_responders(("Agency &amp; Workers"))
node_detection{{"Detection APIs"}}

node_responders -->|"use platform"| node_fastapi
node_fastapi -->|"registers router"| node_spill_routes
node_fastapi -->|"registers router"| node_task_routes
node_fastapi -->|"registers router"| node_stats_routes
node_fastapi -->|"serves frontend"| node_dashboard
node_spill_routes -->|"gets sessions"| node_orm_base
node_spill_routes -->|"queries and updates"| node_spill_model
node_task_routes -->|"gets sessions"| node_orm_base
node_task_routes -->|"manages lifecycle"| node_task_model
node_stats_routes -->|"gets sessions"| node_orm_base
node_stats_routes -->|"aggregates spill data"| node_spill_model
node_stats_routes -->|"aggregates task data"| node_task_model
node_spill_model -->|"uses declarative base"| node_orm_base
node_task_model -->|"uses declarative base"| node_orm_base
node_spill_model -->|"relates spill tasks"| node_task_model
node_task_model -->|"references spill"| node_spill_model
node_orm_base -->|"configures connection"| node_sqlite
node_dashboard -->|"reflects status"| node_stats_routes
node_detection -.->|"future integration"| node_fastapi

click node_fastapi "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/app.py"
click node_spill_routes "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/spills.py"
click node_task_routes "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/tasks.py"
click node_stats_routes "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/stats.py"
click node_spill_model "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/models/spill.py"
click node_task_model "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/models/task.py"
click node_dashboard "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/frontend/css/js/dashboard.js"
click node_map "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/frontend/css/js/map.js"
click node_task_list "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/frontend/css/js/tasks.js"
click node_orm_base "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/database/connection.py"
click node_sqlite "https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/database/connection.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_dashboard,node_map,node_task_list toneBlue
class node_fastapi,node_spill_routes,node_task_routes,node_stats_routes toneAmber
class node_spill_model,node_task_model,node_detection toneMint
class node_orm_base,node_sqlite,node_responders toneRose
```

## Components

### Web Interface

- [Dashboard](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/frontend/css/js/dashboard.js): `frontend/frontend/css/js/dashboard.js`
- [Spill Map](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/frontend/css/js/map.js): `frontend/frontend/css/js/map.js`
- [Task Listing](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/frontend/css/js/tasks.js): `frontend/frontend/css/js/tasks.js`

### API Workflows

- [FastAPI App](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/app.py): `frontend/app.py`
- [Spill Reporting](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/spills.py): `frontend/routes/spills.py`
- [Task Operations](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/tasks.py): `frontend/routes/tasks.py`
- [Response Statistics](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/routes/stats.py): `frontend/routes/stats.py`

### Response Domain

- [Spill Records](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/models/spill.py): `frontend/models/spill.py`
- [Task Lifecycle](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/models/task.py): `frontend/models/task.py`

### Persistence

- [ORM Base](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/database/connection.py): `frontend/database/connection.py`
- [SQLite Database](https://github.com/nikita07arya-cloud/blue-trace/blob/main/frontend/database/connection.py): `frontend/database/connection.py`

### Other components

- **Agency & Workers**
- **Detection APIs**

## Connections

- Agency & Workers → FastAPI App: use platform (evidence: `README.md`)
- FastAPI App → Spill Reporting: registers router (evidence: `frontend/app.py`)
- FastAPI App → Task Operations: registers router (evidence: `frontend/app.py`)
- FastAPI App → Response Statistics: registers router (evidence: `frontend/app.py`)
- FastAPI App → Dashboard: serves frontend (evidence: `frontend/app.py`)
- Spill Reporting → ORM Base: gets sessions (evidence: `frontend/routes/spills.py`)
- Spill Reporting → Spill Records: queries and updates (evidence: `frontend/routes/spills.py`)
- Task Operations → ORM Base: gets sessions (evidence: `frontend/routes/tasks.py`)
- Task Operations → Task Lifecycle: manages lifecycle (evidence: `frontend/routes/tasks.py`)
- Response Statistics → ORM Base: gets sessions (evidence: `frontend/routes/stats.py`)
- Response Statistics → Spill Records: aggregates spill data (evidence: `frontend/routes/stats.py`)
- Response Statistics → Task Lifecycle: aggregates task data (evidence: `frontend/routes/stats.py`)
- Spill Records → ORM Base: uses declarative base (evidence: `frontend/models/spill.py`)
- Task Lifecycle → ORM Base: uses declarative base (evidence: `frontend/models/task.py`)
- Spill Records → Task Lifecycle: relates spill tasks (evidence: `frontend/models/spill.py`)
- Task Lifecycle → Spill Records: references spill (evidence: `frontend/models/task.py`)
- ORM Base → SQLite Database: configures connection (evidence: `frontend/database/connection.py`)
- Dashboard → Response Statistics: reflects status (evidence: `README.md`)
- Detection APIs → FastAPI App: future integration (evidence: `README.md`)
