# upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend architecture

> Architecture diagram of the GitHub repository upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend
- Repository: https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend

## Overview

RutaSegura is a backend for school-transport operations: IAM and Administration manage organizations, fleets and routes; families register students and enroll them; Trip-Tracking runs journeys; Notification consumes trip events and provides a durable inbox and push channels. The documented end-to-end flow crosses these bounded contexts through HTTP and messaging, with a gateway as the app entry point. Edges are limited to relationships explicit in the README or sampled source; some service internals and wiring are unsampled, so their connections are omitted rather than inferred.

Main entry points: [`src/Monolith/Program.cs`](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Program.cs) (Monolith host), [`src/Monolith/Administration/Domain/Model/Aggregates/Route.cs`](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Domain/Model/Aggregates/Route.cs) (Route operations), [`src/ApiGateway/Proxy/ProxyPipeline.cs`](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/ApiGateway/Proxy/ProxyPipeline.cs) (API gateway), [`src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/TripsController.cs`](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/TripsController.cs) (Trip HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and identity"]
  node_gateway["API gateway<br/>[ProxyPipeline.cs]"]
  node_iam["IAM accounts<br/>[User.cs]"]
end

subgraph group_operations["Monolith operations"]
  node_admin["Route operations<br/>[Route.cs]"]
  node_roster["Driver roster<br/>[Driver.cs]"]
  node_stakeholder["Family and enrollment<br/>[Student.cs]"]
  node_subscription["Plans and quotas<br/>[Plan.cs]"]
  node_monolith["Monolith host<br/>[Program.cs]"]
end

subgraph group_journeys["Trip tracking"]
  node_tripapi["Trip HTTP API<br/>[TripsController.cs]"]
  node_tripdomain["Trip lifecycle<br/>[Trip.cs]"]
  node_tripstore[("Trip persistence<br/>[Repositories.cs]")]
  node_scheduling["Trip scheduling"]
  node_tracking["Location tracking<br/>[MeController.cs]"]
  node_trip_events["Trip event exchange"]
end

subgraph group_alerts["Notifications"]
  node_notification_api["Notification HTTP API"]
  node_notification["Notification inbox<br/>[Notification.cs]"]
  node_receive_event["Trip event handler"]
  node_channels["Delivery channels"]
  node_push["Push subscriptions"]
end

node_apps(("Mobile and web apps"))
node_rabbit["RabbitMQ"]
node_fcm["Firebase Cloud Messaging"]
node_db[("MySQL stores")]

node_apps -->|"sends requests"| node_gateway
node_gateway -->|"proxies routes"| node_monolith
node_gateway -->|"proxies routes"| node_tripapi
node_gateway -->|"proxies routes"| node_notification_api
node_apps -->|"uses IAM"| node_monolith
node_monolith -->|"hosts accounts"| node_iam
node_monolith -->|"hosts operations"| node_admin
node_monolith -->|"hosts enrollment"| node_stakeholder
node_monolith -->|"hosts plans"| node_subscription
node_roster -->|"assigns drivers"| node_admin
node_subscription -->|"supplies quota"| node_admin
node_stakeholder -->|"requests route planning"| node_admin
node_tripapi -.->|"handles trips"| node_tripdomain
node_tripapi -.->|"persists trips"| node_tripstore
node_scheduling -.->|"stores schedules"| node_tripstore
node_trip_events -->|"updates alerts and records"| node_admin
node_trip_events -->|"consumes events"| node_rabbit
node_tripapi -->|"publishes events"| node_rabbit
node_receive_event -.->|"creates inbox entries"| node_notification
node_rabbit -->|"delivers trip events"| node_receive_event
node_notification_api -.->|"reads inbox"| node_notification
node_push -.->|"manages subscriptions"| node_channels
node_channels -.->|"delivers push"| node_fcm
node_notification -->|"persists inbox"| node_db
node_tripstore -.->|"persists journeys"| node_db
node_tracking -.->|"records journey data"| node_tripdomain

click node_gateway "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/ApiGateway/Proxy/ProxyPipeline.cs"
click node_iam "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Iam/Domain/Model/Aggregates/User.cs"
click node_admin "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Domain/Model/Aggregates/Route.cs"
click node_roster "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Domain/Model/Aggregates/Driver.cs"
click node_stakeholder "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Stakeholder/Domain/Model/Aggregates/Student.cs"
click node_subscription "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Subscription/Domain/Model/Aggregates/Plan.cs"
click node_monolith "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Program.cs"
click node_tripapi "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/TripsController.cs"
click node_tripdomain "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Domain/Trips/Trip.cs"
click node_tripstore "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Infrastructure/Persistence/Repositories/Repositories.cs"
click node_scheduling "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Infrastructure/Scheduling/TripSchedulingWorker.cs"
click node_tracking "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/MeController.cs"
click node_trip_events "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Infrastructure/Messaging/Inbound/TripTrackingEventsConsumer.cs"
click node_notification_api "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/NotificationsController.cs"
click node_notification "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Domain/Model/Aggregates/Notification.cs"
click node_receive_event "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Application/Internal/CommandServices/Handlers/ReceiveTripEventHandler.cs"
click node_channels "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Infrastructure/Channels/NotificationChannelWorker.cs"
click node_push "https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/PushSubscriptionsController.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_gateway,node_iam toneBlue
class node_admin,node_roster,node_stakeholder,node_subscription,node_monolith,node_db toneAmber
class node_tripapi,node_tripdomain,node_tripstore,node_scheduling,node_tracking,node_trip_events toneMint
class node_notification_api,node_notification,node_receive_event,node_channels,node_push toneRose
class node_apps,node_rabbit,node_fcm toneIndigo
```

## Components

### Entry and identity

- [API gateway](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/ApiGateway/Proxy/ProxyPipeline.cs): `src/ApiGateway/Proxy/ProxyPipeline.cs`
- [IAM accounts](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Iam/Domain/Model/Aggregates/User.cs): `src/Monolith/Iam/Domain/Model/Aggregates/User.cs`

### Monolith operations

- [Route operations](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Domain/Model/Aggregates/Route.cs): `src/Monolith/Administration/Domain/Model/Aggregates/Route.cs`
- [Driver roster](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Domain/Model/Aggregates/Driver.cs): `src/Monolith/Administration/Domain/Model/Aggregates/Driver.cs`
- [Family and enrollment](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Stakeholder/Domain/Model/Aggregates/Student.cs): `src/Monolith/Stakeholder/Domain/Model/Aggregates/Student.cs`
- [Plans and quotas](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Subscription/Domain/Model/Aggregates/Plan.cs): `src/Monolith/Subscription/Domain/Model/Aggregates/Plan.cs`
- [Monolith host](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Program.cs): `src/Monolith/Program.cs`

### Trip tracking

- [Trip HTTP API](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/TripsController.cs): `src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/TripsController.cs`
- [Trip lifecycle](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Domain/Trips/Trip.cs): `src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Domain/Trips/Trip.cs`
- [Trip persistence](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Infrastructure/Persistence/Repositories/Repositories.cs): `src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Infrastructure/Persistence/Repositories/Repositories.cs`
- [Trip scheduling](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Infrastructure/Scheduling/TripSchedulingWorker.cs): `src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Infrastructure/Scheduling/TripSchedulingWorker.cs`
- [Location tracking](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/MeController.cs): `src/Services/Trip-Tracking/src/RutaSegura.TripTracking.Api/Controllers/MeController.cs`
- [Trip event exchange](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Monolith/Administration/Infrastructure/Messaging/Inbound/TripTrackingEventsConsumer.cs): `src/Monolith/Administration/Infrastructure/Messaging/Inbound/TripTrackingEventsConsumer.cs`

### Notifications

- [Notification HTTP API](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/NotificationsController.cs): `src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/NotificationsController.cs`
- [Notification inbox](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Domain/Model/Aggregates/Notification.cs): `src/Services/Notification/src/RutaSegura.Notification.Domain/Model/Aggregates/Notification.cs`
- [Trip event handler](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Application/Internal/CommandServices/Handlers/ReceiveTripEventHandler.cs): `src/Services/Notification/src/RutaSegura.Notification.Application/Internal/CommandServices/Handlers/ReceiveTripEventHandler.cs`
- [Delivery channels](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Infrastructure/Channels/NotificationChannelWorker.cs): `src/Services/Notification/src/RutaSegura.Notification.Infrastructure/Channels/NotificationChannelWorker.cs`
- [Push subscriptions](https://github.com/upc-pre-202610-1asi0657-9206-nimbuspath/rutasegura-backend/blob/main/src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/PushSubscriptionsController.cs): `src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/PushSubscriptionsController.cs`

### Other components

- **Mobile and web apps**
- **RabbitMQ**
- **Firebase Cloud Messaging**
- **MySQL stores**

## Connections

- Mobile and web apps → API gateway: sends requests
- API gateway → Monolith host: proxies routes
- API gateway → Trip HTTP API: proxies routes (evidence: `src/ApiGateway/Proxy/ProxyPipeline.cs`)
- API gateway → Notification HTTP API: proxies routes
- Mobile and web apps → Monolith host: uses IAM
- Monolith host → IAM accounts: hosts accounts
- Monolith host → Route operations: hosts operations
- Monolith host → Family and enrollment: hosts enrollment
- Monolith host → Plans and quotas: hosts plans
- Driver roster → Route operations: assigns drivers (evidence: `src/Monolith/Administration/Domain/Model/Aggregates/Route.cs`)
- Plans and quotas → Route operations: supplies quota (evidence: `src/Monolith/Administration/Domain/Model/Aggregates/Route.cs`)
- Family and enrollment → Route operations: requests route planning (evidence: `src/Monolith/Stakeholder/Application/Internal/QueryServices/StakeholderQueryService.cs`)
- Trip HTTP API → Trip lifecycle: handles trips
- Trip HTTP API → Trip persistence: persists trips
- Trip scheduling → Trip persistence: stores schedules
- Trip event exchange → Route operations: updates alerts and records
- Trip event exchange → RabbitMQ: consumes events
- Trip HTTP API → RabbitMQ: publishes events
- Trip event handler → Notification inbox: creates inbox entries
- RabbitMQ → Trip event handler: delivers trip events
- Notification HTTP API → Notification inbox: reads inbox (evidence: `src/Services/Notification/src/RutaSegura.Notification.Interfaces/Rest/Controllers/NotificationsController.cs`)
- Push subscriptions → Delivery channels: manages subscriptions
- Delivery channels → Firebase Cloud Messaging: delivers push
- Notification inbox → MySQL stores: persists inbox
- Trip persistence → MySQL stores: persists journeys
- Location tracking → Trip lifecycle: records journey data
