# madn143/ais-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/madn143/ais-tracker
- Repository: https://github.com/madn143/ais-tracker

## Overview

DarkWake is an AIS vessel anomaly dashboard with a separate Python batch detector. The detector downloads AIS data, prepares vessel features, scores anomalies, and writes a JSON export; the browser dashboard reads a static JSON file for both fleet metrics and a map. The supplied code does not show how the backend export reaches the frontend’s public data file, so those stores are kept separate. The map also loads OpenStreetMap tiles. Source coverage is limited to the excerpts and file tree; uninspected data-file contents are not inferred.

Main entry points: [`backend/detector_real.py`](https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py) (AIS Detector), [`frontend/app/page.tsx`](https://github.com/madn143/ais-tracker/blob/main/frontend/app/page.tsx) (Dashboard Page), [`frontend/app/components/RadarMap.jsx`](https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/RadarMap.jsx) (Vessel Radar Map), [`frontend/app/components/StatsPanel.jsx`](https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/StatsPanel.jsx) (Fleet Statistics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_detection["AIS Detection"]
  node_detector["AIS Detector<br/>[detector_real.py]"]
  node_featureprep["Feature Preparation<br/>[detector_real.py]"]
  node_anomaly["Anomaly Scoring<br/>[detector_real.py]"]
  node_export["JSON Export<br/>[detector_real.py]"]
end

subgraph group_dashboard["Web Dashboard"]
  node_page["Dashboard Page<br/>[page.tsx]"]
  node_stats["Fleet Statistics<br/>[StatsPanel.jsx]"]
  node_wrapper["Map Wrapper<br/>[MapWrapper.tsx]"]
  node_radar["Vessel Radar Map<br/>[RadarMap.jsx]"]
end

subgraph group_data["Vessel Data"]
  node_backenddata[("Detector Output<br/>[all_vessels.json]")]
  node_publicdata[("Dashboard Vessel Data<br/>[all_vessels.json]")]
end

node_kaggle[("Kaggle AIS Dataset")]
node_user(("Dashboard User"))
node_osm[("OpenStreetMap Tiles")]

node_detector -->|"downloads dataset"| node_kaggle
node_detector -->|"loads and cleans"| node_featureprep
node_featureprep -->|"provides features"| node_anomaly
node_detector -->|"trains and predicts"| node_anomaly
node_detector -->|"combines results"| node_export
node_export -->|"writes JSON"| node_backenddata
node_user -->|"opens dashboard"| node_page
node_page -->|"renders"| node_stats
node_page -->|"renders"| node_wrapper
node_wrapper -->|"loads dynamically"| node_radar
node_stats -->|"fetches metrics data"| node_publicdata
node_radar -->|"fetches vessel data"| node_publicdata
node_radar -->|"loads map tiles"| node_osm

click node_detector "https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py"
click node_featureprep "https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py"
click node_anomaly "https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py"
click node_export "https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py"
click node_backenddata "https://github.com/madn143/ais-tracker/blob/main/backend/all_vessels.json"
click node_page "https://github.com/madn143/ais-tracker/blob/main/frontend/app/page.tsx"
click node_stats "https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/StatsPanel.jsx"
click node_wrapper "https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/MapWrapper.tsx"
click node_radar "https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/RadarMap.jsx"
click node_publicdata "https://github.com/madn143/ais-tracker/blob/main/frontend/public/all_vessels.json"

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_detector,node_featureprep,node_anomaly,node_export,node_user toneBlue
class node_page,node_stats,node_wrapper,node_radar,node_kaggle,node_osm toneAmber
class node_backenddata,node_publicdata toneMint
```

## Components

### AIS Detection

- [AIS Detector](https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py): `backend/detector_real.py`
- [Feature Preparation](https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py): `backend/detector_real.py`
- [Anomaly Scoring](https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py): `backend/detector_real.py`
- [JSON Export](https://github.com/madn143/ais-tracker/blob/main/backend/detector_real.py): `backend/detector_real.py`

### Web Dashboard

- [Dashboard Page](https://github.com/madn143/ais-tracker/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Fleet Statistics](https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/StatsPanel.jsx): `frontend/app/components/StatsPanel.jsx`
- [Map Wrapper](https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/MapWrapper.tsx): `frontend/app/components/MapWrapper.tsx`
- [Vessel Radar Map](https://github.com/madn143/ais-tracker/blob/main/frontend/app/components/RadarMap.jsx): `frontend/app/components/RadarMap.jsx`

### Vessel Data

- [Detector Output](https://github.com/madn143/ais-tracker/blob/main/backend/all_vessels.json): `backend/all_vessels.json`
- [Dashboard Vessel Data](https://github.com/madn143/ais-tracker/blob/main/frontend/public/all_vessels.json): `frontend/public/all_vessels.json`

### Other components

- **Kaggle AIS Dataset**
- **Dashboard User**
- **OpenStreetMap Tiles**

## Connections

- AIS Detector → Kaggle AIS Dataset: downloads dataset (evidence: `backend/detector_real.py`)
- AIS Detector → Feature Preparation: loads and cleans (evidence: `backend/detector_real.py`)
- Feature Preparation → Anomaly Scoring: provides features (evidence: `backend/detector_real.py`)
- AIS Detector → Anomaly Scoring: trains and predicts (evidence: `backend/detector_real.py`)
- AIS Detector → JSON Export: combines results (evidence: `backend/detector_real.py`)
- JSON Export → Detector Output: writes JSON (evidence: `backend/detector_real.py`)
- Dashboard User → Dashboard Page: opens dashboard (evidence: `frontend/app/page.tsx`)
- Dashboard Page → Fleet Statistics: renders (evidence: `frontend/app/page.tsx`)
- Dashboard Page → Map Wrapper: renders (evidence: `frontend/app/page.tsx`)
- Map Wrapper → Vessel Radar Map: loads dynamically (evidence: `frontend/app/components/MapWrapper.tsx`)
- Fleet Statistics → Dashboard Vessel Data: fetches metrics data (evidence: `frontend/app/components/StatsPanel.jsx`)
- Vessel Radar Map → Dashboard Vessel Data: fetches vessel data (evidence: `frontend/app/components/RadarMap.jsx`)
- Vessel Radar Map → OpenStreetMap Tiles: loads map tiles (evidence: `frontend/app/components/RadarMap.jsx`)
