# missionadak/orcav2 architecture

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

- Interactive diagram: https://gitdiagram.com/missionadak/orcav2
- Repository: https://github.com/missionadak/orcav2

## Overview

ORCA is a maritime safety and search-and-rescue product with a mobile client and a FastAPI backend. The user-facing workflow runs from mobile navigation to marine forecasts, chat, or SAR incident creation through the API client; backend SAR endpoints support incident, search-zone, rescue, evidence, and mission-package operations. The tree also shows offline SOS queuing and synchronization, plus environmental ingestion and risk scoring. Sampled excerpts are partial, so links among unsampled screens, agents, and backend subsystems are not asserted.

Main entry points: [`apps/mobile/services/apiClient.ts`](https://github.com/missionadak/orcav2/blob/main/apps/mobile/services/apiClient.ts) (API client), [`backend/app.py`](https://github.com/missionadak/orcav2/blob/main/backend/app.py) (ORCA API), [`apps/mobile/utils/offlineSync.ts`](https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/offlineSync.ts) (Offline sync), [`apps/mobile/App.tsx`](https://github.com/missionadak/orcav2/blob/main/apps/mobile/App.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["App shell<br/>[App.tsx]"]
  node_navigation["Root navigation<br/>[RootNavigator.tsx]"]
  node_home["Home screen<br/>[HomeScreen.tsx]"]
  node_map["Map screen<br/>[MapScreen.tsx]"]
  node_ai["AI screen<br/>[AIScreen.tsx]"]
  node_alerts["Alerts screen<br/>[AlertsScreen.tsx]"]
  node_sosmodal["Emergency SOS"]
  node_marine["Marine service<br/>[marineService.ts]"]
  node_client["API client<br/>[apiClient.ts]"]
end

subgraph group_offline["Offline support"]
  node_offline_db[("Offline database<br/>[offlineDatabase.ts]")]
  node_offline_sync["Offline sync<br/>[offlineSync.ts]"]
  node_network_sync["Network sync hook<br/>[useNetworkSync.ts]"]
end

subgraph group_backend["Backend services"]
  node_backend_api["ORCA API<br/>[app.py]"]
  node_risk["Risk scoring<br/>[risk_engine.py]"]
  node_ingestion["Marine data ingestion<br/>[data_ingestion.py]"]
end

subgraph group_sar["SAR operations"]
  node_sar_service["Rescue services<br/>[rescue_service.py]"]
  node_sar_drift["Drift modeling<br/>[sar_drift.py]"]
  node_sar_zone["Search zones<br/>[sar_search_zone.py]"]
  node_sar_brief["Mission briefs"]
  node_sar_store[("SAR records<br/>[app.py]")]
end

node_user(("Mobile user"))
node_marine_provider(("Marine data provider"))

node_user -->|"opens"| node_app
node_app -->|"renders"| node_navigation
node_marine -->|"requests via"| node_client
node_client -->|"HTTP requests"| node_backend_api
node_network_sync -->|"triggers sync"| node_offline_sync
node_offline_sync -->|"reads and writes"| node_offline_db
node_client -->|"queues failures"| node_offline_sync
node_backend_api -->|"calculates risk"| node_risk
node_backend_api -->|"reads and writes"| node_sar_store
node_ingestion -.->|"fetches data"| node_marine_provider

click node_app "https://github.com/missionadak/orcav2/blob/main/apps/mobile/App.tsx"
click node_navigation "https://github.com/missionadak/orcav2/blob/main/apps/mobile/navigation/RootNavigator.tsx"
click node_home "https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/HomeScreen.tsx"
click node_map "https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/MapScreen.tsx"
click node_ai "https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/AIScreen.tsx"
click node_alerts "https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/AlertsScreen.tsx"
click node_sosmodal "https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/EmergencySOSModal.tsx"
click node_marine "https://github.com/missionadak/orcav2/blob/main/apps/mobile/services/marineService.ts"
click node_client "https://github.com/missionadak/orcav2/blob/main/apps/mobile/services/apiClient.ts"
click node_offline_db "https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/offlineDatabase.ts"
click node_offline_sync "https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/offlineSync.ts"
click node_network_sync "https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/useNetworkSync.ts"
click node_backend_api "https://github.com/missionadak/orcav2/blob/main/backend/app.py"
click node_risk "https://github.com/missionadak/orcav2/blob/main/backend/risk_engine.py"
click node_ingestion "https://github.com/missionadak/orcav2/blob/main/backend/data_ingestion.py"
click node_sar_service "https://github.com/missionadak/orcav2/blob/main/backend/rescue_service.py"
click node_sar_drift "https://github.com/missionadak/orcav2/blob/main/backend/sar_drift.py"
click node_sar_zone "https://github.com/missionadak/orcav2/blob/main/backend/sar_search_zone.py"
click node_sar_brief "https://github.com/missionadak/orcav2/blob/main/backend/sar_mission_brief.py"
click node_sar_store "https://github.com/missionadak/orcav2/blob/main/backend/app.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_navigation,node_home,node_map,node_ai,node_alerts,node_sosmodal,node_marine,node_client,node_user toneBlue
class node_offline_db,node_offline_sync,node_network_sync toneAmber
class node_backend_api,node_risk,node_ingestion toneMint
class node_sar_service,node_sar_drift,node_sar_zone,node_sar_brief,node_sar_store toneRose
class node_marine_provider toneIndigo
```

## Components

### Mobile app

- [App shell](https://github.com/missionadak/orcav2/blob/main/apps/mobile/App.tsx): `apps/mobile/App.tsx`
- [Root navigation](https://github.com/missionadak/orcav2/blob/main/apps/mobile/navigation/RootNavigator.tsx): `apps/mobile/navigation/RootNavigator.tsx`
- [Home screen](https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/HomeScreen.tsx): `apps/mobile/screens/HomeScreen.tsx`
- [Map screen](https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/MapScreen.tsx): `apps/mobile/screens/MapScreen.tsx`
- [AI screen](https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/AIScreen.tsx): `apps/mobile/screens/AIScreen.tsx`
- [Alerts screen](https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/AlertsScreen.tsx): `apps/mobile/screens/AlertsScreen.tsx`
- [Emergency SOS](https://github.com/missionadak/orcav2/blob/main/apps/mobile/screens/EmergencySOSModal.tsx): `apps/mobile/screens/EmergencySOSModal.tsx`
- [Marine service](https://github.com/missionadak/orcav2/blob/main/apps/mobile/services/marineService.ts): `apps/mobile/services/marineService.ts`
- [API client](https://github.com/missionadak/orcav2/blob/main/apps/mobile/services/apiClient.ts): `apps/mobile/services/apiClient.ts`

### Offline support

- [Offline database](https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/offlineDatabase.ts): `apps/mobile/utils/offlineDatabase.ts`
- [Offline sync](https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/offlineSync.ts): `apps/mobile/utils/offlineSync.ts`
- [Network sync hook](https://github.com/missionadak/orcav2/blob/main/apps/mobile/utils/useNetworkSync.ts): `apps/mobile/utils/useNetworkSync.ts`

### Backend services

- [ORCA API](https://github.com/missionadak/orcav2/blob/main/backend/app.py): `backend/app.py`
- [Risk scoring](https://github.com/missionadak/orcav2/blob/main/backend/risk_engine.py): `backend/risk_engine.py`
- [Marine data ingestion](https://github.com/missionadak/orcav2/blob/main/backend/data_ingestion.py): `backend/data_ingestion.py`

### SAR operations

- [Rescue services](https://github.com/missionadak/orcav2/blob/main/backend/rescue_service.py): `backend/rescue_service.py`
- [Drift modeling](https://github.com/missionadak/orcav2/blob/main/backend/sar_drift.py): `backend/sar_drift.py`
- [Search zones](https://github.com/missionadak/orcav2/blob/main/backend/sar_search_zone.py): `backend/sar_search_zone.py`
- [Mission briefs](https://github.com/missionadak/orcav2/blob/main/backend/sar_mission_brief.py): `backend/sar_mission_brief.py`
- [SAR records](https://github.com/missionadak/orcav2/blob/main/backend/app.py): `backend/app.py`

### Other components

- **Mobile user**
- **Marine data provider**

## Connections

- Mobile user → App shell: opens
- App shell → Root navigation: renders
- Marine service → API client: requests via
- API client → ORCA API: HTTP requests
- Network sync hook → Offline sync: triggers sync
- Offline sync → Offline database: reads and writes
- API client → Offline sync: queues failures
- ORCA API → Risk scoring: calculates risk
- ORCA API → SAR records: reads and writes
- Marine data ingestion → Marine data provider: fetches data
