# tog10safety/towems architecture

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

- Interactive diagram: https://gitdiagram.com/tog10safety/towems
- Repository: https://github.com/tog10safety/towems

## Overview

TOWEMS is an operational management system with a React web client and Django backend, supporting mission planning, command structure, personnel, resources, mapping, safety, and risk workflows. A user enters through the authenticated application, works in a domain screen such as mission planning or inventory, and submits requests through the shared API client to backend endpoints and domain services that operate on legacy and additive database tables. The excerpts establish frontend routing, authentication, API behavior, and selected service/model relationships; many domain screens and backend routes are listed but not sampled, so their links are omitted or marked unverified.

Main entry points: [`toms_backend/apps/ops/services.py`](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/services.py) (Operations Services), [`toms_frontend/src/App.jsx`](https://github.com/tog10safety/towems/blob/main/toms_frontend/src/App.jsx) (Application Router), [`toms_backend/apps/core/roles.py`](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/roles.py) (Access Policy), [`toms_backend/apps/command/services.py`](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/command/services.py) (Command Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web Client"]
  node_app["Application Router<br/>[App.jsx]"]
  node_auth["Authentication Context<br/>[AuthContext.jsx]"]
  node_api["API Client<br/>[client.js]"]
  node_mission_ui["Mission Planning"]
  node_inventory_ui["Inventory Screen<br/>[InventoryPage.jsx]"]
  node_other_screens["Other Domain Screens"]
end

subgraph group_identity["Identity and Command"]
  node_accounts["Accounts and Profiles"]
  node_command_service["Command Services<br/>[services.py]"]
  node_command_data[("Command Records<br/>[models.py]")]
  node_access["Access Policy<br/>[roles.py]"]
  node_permissions["Request Permissions<br/>[permissions.py]"]
  node_scoping["Data Scoping<br/>[scoping.py]"]
end

subgraph group_operations["Operations"]
  node_ops_services["Operations Services<br/>[services.py]"]
  node_ops_models[("Operations Records<br/>[models.py]")]
  node_ops_notifications["Notifications<br/>[notifications.py]"]
  node_aor["AOR Handoff<br/>[aor_handoff.py]"]
  node_risk_safety["Risk and Safety"]
  node_air_mobility["Air and Mobility"]
end

subgraph group_data["Persistence"]
  node_legacy_data[("Legacy Records<br/>[models.py]")]
  node_account_data[("Personnel Records<br/>[models.py]")]
end

node_operator(("Operator"))
node_backend_api["Django API<br/>[urls.py]"]

node_operator -->|"uses"| node_app
node_app -->|"routes to"| node_mission_ui
node_app -->|"routes to"| node_inventory_ui
node_app -->|"routes to"| node_other_screens
node_auth -->|"requests through"| node_api
node_app -->|"provides context"| node_auth
node_mission_ui -->|"calls"| node_api
node_inventory_ui -->|"calls"| node_api
node_api -.->|"sends HTTP requests"| node_backend_api
node_command_service -->|"writes"| node_command_data
node_command_service -->|"reads"| node_legacy_data
node_command_service -->|"reads"| node_account_data
node_command_service -->|"uses"| node_ops_notifications
node_ops_services -->|"reads and writes"| node_ops_models
node_ops_services -->|"uses"| node_aor
node_ops_services -->|"checks capabilities"| node_access
node_ops_services -->|"uses"| node_permissions
node_ops_services -->|"uses"| node_scoping
node_ops_notifications -->|"reads"| node_ops_models
node_access -->|"reads hierarchy"| node_legacy_data
node_access -->|"reads appointments"| node_command_data
node_access -->|"uses ownership"| node_account_data
node_permissions -->|"uses policy"| node_access
node_scoping -->|"uses"| node_permissions
node_scoping -->|"scopes by"| node_legacy_data
node_accounts -.->|"manages"| node_account_data
node_risk_safety -.->|"uses records"| node_ops_models
node_air_mobility -.->|"uses records"| node_ops_models

click node_app "https://github.com/tog10safety/towems/blob/main/toms_frontend/src/App.jsx"
click node_auth "https://github.com/tog10safety/towems/blob/main/toms_frontend/src/auth/AuthContext.jsx"
click node_api "https://github.com/tog10safety/towems/blob/main/toms_frontend/src/api/client.js"
click node_mission_ui "https://github.com/tog10safety/towems/blob/main/toms_frontend/src/pages/MissionFormPage.jsx"
click node_inventory_ui "https://github.com/tog10safety/towems/blob/main/toms_frontend/src/pages/InventoryPage.jsx"
click node_other_screens "https://github.com/tog10safety/towems/tree/main/toms_frontend/src/pages"
click node_accounts "https://github.com/tog10safety/towems/tree/main/toms_backend/apps/accounts"
click node_command_service "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/command/services.py"
click node_command_data "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/command/models.py"
click node_access "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/roles.py"
click node_permissions "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/permissions.py"
click node_scoping "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/scoping.py"
click node_ops_services "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/services.py"
click node_ops_models "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/models.py"
click node_ops_notifications "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/notifications.py"
click node_aor "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/aor_handoff.py"
click node_risk_safety "https://github.com/tog10safety/towems/tree/main/toms_backend/apps/ops"
click node_air_mobility "https://github.com/tog10safety/towems/tree/main/toms_backend/apps/ops"
click node_legacy_data "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/legacy/models.py"
click node_account_data "https://github.com/tog10safety/towems/blob/main/toms_backend/apps/accounts/models.py"
click node_backend_api "https://github.com/tog10safety/towems/blob/main/toms_backend/toms/urls.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_auth,node_api,node_mission_ui,node_inventory_ui,node_other_screens toneBlue
class node_accounts,node_command_service,node_command_data,node_access,node_permissions,node_scoping toneAmber
class node_ops_services,node_ops_models,node_ops_notifications,node_aor,node_risk_safety,node_air_mobility,node_backend_api toneMint
class node_legacy_data,node_account_data toneRose
class node_operator toneIndigo
```

## Components

### Web Client

- [Application Router](https://github.com/tog10safety/towems/blob/main/toms_frontend/src/App.jsx): `toms_frontend/src/App.jsx`
- [Authentication Context](https://github.com/tog10safety/towems/blob/main/toms_frontend/src/auth/AuthContext.jsx): `toms_frontend/src/auth/AuthContext.jsx`
- [API Client](https://github.com/tog10safety/towems/blob/main/toms_frontend/src/api/client.js): `toms_frontend/src/api/client.js`
- [Mission Planning](https://github.com/tog10safety/towems/blob/main/toms_frontend/src/pages/MissionFormPage.jsx): `toms_frontend/src/pages/MissionFormPage.jsx`
- [Inventory Screen](https://github.com/tog10safety/towems/blob/main/toms_frontend/src/pages/InventoryPage.jsx): `toms_frontend/src/pages/InventoryPage.jsx`
- [Other Domain Screens](https://github.com/tog10safety/towems/tree/main/toms_frontend/src/pages): `toms_frontend/src/pages`

### Identity and Command

- [Accounts and Profiles](https://github.com/tog10safety/towems/tree/main/toms_backend/apps/accounts): `toms_backend/apps/accounts`
- [Command Services](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/command/services.py): `toms_backend/apps/command/services.py`
- [Command Records](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/command/models.py): `toms_backend/apps/command/models.py`
- [Access Policy](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/roles.py): `toms_backend/apps/core/roles.py`
- [Request Permissions](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/permissions.py): `toms_backend/apps/core/permissions.py`
- [Data Scoping](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/core/scoping.py): `toms_backend/apps/core/scoping.py`

### Operations

- [Operations Services](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/services.py): `toms_backend/apps/ops/services.py`
- [Operations Records](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/models.py): `toms_backend/apps/ops/models.py`
- [Notifications](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/notifications.py): `toms_backend/apps/ops/notifications.py`
- [AOR Handoff](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/ops/aor_handoff.py): `toms_backend/apps/ops/aor_handoff.py`
- [Risk and Safety](https://github.com/tog10safety/towems/tree/main/toms_backend/apps/ops): `toms_backend/apps/ops`
- [Air and Mobility](https://github.com/tog10safety/towems/tree/main/toms_backend/apps/ops): `toms_backend/apps/ops`

### Persistence

- [Legacy Records](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/legacy/models.py): `toms_backend/apps/legacy/models.py`
- [Personnel Records](https://github.com/tog10safety/towems/blob/main/toms_backend/apps/accounts/models.py): `toms_backend/apps/accounts/models.py`

### Other components

- **Operator**
- [Django API](https://github.com/tog10safety/towems/blob/main/toms_backend/toms/urls.py): `toms_backend/toms/urls.py`

## Connections

- Operator → Application Router: uses (evidence: `toms_frontend/src/App.jsx`)
- Application Router → Mission Planning: routes to (evidence: `toms_frontend/src/App.jsx`)
- Application Router → Inventory Screen: routes to (evidence: `toms_frontend/src/App.jsx`)
- Application Router → Other Domain Screens: routes to (evidence: `toms_frontend/src/App.jsx`)
- Authentication Context → API Client: requests through (evidence: `toms_frontend/src/auth/AuthContext.jsx`)
- Application Router → Authentication Context: provides context (evidence: `toms_frontend/src/main.jsx`)
- Mission Planning → API Client: calls (evidence: `toms_frontend/src/pages/MissionFormPage.jsx`)
- Inventory Screen → API Client: calls (evidence: `toms_frontend/src/pages/InventoryPage.jsx`)
- API Client → Django API: sends HTTP requests
- Command Services → Command Records: writes (evidence: `toms_backend/apps/command/services.py`)
- Command Services → Legacy Records: reads (evidence: `toms_backend/apps/command/services.py`)
- Command Services → Personnel Records: reads (evidence: `toms_backend/apps/command/services.py`)
- Command Services → Notifications: uses (evidence: `toms_backend/apps/command/services.py`)
- Operations Services → Operations Records: reads and writes (evidence: `toms_backend/apps/ops/services.py`)
- Operations Services → AOR Handoff: uses (evidence: `toms_backend/apps/ops/services.py`)
- Operations Services → Access Policy: checks capabilities (evidence: `toms_backend/apps/ops/services.py`)
- Operations Services → Request Permissions: uses (evidence: `toms_backend/apps/ops/services.py`)
- Operations Services → Data Scoping: uses (evidence: `toms_backend/apps/ops/services.py`)
- Notifications → Operations Records: reads (evidence: `toms_backend/apps/ops/notifications.py`)
- Access Policy → Legacy Records: reads hierarchy (evidence: `toms_backend/apps/core/roles.py`)
- Access Policy → Command Records: reads appointments (evidence: `toms_backend/apps/core/roles.py`)
- Access Policy → Personnel Records: uses ownership (evidence: `toms_backend/apps/core/roles.py`)
- Request Permissions → Access Policy: uses policy (evidence: `toms_backend/apps/core/permissions.py`)
- Data Scoping → Request Permissions: uses (evidence: `toms_backend/apps/core/scoping.py`)
- Data Scoping → Legacy Records: scopes by (evidence: `toms_backend/apps/core/scoping.py`)
- Accounts and Profiles → Personnel Records: manages (evidence: `toms_backend/apps/accounts/profile.py`)
- Risk and Safety → Operations Records: uses records (evidence: `toms_backend/apps/ops/services.py`)
- Air and Mobility → Operations Records: uses records (evidence: `toms_backend/apps/ops/services.py`)
