# noormosia/nmushuttles architecture

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

- Interactive diagram: https://gitdiagram.com/noormosia/nmushuttles
- Repository: https://github.com/noormosia/nmushuttles

## Overview

NMU Shuttle is a shuttle-management backend, with an Android project also present in the tree but no Android runtime source or README description provided. The main user flow is student authentication and trip discovery, followed by booking; marshals validate bookings at boarding, while administrators configure schedules, routes, vehicles, and users. The backend also contains trip generation/lockout, waitlist, notification, breakdown, reporting, and analytics capabilities. Connections below rely on SOURCE INDEX references or the sampled check-in and database excerpts; unsampled subsystem behavior is represented without speculative call chains.

Main entry points: [`Backend/NmuShuttle.Api/Data/ShuttleDbContext.cs`](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Data/ShuttleDbContext.cs) (Shuttle database), [`Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs`](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs) (Trip lockout), [`Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs`](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs) (Rolling trip generation), [`Backend/NmuShuttle.Api/Controllers/BookingsController.cs`](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/BookingsController.cs) (Bookings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rider["Rider access"]
  node_auth["Authentication<br/>[AuthController.cs]"]
  node_trips["Trip discovery<br/>[TripsController.cs]"]
  node_bookings["Bookings"]
  node_booking_service["Booking rules<br/>[BookingService.cs]"]
end

subgraph group_operations["Trip operations"]
  node_marshal_trips["Marshal trips"]
  node_checkin["Boarding check-in"]
  node_checkin_service["Check-in rules<br/>[CheckInService.cs]"]
  node_breakdowns["Breakdown handling"]
  node_reports["Reports"]
end

subgraph group_admin["Administration"]
  node_admin_schedule["Schedule management"]
  node_admin_fleet["Fleet and stops"]
  node_admin_users["User management"]
  node_analytics["Admin analytics"]
end

subgraph group_platform["Backend services"]
  node_waitlist["Waitlist promotion"]
  node_trip_generation["Rolling trip generation"]
  node_lockout["Trip lockout"]
  node_notifications["Notifications"]
  node_clock["SAST clock<br/>[SastClock.cs]"]
  node_database[("Shuttle database")]
end

node_student(("Student"))
node_marshal(("Marshal"))
node_administrator(("Administrator"))

node_student -->|"authenticates"| node_auth
node_student -.->|"requests trips"| node_trips
node_student -.->|"books trip"| node_bookings
node_bookings -->|"delegates booking"| node_booking_service
node_booking_service -->|"reads and writes"| node_database
node_marshal -.->|"views assignments"| node_marshal_trips
node_marshal -.->|"checks in riders"| node_checkin
node_checkin -->|"delegates validation"| node_checkin_service
node_checkin_service -->|"validates and updates"| node_database
node_administrator -->|"manages schedules"| node_admin_schedule
node_admin_schedule -->|"reads and writes"| node_database
node_administrator -->|"manages fleet"| node_admin_fleet
node_admin_fleet -->|"reads and writes"| node_database
node_administrator -->|"manages users"| node_admin_users
node_admin_users -->|"reads and writes"| node_database
node_administrator -.->|"reviews analytics"| node_analytics
node_administrator -.->|"handles breakdowns"| node_breakdowns
node_administrator -.->|"reviews reports"| node_reports
node_trip_generation -->|"creates trips"| node_database
node_trip_generation -->|"uses SAST time"| node_clock
node_lockout -->|"reads schedules"| node_database
node_lockout -->|"uses SAST time"| node_clock
node_lockout -->|"promotes waitlist"| node_waitlist

click node_auth "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/AuthController.cs"
click node_trips "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/TripsController.cs"
click node_bookings "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/BookingsController.cs"
click node_booking_service "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/BookingService.cs"
click node_marshal_trips "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/MarshalTripsController.cs"
click node_checkin "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/CheckInController.cs"
click node_checkin_service "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/CheckInService.cs"
click node_breakdowns "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/BreakdownController.cs"
click node_reports "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/ReportsController.cs"
click node_admin_schedule "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/ScheduleAdminController.cs"
click node_admin_fleet "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/ShuttlesAdminController.cs"
click node_admin_users "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/UsersAdminController.cs"
click node_analytics "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/AnalyticsAdminController.cs"
click node_waitlist "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/WaitlistPromotionService.cs"
click node_trip_generation "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs"
click node_lockout "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs"
click node_notifications "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/NotificationService.cs"
click node_clock "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Infrastructure/SastClock.cs"
click node_database "https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Data/ShuttleDbContext.cs"

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_auth,node_trips,node_bookings,node_booking_service toneBlue
class node_marshal_trips,node_checkin,node_checkin_service,node_breakdowns,node_reports toneAmber
class node_admin_schedule,node_admin_fleet,node_admin_users,node_analytics toneMint
class node_waitlist,node_trip_generation,node_lockout,node_notifications,node_clock,node_database toneRose
class node_student,node_marshal,node_administrator toneIndigo
```

## Components

### Rider access

- [Authentication](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/AuthController.cs): `Backend/NmuShuttle.Api/Controllers/AuthController.cs`
- [Trip discovery](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/TripsController.cs): `Backend/NmuShuttle.Api/Controllers/TripsController.cs`
- [Bookings](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/BookingsController.cs): `Backend/NmuShuttle.Api/Controllers/BookingsController.cs`
- [Booking rules](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/BookingService.cs): `Backend/NmuShuttle.Api/Services/BookingService.cs`

### Trip operations

- [Marshal trips](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/MarshalTripsController.cs): `Backend/NmuShuttle.Api/Controllers/MarshalTripsController.cs`
- [Boarding check-in](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/CheckInController.cs): `Backend/NmuShuttle.Api/Controllers/CheckInController.cs`
- [Check-in rules](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/CheckInService.cs): `Backend/NmuShuttle.Api/Services/CheckInService.cs`
- [Breakdown handling](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/BreakdownController.cs): `Backend/NmuShuttle.Api/Controllers/BreakdownController.cs`
- [Reports](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/ReportsController.cs): `Backend/NmuShuttle.Api/Controllers/ReportsController.cs`

### Administration

- [Schedule management](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/ScheduleAdminController.cs): `Backend/NmuShuttle.Api/Controllers/Admin/ScheduleAdminController.cs`
- [Fleet and stops](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/ShuttlesAdminController.cs): `Backend/NmuShuttle.Api/Controllers/Admin/ShuttlesAdminController.cs`
- [User management](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/UsersAdminController.cs): `Backend/NmuShuttle.Api/Controllers/Admin/UsersAdminController.cs`
- [Admin analytics](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Controllers/Admin/AnalyticsAdminController.cs): `Backend/NmuShuttle.Api/Controllers/Admin/AnalyticsAdminController.cs`

### Backend services

- [Waitlist promotion](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/WaitlistPromotionService.cs): `Backend/NmuShuttle.Api/Services/WaitlistPromotionService.cs`
- [Rolling trip generation](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs): `Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs`
- [Trip lockout](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs): `Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs`
- [Notifications](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Services/NotificationService.cs): `Backend/NmuShuttle.Api/Services/NotificationService.cs`
- [SAST clock](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Infrastructure/SastClock.cs): `Backend/NmuShuttle.Api/Infrastructure/SastClock.cs`
- [Shuttle database](https://github.com/noormosia/nmushuttles/blob/master/Backend/NmuShuttle.Api/Data/ShuttleDbContext.cs): `Backend/NmuShuttle.Api/Data/ShuttleDbContext.cs`

### Other components

- **Student**
- **Marshal**
- **Administrator**

## Connections

- Student → Authentication: authenticates (evidence: `Backend/NmuShuttle.Api/Controllers/AuthController.cs`)
- Student → Trip discovery: requests trips
- Student → Bookings: books trip
- Bookings → Booking rules: delegates booking (evidence: `Backend/NmuShuttle.Api/Controllers/BookingsController.cs`)
- Booking rules → Shuttle database: reads and writes (evidence: `Backend/NmuShuttle.Api/Services/BookingService.cs`)
- Marshal → Marshal trips: views assignments
- Marshal → Boarding check-in: checks in riders
- Boarding check-in → Check-in rules: delegates validation (evidence: `Backend/NmuShuttle.Api/Controllers/CheckInController.cs`)
- Check-in rules → Shuttle database: validates and updates (evidence: `Backend/NmuShuttle.Api/Services/CheckInService.cs`)
- Administrator → Schedule management: manages schedules (evidence: `Backend/NmuShuttle.Api/Controllers/Admin/ScheduleAdminController.cs`)
- Schedule management → Shuttle database: reads and writes (evidence: `Backend/NmuShuttle.Api/Controllers/Admin/ScheduleAdminController.cs`)
- Administrator → Fleet and stops: manages fleet (evidence: `Backend/NmuShuttle.Api/Controllers/Admin/ShuttlesAdminController.cs`)
- Fleet and stops → Shuttle database: reads and writes (evidence: `Backend/NmuShuttle.Api/Controllers/Admin/ShuttlesAdminController.cs`)
- Administrator → User management: manages users (evidence: `Backend/NmuShuttle.Api/Controllers/Admin/UsersAdminController.cs`)
- User management → Shuttle database: reads and writes (evidence: `Backend/NmuShuttle.Api/Controllers/Admin/UsersAdminController.cs`)
- Administrator → Admin analytics: reviews analytics
- Administrator → Breakdown handling: handles breakdowns
- Administrator → Reports: reviews reports
- Rolling trip generation → Shuttle database: creates trips (evidence: `Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs`)
- Rolling trip generation → SAST clock: uses SAST time (evidence: `Backend/NmuShuttle.Api/BackgroundServices/RollingInjectionService.cs`)
- Trip lockout → Shuttle database: reads schedules (evidence: `Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs`)
- Trip lockout → SAST clock: uses SAST time (evidence: `Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs`)
- Trip lockout → Waitlist promotion: promotes waitlist (evidence: `Backend/NmuShuttle.Api/BackgroundServices/LockoutGateService.cs`)
