# akrayi/gcs-drone-control architecture

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

- Interactive diagram: https://gitdiagram.com/akrayi/gcs-drone-control
- Repository: https://github.com/akrayi/gcs-drone-control
- Video tour (about a minute): https://gitdiagram.com/akrayi/gcs-drone-control/video

## Overview

GCS Drone Control is a simulator ground-control station for multiple operators sharing one drone state. Operators sign in, view synchronized telemetry and command history, issue flight or safety commands, and admins manage accounts. The API authenticates and authorizes requests, then serializes state changes and command receipts in PostgreSQL; OPA supplies policy decisions. The graph focuses on runtime product behavior, not deployment or CI. Some frontend wiring is only partially excerpted, so the AdminPanel connection is marked unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/App.jsx) (Dashboard app), [`backend/app/main.py`](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/main.py) (HTTP and WebSocket API), [`backend/app/service.py`](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/service.py) (Command and snapshots), [`backend/app/security.py`](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/security.py) (Authentication and policy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Operator dashboard"]
  node_app["Dashboard app<br/>[App.jsx]"]
  node_login["Sign-in form<br/>[Login.jsx]"]
  node_flightmap["Flight map<br/>[FlightMap.jsx]"]
  node_adminpanel["Account management<br/>[AdminPanel.jsx]"]
end

subgraph group_api["API and identity"]
  node_api["HTTP and WebSocket API<br/>[main.py]"]
  node_security["Authentication and policy<br/>[security.py]"]
end

subgraph group_simulation["Flight simulation"]
  node_service["Command and snapshots<br/>[service.py]"]
  node_domain["Flight transitions<br/>[domain.py]"]
end

subgraph group_integrations["Policy and storage"]
  node_dbmodels["Persistent models<br/>[db.py]"]
  node_postgres[("PostgreSQL")]
  node_opa["OPA policy<br/>[authz.rego]"]
end

node_operators(("Operators"))

node_operators -->|"operate dashboard"| node_app
node_app -->|"renders"| node_login
node_app -->|"renders"| node_flightmap
node_app -.->|"uses"| node_adminpanel
node_app -->|"sends HTTP and WebSocket"| node_api
node_api -->|"authenticates and authorizes"| node_security
node_api -->|"executes and snapshots"| node_service
node_api -->|"queries users"| node_dbmodels
node_api -->|"checks readiness"| node_opa
node_security -->|"loads user"| node_dbmodels
node_security -->|"requests decision"| node_opa
node_service -->|"authenticates and authorizes"| node_security
node_service -->|"applies transitions"| node_domain
node_service -->|"locks and records"| node_dbmodels
node_dbmodels -->|"persists records"| node_postgres

click node_app "https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/components/Login.jsx"
click node_flightmap "https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/components/FlightMap.jsx"
click node_adminpanel "https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/components/AdminPanel.jsx"
click node_api "https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/main.py"
click node_security "https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/security.py"
click node_service "https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/service.py"
click node_domain "https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/domain.py"
click node_dbmodels "https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/db.py"
click node_opa "https://github.com/akrayi/gcs-drone-control/blob/main/policy/authz.rego"

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_login,node_flightmap,node_adminpanel toneBlue
class node_api,node_security toneAmber
class node_service,node_domain toneMint
class node_dbmodels,node_postgres,node_opa toneRose
class node_operators toneIndigo
```

## Components

### Operator dashboard

- [Dashboard app](https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in form](https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/components/Login.jsx): `frontend/src/components/Login.jsx`
- [Flight map](https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/components/FlightMap.jsx): `frontend/src/components/FlightMap.jsx`
- [Account management](https://github.com/akrayi/gcs-drone-control/blob/main/frontend/src/components/AdminPanel.jsx): `frontend/src/components/AdminPanel.jsx`

### API and identity

- [HTTP and WebSocket API](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication and policy](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/security.py): `backend/app/security.py`

### Flight simulation

- [Command and snapshots](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/service.py): `backend/app/service.py`
- [Flight transitions](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/domain.py): `backend/app/domain.py`

### Policy and storage

- [Persistent models](https://github.com/akrayi/gcs-drone-control/blob/main/backend/app/db.py): `backend/app/db.py`
- **PostgreSQL**
- [OPA policy](https://github.com/akrayi/gcs-drone-control/blob/main/policy/authz.rego): `policy/authz.rego`

### Other components

- **Operators**

## Connections

- Operators → Dashboard app: operate dashboard (evidence: `README.md`)
- Dashboard app → Sign-in form: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Flight map: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Account management: uses (evidence: `frontend/src/App.jsx`)
- Dashboard app → HTTP and WebSocket API: sends HTTP and WebSocket (evidence: `frontend/src/App.jsx`)
- HTTP and WebSocket API → Authentication and policy: authenticates and authorizes (evidence: `backend/app/main.py`)
- HTTP and WebSocket API → Command and snapshots: executes and snapshots (evidence: `backend/app/main.py`)
- HTTP and WebSocket API → Persistent models: queries users (evidence: `backend/app/main.py`)
- HTTP and WebSocket API → OPA policy: checks readiness (evidence: `backend/app/main.py`)
- Authentication and policy → Persistent models: loads user (evidence: `backend/app/security.py`)
- Authentication and policy → OPA policy: requests decision (evidence: `backend/app/security.py`)
- Command and snapshots → Authentication and policy: authenticates and authorizes (evidence: `backend/app/service.py`)
- Command and snapshots → Flight transitions: applies transitions (evidence: `backend/app/service.py`)
- Command and snapshots → Persistent models: locks and records (evidence: `backend/app/service.py`)
- Persistent models → PostgreSQL: persists records (evidence: `README.md`)
