# sankeerthvarma97-sys/atc-app architecture

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

- Interactive diagram: https://gitdiagram.com/sankeerthvarma97-sys/atc-app
- Repository: https://github.com/sankeerthvarma97-sys/atc-app

## Overview

AOCC is an educational airport-operations simulation. Operators use role-aware web consoles to monitor simulated traffic and airport resources, issue operational commands, and review events and metrics; passengers and staff have separate portal workflows. The simulation advances flights and virtual staff, while service modules handle operational and administrative domains. Persistence can use deterministic in-memory data or PostgreSQL. The README documents Socket.IO live updates, AI briefings, and optional provider integrations. Some UI, route, and service implementations were not sampled, so their unverified connections are omitted.

Main entry points: [`src/lib/simulation/simulation-manager.ts`](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/simulation-manager.ts) (Simulation manager), [`src/lib/prisma.ts`](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/prisma.ts) (PostgreSQL access), [`src/components/operations/operations-console.tsx`](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/operations/operations-console.tsx) (Operations console), [`src/lib/simulation/staff-engine.ts`](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/staff-engine.ts) (Virtual staff engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_console["Operations console"]
  node_authority["Authority center"]
  node_staff_portal["Staff portal"]
  node_passenger_portal["Passenger portal<br/>[page.tsx]"]
end

subgraph group_operations["Operations simulation"]
  node_ops_api["Operations endpoints<br/>[route.ts]"]
  node_simulation_api["Simulation endpoints<br/>[route.ts]"]
  node_simulation["Simulation manager"]
  node_flight_logic["Flight dynamics<br/>[logic.ts]"]
  node_staff_engine["Virtual staff engine<br/>[staff-engine.ts]"]
end

subgraph group_domain["Airport services"]
  node_flights["Flight services<br/>[flight-service.ts]"]
  node_fleet["Fleet and airports<br/>[fleet-service.ts]"]
  node_finance["Finance services"]
  node_payroll["Payroll services<br/>[payroll-service.ts]"]
  node_staff["Staff services<br/>[staff-service.ts]"]
  node_ai["AI briefings<br/>[briefing.ts]"]
end

subgraph group_platform["Identity and persistence"]
  node_auth["Session and permissions<br/>[permissions.ts]"]
  node_store["Operations repository"]
  node_memory[("Memory data<br/>[store.ts]")]
  node_database[("PostgreSQL access<br/>[prisma.ts]")]
  node_socket["Live updates<br/>[server.mjs]"]
end

node_operator(("Airport operator"))
node_passenger(("Passenger"))
node_external_ai{{"AI provider"}}
node_external_storage[("S3-compatible storage")]
node_email_provider{{"Resend email"}}

node_operator -->|"uses"| node_console
node_operator -->|"administers"| node_authority
node_passenger -.->|"uses"| node_passenger_portal
node_console -->|"operates through"| node_ops_api
node_ops_api -.->|"checks access"| node_auth
node_simulation_api -.->|"controls"| node_simulation
node_simulation -->|"ticks staff"| node_staff_engine
node_simulation -->|"lists flights"| node_flights
node_simulation -->|"advances flights"| node_flight_logic
node_simulation -.->|"reads financial summary"| node_finance
node_staff_engine -->|"stores staff"| node_database
node_staff_engine -.->|"uses fallback"| node_memory
node_staff_engine -->|"formats IDs"| node_staff
node_flights -->|"ensures airports"| node_fleet
node_flights -->|"queries flights"| node_database
node_simulation -->|"persists configuration"| node_database
node_store -->|"uses database"| node_database
node_store -->|"uses fallback"| node_memory
node_auth -->|"loads scoped staff"| node_database
node_auth -->|"loads demo user"| node_memory
node_payroll -->|"uses finance services"| node_finance
node_payroll -->|"uses staff services"| node_staff
node_console -->|"receives live updates"| node_socket
node_console -->|"shows briefing"| node_ai
node_ai -.->|"requests generation"| node_external_ai
node_external_storage -.->|"stores artifacts"| node_store
node_email_provider -.->|"sends notifications"| node_ops_api

click node_console "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/operations/operations-console.tsx"
click node_authority "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/authority/authority-control-center.tsx"
click node_staff_portal "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/staff/staff-portal-shell.tsx"
click node_passenger_portal "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/app/passenger/page.tsx"
click node_ops_api "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/app/api/operations/commands/route.ts"
click node_simulation_api "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/app/api/simulation/tick/route.ts"
click node_simulation "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/simulation-manager.ts"
click node_flight_logic "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/logic.ts"
click node_staff_engine "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/staff-engine.ts"
click node_flights "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/flight-service.ts"
click node_fleet "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/fleet-service.ts"
click node_finance "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/company-finance-service.ts"
click node_payroll "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/payroll-service.ts"
click node_staff "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/staff-service.ts"
click node_ai "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/ai/briefing.ts"
click node_auth "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/auth/permissions.ts"
click node_store "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/repositories/operations-repository.ts"
click node_memory "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/data/store.ts"
click node_database "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/prisma.ts"
click node_socket "https://github.com/sankeerthvarma97-sys/atc-app/blob/main/server.mjs"

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_console,node_authority,node_staff_portal,node_passenger_portal toneBlue
class node_ops_api,node_simulation_api,node_simulation,node_flight_logic,node_staff_engine,node_external_storage toneAmber
class node_flights,node_fleet,node_finance,node_payroll,node_staff,node_ai toneMint
class node_auth,node_store,node_memory,node_database,node_socket toneRose
class node_operator,node_passenger,node_external_ai,node_email_provider toneIndigo
```

## Components

### User experience

- [Operations console](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/operations/operations-console.tsx): `src/components/operations/operations-console.tsx`
- [Authority center](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/authority/authority-control-center.tsx): `src/components/authority/authority-control-center.tsx`
- [Staff portal](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/components/staff/staff-portal-shell.tsx): `src/components/staff/staff-portal-shell.tsx`
- [Passenger portal](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/app/passenger/page.tsx): `src/app/passenger/page.tsx`

### Operations simulation

- [Operations endpoints](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/app/api/operations/commands/route.ts): `src/app/api/operations/commands/route.ts`
- [Simulation endpoints](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/app/api/simulation/tick/route.ts): `src/app/api/simulation/tick/route.ts`
- [Simulation manager](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/simulation-manager.ts): `src/lib/simulation/simulation-manager.ts`
- [Flight dynamics](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/logic.ts): `src/lib/simulation/logic.ts`
- [Virtual staff engine](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/simulation/staff-engine.ts): `src/lib/simulation/staff-engine.ts`

### Airport services

- [Flight services](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/flight-service.ts): `src/lib/services/flight-service.ts`
- [Fleet and airports](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/fleet-service.ts): `src/lib/services/fleet-service.ts`
- [Finance services](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/company-finance-service.ts): `src/lib/services/company-finance-service.ts`
- [Payroll services](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/payroll-service.ts): `src/lib/services/payroll-service.ts`
- [Staff services](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/services/staff-service.ts): `src/lib/services/staff-service.ts`
- [AI briefings](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/ai/briefing.ts): `src/lib/ai/briefing.ts`

### Identity and persistence

- [Session and permissions](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/auth/permissions.ts): `src/lib/auth/permissions.ts`
- [Operations repository](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/repositories/operations-repository.ts): `src/lib/repositories/operations-repository.ts`
- [Memory data](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/data/store.ts): `src/lib/data/store.ts`
- [PostgreSQL access](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Live updates](https://github.com/sankeerthvarma97-sys/atc-app/blob/main/server.mjs): `server.mjs`

### Other components

- **Airport operator**
- **Passenger**
- **AI provider**
- **S3-compatible storage**
- **Resend email**

## Connections

- Airport operator → Operations console: uses
- Airport operator → Authority center: administers
- Passenger → Passenger portal: uses
- Operations console → Operations endpoints: operates through
- Operations endpoints → Session and permissions: checks access
- Simulation endpoints → Simulation manager: controls
- Simulation manager → Virtual staff engine: ticks staff (evidence: `src/lib/simulation/simulation-manager.ts`)
- Simulation manager → Flight services: lists flights (evidence: `src/lib/simulation/simulation-manager.ts`)
- Simulation manager → Flight dynamics: advances flights (evidence: `src/lib/simulation/simulation-manager.ts`)
- Simulation manager → Finance services: reads financial summary
- Virtual staff engine → PostgreSQL access: stores staff (evidence: `src/lib/simulation/staff-engine.ts`)
- Virtual staff engine → Memory data: uses fallback
- Virtual staff engine → Staff services: formats IDs
- Flight services → Fleet and airports: ensures airports (evidence: `src/lib/services/flight-service.ts`)
- Flight services → PostgreSQL access: queries flights (evidence: `src/lib/services/flight-service.ts`)
- Simulation manager → PostgreSQL access: persists configuration (evidence: `src/lib/simulation/simulation-manager.ts`)
- Operations repository → PostgreSQL access: uses database (evidence: `src/lib/repositories/operations-repository.ts`)
- Operations repository → Memory data: uses fallback (evidence: `src/lib/repositories/operations-repository.ts`)
- Session and permissions → PostgreSQL access: loads scoped staff
- Session and permissions → Memory data: loads demo user
- Payroll services → Finance services: uses finance services (evidence: `src/lib/services/payroll-service.ts`)
- Payroll services → Staff services: uses staff services (evidence: `src/lib/services/payroll-service.ts`)
- Operations console → Live updates: receives live updates
- Operations console → AI briefings: shows briefing
- AI briefings → AI provider: requests generation
- S3-compatible storage → Operations repository: stores artifacts
- Resend email → Operations endpoints: sends notifications
