# edtheninja/airhive architecture

> Architecture diagram of the GitHub repository edtheninja/airhive, 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/edtheninja/airhive
- Repository: https://github.com/edtheninja/airhive

## Overview

AirHive is an airline operations management system: staff use the operations interface to monitor and manage flights and related airline resources, while passengers have a role-specific dashboard. The React frontend communicates with a Spring Boot REST backend; the backend also provides authentication, analytics, notifications, and real-time updates. The README documents PostgreSQL and Redis, but sampled source does not establish all storage or integration wiring. Several backend capabilities are represented at their exact source directories because their implementations were not excerpted.

Main entry points: [`src/lib/api/client.ts`](https://github.com/edtheninja/airhive/blob/main/src/lib/api/client.ts) (REST client), [`backend/src/main/java/com/airhive/backend/service/FlightService.java`](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/FlightService.java) (Flight operations), [`src/routes/index.tsx`](https://github.com/edtheninja/airhive/blob/main/src/routes/index.tsx) (Operations dashboard), [`src/components/passenger/passenger-dashboard.tsx`](https://github.com/edtheninja/airhive/blob/main/src/components/passenger/passenger-dashboard.tsx) (Passenger dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Operations Interface"]
  node_dashboard["Operations dashboard<br/>[index.tsx]"]
  node_passenger_view["Passenger dashboard"]
  node_route_view["Route list<br/>[routes.index.tsx]"]
  node_frontend_ops["Operations pages"]
  node_api_client["REST client<br/>[client.ts]"]
  node_auth_context["Auth context<br/>[auth-context.tsx]"]
  node_session["Browser session<br/>[session.ts]"]
end

subgraph group_backend["Airline Operations"]
  node_flight_controller["Flight API"]
  node_booking_controller["Booking API"]
  node_route_controller["Route API"]
  node_flight_service["Flight operations<br/>[FlightService.java]"]
  node_route_service["Route management<br/>[RouteService.java]"]
  node_resource_services["Fleet and airport services"]
  node_people_services["Passenger and crew services"]
  node_booking_service["Booking management"]
  node_maintenance_service["Maintenance management"]
  node_auth_api["Authentication API"]
end

subgraph group_identity["Identity and Live Updates"]
  node_auth_service["Authentication service<br/>[AuthService.java]"]
  node_jwt["JWT service<br/>[JwtService.java]"]
  node_flight_live["Flight live updates"]
  node_notifications["Notifications"]
end

subgraph group_insights["Analytics and State"]
  node_analytics["Operational analytics"]
  node_database[("PostgreSQL")]
  node_cache[("Redis cache")]
end

node_operator(("Staff user"))
node_passenger(("Passenger"))

node_operator -->|"uses"| node_dashboard
node_passenger -.->|"uses"| node_passenger_view
node_dashboard -->|"selects by role"| node_passenger_view
node_route_view -->|"requests routes"| node_api_client
node_frontend_ops -.->|"calls REST API"| node_api_client
node_passenger_view -->|"loads bookings and flights"| node_api_client
node_auth_context -->|"saves session"| node_session
node_auth_context -.->|"authenticates via API"| node_auth_api
node_api_client -->|"reads token"| node_session
node_api_client -.->|"sends REST requests"| node_flight_controller
node_api_client -.->|"sends REST requests"| node_booking_controller
node_api_client -.->|"sends REST requests"| node_route_controller
node_flight_controller -->|"delegates"| node_flight_service
node_booking_controller -->|"delegates"| node_booking_service
node_route_controller -.->|"delegates"| node_route_service
node_auth_api -.->|"delegates"| node_auth_service
node_auth_service -->|"creates tokens"| node_jwt
node_flight_service -->|"publishes events"| node_flight_live
node_dashboard -.->|"views operational metrics"| node_analytics
node_flight_service -.->|"persists operations"| node_database
node_resource_services -.->|"manages records"| node_database
node_people_services -.->|"manages records"| node_database
node_booking_service -.->|"manages bookings"| node_database
node_maintenance_service -.->|"manages maintenance"| node_database
node_analytics -.->|"reads operations history"| node_database
node_flight_service -.->|"uses caching"| node_cache

click node_dashboard "https://github.com/edtheninja/airhive/blob/main/src/routes/index.tsx"
click node_passenger_view "https://github.com/edtheninja/airhive/blob/main/src/components/passenger/passenger-dashboard.tsx"
click node_route_view "https://github.com/edtheninja/airhive/blob/main/src/routes/routes.index.tsx"
click node_frontend_ops "https://github.com/edtheninja/airhive/tree/main/src/routes"
click node_api_client "https://github.com/edtheninja/airhive/blob/main/src/lib/api/client.ts"
click node_auth_context "https://github.com/edtheninja/airhive/blob/main/src/lib/auth/auth-context.tsx"
click node_session "https://github.com/edtheninja/airhive/blob/main/src/lib/auth/session.ts"
click node_flight_controller "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/FlightController.java"
click node_booking_controller "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/BookingController.java"
click node_route_controller "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/RouteController.java"
click node_flight_service "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/FlightService.java"
click node_route_service "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/RouteService.java"
click node_resource_services "https://github.com/edtheninja/airhive/tree/main/backend/src/main/java/com/airhive/backend/service"
click node_people_services "https://github.com/edtheninja/airhive/tree/main/backend/src/main/java/com/airhive/backend/service"
click node_booking_service "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/BookingService.java"
click node_maintenance_service "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/MaintenanceService.java"
click node_auth_api "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/AuthController.java"
click node_auth_service "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/AuthService.java"
click node_jwt "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/security/JwtService.java"
click node_flight_live "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/FlightWebSocketService.java"
click node_notifications "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/NotificationService.java"
click node_analytics "https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/AnalyticsService.java"

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_passenger_view,node_route_view,node_frontend_ops,node_api_client,node_auth_context,node_session,node_operator toneBlue
class node_flight_controller,node_booking_controller,node_route_controller,node_flight_service,node_route_service,node_resource_services,node_people_services,node_booking_service,node_maintenance_service,node_auth_api toneAmber
class node_auth_service,node_jwt,node_flight_live,node_notifications toneMint
class node_analytics,node_database,node_cache toneRose
class node_passenger toneIndigo
```

## Components

### Operations Interface

- [Operations dashboard](https://github.com/edtheninja/airhive/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Passenger dashboard](https://github.com/edtheninja/airhive/blob/main/src/components/passenger/passenger-dashboard.tsx): `src/components/passenger/passenger-dashboard.tsx`
- [Route list](https://github.com/edtheninja/airhive/blob/main/src/routes/routes.index.tsx): `src/routes/routes.index.tsx`
- [Operations pages](https://github.com/edtheninja/airhive/tree/main/src/routes): `src/routes`
- [REST client](https://github.com/edtheninja/airhive/blob/main/src/lib/api/client.ts): `src/lib/api/client.ts`
- [Auth context](https://github.com/edtheninja/airhive/blob/main/src/lib/auth/auth-context.tsx): `src/lib/auth/auth-context.tsx`
- [Browser session](https://github.com/edtheninja/airhive/blob/main/src/lib/auth/session.ts): `src/lib/auth/session.ts`

### Airline Operations

- [Flight API](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/FlightController.java): `backend/src/main/java/com/airhive/backend/controller/FlightController.java`
- [Booking API](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/BookingController.java): `backend/src/main/java/com/airhive/backend/controller/BookingController.java`
- [Route API](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/RouteController.java): `backend/src/main/java/com/airhive/backend/controller/RouteController.java`
- [Flight operations](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/FlightService.java): `backend/src/main/java/com/airhive/backend/service/FlightService.java`
- [Route management](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/RouteService.java): `backend/src/main/java/com/airhive/backend/service/RouteService.java`
- [Fleet and airport services](https://github.com/edtheninja/airhive/tree/main/backend/src/main/java/com/airhive/backend/service): `backend/src/main/java/com/airhive/backend/service`
- [Passenger and crew services](https://github.com/edtheninja/airhive/tree/main/backend/src/main/java/com/airhive/backend/service): `backend/src/main/java/com/airhive/backend/service`
- [Booking management](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/BookingService.java): `backend/src/main/java/com/airhive/backend/service/BookingService.java`
- [Maintenance management](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/MaintenanceService.java): `backend/src/main/java/com/airhive/backend/service/MaintenanceService.java`
- [Authentication API](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/controller/AuthController.java): `backend/src/main/java/com/airhive/backend/controller/AuthController.java`

### Identity and Live Updates

- [Authentication service](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/AuthService.java): `backend/src/main/java/com/airhive/backend/service/AuthService.java`
- [JWT service](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/security/JwtService.java): `backend/src/main/java/com/airhive/backend/security/JwtService.java`
- [Flight live updates](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/FlightWebSocketService.java): `backend/src/main/java/com/airhive/backend/service/FlightWebSocketService.java`
- [Notifications](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/NotificationService.java): `backend/src/main/java/com/airhive/backend/service/NotificationService.java`

### Analytics and State

- [Operational analytics](https://github.com/edtheninja/airhive/blob/main/backend/src/main/java/com/airhive/backend/service/AnalyticsService.java): `backend/src/main/java/com/airhive/backend/service/AnalyticsService.java`
- **PostgreSQL**
- **Redis cache**

### Other components

- **Staff user**
- **Passenger**

## Connections

- Staff user → Operations dashboard: uses (evidence: `src/routes/index.tsx`)
- Passenger → Passenger dashboard: uses (evidence: `README.md`)
- Operations dashboard → Passenger dashboard: selects by role (evidence: `src/routes/index.tsx`)
- Route list → REST client: requests routes
- Operations pages → REST client: calls REST API (evidence: `README.md`)
- Passenger dashboard → REST client: loads bookings and flights (evidence: `src/components/passenger/passenger-dashboard.tsx`)
- Auth context → Browser session: saves session (evidence: `src/lib/auth/auth-context.tsx`)
- Auth context → Authentication API: authenticates via API (evidence: `README.md`)
- REST client → Browser session: reads token (evidence: `src/lib/api/client.ts`)
- REST client → Flight API: sends REST requests (evidence: `README.md`)
- REST client → Booking API: sends REST requests (evidence: `README.md`)
- REST client → Route API: sends REST requests (evidence: `README.md`)
- Flight API → Flight operations: delegates (evidence: `backend/src/main/java/com/airhive/backend/controller/FlightController.java`)
- Booking API → Booking management: delegates (evidence: `backend/src/main/java/com/airhive/backend/controller/BookingController.java`)
- Route API → Route management: delegates
- Authentication API → Authentication service: delegates
- Authentication service → JWT service: creates tokens (evidence: `backend/src/main/java/com/airhive/backend/service/AuthService.java`)
- Flight operations → Flight live updates: publishes events (evidence: `backend/src/main/java/com/airhive/backend/service/FlightService.java`)
- Operations dashboard → Operational analytics: views operational metrics (evidence: `README.md`)
- Flight operations → PostgreSQL: persists operations (evidence: `README.md`)
- Fleet and airport services → PostgreSQL: manages records (evidence: `README.md`)
- Passenger and crew services → PostgreSQL: manages records (evidence: `README.md`)
- Booking management → PostgreSQL: manages bookings (evidence: `README.md`)
- Maintenance management → PostgreSQL: manages maintenance (evidence: `README.md`)
- Operational analytics → PostgreSQL: reads operations history (evidence: `README.md`)
- Flight operations → Redis cache: uses caching (evidence: `README.md`)
