# japs-system/japs architecture

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

## Overview

This is a bus-transport operations portal for owners, conductors, drivers, and audit tellers. Users sign in, then role-specific workflows manage fleet and schedules, operate trips and ticketing, submit remittances, and review financial activity; owners also access reports and forecasts. The Angular client routes to an Express API, whose handlers use Sequelize models and supporting services. The graph preserves major features named in the tree, but several pages and handlers were not sampled, so their internal calls are omitted rather than inferred.

Main entry points: [`server/controllers`](https://github.com/japs-system/japs/tree/main/server/controllers) (Domain handlers), [`server/index.js`](https://github.com/japs-system/japs/blob/main/server/index.js) (API entry), [`server/routes/ownerRoutes.js`](https://github.com/japs-system/japs/blob/main/server/routes/ownerRoutes.js) (Owner API), [`client/src/app/app.routes.ts`](https://github.com/japs-system/japs/blob/main/client/src/app/app.routes.ts) (Portal routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web portal"]
  node_client_routes["Portal routing<br/>[app.routes.ts]"]
  node_login["Login<br/>[login-page.ts]"]
  node_auth_service["Session service<br/>[auth.service.ts]"]
  node_auth_guards["Access guards<br/>[auth.guard.ts]"]
  node_owner_portal["Owner operations"]
  node_conductor_portal["Conductor operations"]
  node_driver_portal["Driver operations"]
  node_audit_portal["Audit review"]
end

subgraph group_api["API workflows"]
  node_api_entry["API entry<br/>[index.js]"]
  node_auth_routes["Authentication API<br/>[authRoutes.js]"]
  node_owner_api["Owner API<br/>[ownerRoutes.js]"]
  node_fleet_api["Fleet and routes API<br/>[busRoutes.js]"]
  node_conductor_api["Conductor API<br/>[conductorRoutes.js]"]
  node_driver_api["Driver API<br/>[driverRoutes.js]"]
  node_audit_api["Audit API"]
  node_controllers["Domain handlers"]
end

subgraph group_data["Domain data"]
  node_models["Domain models<br/>[index.js]"]
  node_database[("SQL database<br/>[database.js]")]
end

subgraph group_services["Supporting services"]
  node_forecast["Forecasting<br/>[buildForecast.js]"]
  node_insights["Business insights<br/>[buildInsights.js]"]
  node_remittance_detail["Remittance detail"]
  node_notifications["Notifications"]
  node_mailer["Email delivery<br/>[mailer.js]"]
end

node_users(("Portal users"))

node_users -->|"signs in"| node_login
node_client_routes -->|"routes to"| node_login
node_client_routes -->|"loads"| node_owner_portal
node_client_routes -->|"loads"| node_conductor_portal
node_client_routes -->|"loads"| node_driver_portal
node_client_routes -->|"loads"| node_audit_portal
node_login -->|"uses"| node_auth_service
node_auth_service -.->|"calls"| node_auth_routes
node_auth_guards -->|"checks session"| node_auth_service
node_api_entry -->|"mounts"| node_auth_routes
node_api_entry -->|"mounts"| node_owner_api
node_api_entry -->|"mounts"| node_fleet_api
node_api_entry -->|"mounts"| node_conductor_api
node_api_entry -->|"mounts"| node_driver_api
node_api_entry -->|"mounts"| node_audit_api
node_owner_api -.->|"dispatches"| node_controllers
node_fleet_api -->|"dispatches"| node_controllers
node_conductor_api -->|"dispatches"| node_controllers
node_driver_api -.->|"dispatches"| node_controllers
node_audit_api -->|"dispatches"| node_controllers
node_models -->|"connects"| node_database
node_owner_api -->|"queries"| node_models
node_owner_api -->|"builds forecasts"| node_forecast
node_owner_api -->|"builds insights"| node_insights
node_owner_api -->|"finds details"| node_remittance_detail
node_controllers -->|"notifies"| node_notifications
node_notifications -->|"writes notifications"| node_models
node_controllers -->|"sends mail"| node_mailer

click node_client_routes "https://github.com/japs-system/japs/blob/main/client/src/app/app.routes.ts"
click node_login "https://github.com/japs-system/japs/blob/main/client/src/app/auth/login-page/login-page.ts"
click node_auth_service "https://github.com/japs-system/japs/blob/main/client/src/app/core/services/auth.service.ts"
click node_auth_guards "https://github.com/japs-system/japs/blob/main/client/src/app/core/guards/auth.guard.ts"
click node_owner_portal "https://github.com/japs-system/japs/tree/main/client/src/app/features/owner"
click node_conductor_portal "https://github.com/japs-system/japs/tree/main/client/src/app/features/conductor"
click node_driver_portal "https://github.com/japs-system/japs/tree/main/client/src/app/features/driver"
click node_audit_portal "https://github.com/japs-system/japs/tree/main/client/src/app/features/audit-teller"
click node_api_entry "https://github.com/japs-system/japs/blob/main/server/index.js"
click node_auth_routes "https://github.com/japs-system/japs/blob/main/server/routes/authRoutes.js"
click node_owner_api "https://github.com/japs-system/japs/blob/main/server/routes/ownerRoutes.js"
click node_fleet_api "https://github.com/japs-system/japs/blob/main/server/routes/busRoutes.js"
click node_conductor_api "https://github.com/japs-system/japs/blob/main/server/routes/conductorRoutes.js"
click node_driver_api "https://github.com/japs-system/japs/blob/main/server/routes/driverRoutes.js"
click node_audit_api "https://github.com/japs-system/japs/blob/main/server/routes/auditTellerRoutes.js"
click node_controllers "https://github.com/japs-system/japs/tree/main/server/controllers"
click node_models "https://github.com/japs-system/japs/blob/main/server/models/index.js"
click node_database "https://github.com/japs-system/japs/blob/main/server/config/database.js"
click node_forecast "https://github.com/japs-system/japs/blob/main/server/services/forecast/buildForecast.js"
click node_insights "https://github.com/japs-system/japs/blob/main/server/services/insights/buildInsights.js"
click node_remittance_detail "https://github.com/japs-system/japs/blob/main/server/services/remittance/findRemittanceDetail.js"
click node_notifications "https://github.com/japs-system/japs/blob/main/server/services/notificationService.js"
click node_mailer "https://github.com/japs-system/japs/blob/main/server/config/mailer.js"

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_client_routes,node_login,node_auth_service,node_auth_guards,node_owner_portal,node_conductor_portal,node_driver_portal,node_audit_portal,node_users toneBlue
class node_api_entry,node_auth_routes,node_owner_api,node_fleet_api,node_conductor_api,node_driver_api,node_audit_api,node_controllers toneAmber
class node_models,node_database toneMint
class node_forecast,node_insights,node_remittance_detail,node_notifications,node_mailer toneRose
```

## Components

### Web portal

- [Portal routing](https://github.com/japs-system/japs/blob/main/client/src/app/app.routes.ts): `client/src/app/app.routes.ts`
- [Login](https://github.com/japs-system/japs/blob/main/client/src/app/auth/login-page/login-page.ts): `client/src/app/auth/login-page/login-page.ts`
- [Session service](https://github.com/japs-system/japs/blob/main/client/src/app/core/services/auth.service.ts): `client/src/app/core/services/auth.service.ts`
- [Access guards](https://github.com/japs-system/japs/blob/main/client/src/app/core/guards/auth.guard.ts): `client/src/app/core/guards/auth.guard.ts`
- [Owner operations](https://github.com/japs-system/japs/tree/main/client/src/app/features/owner): `client/src/app/features/owner`
- [Conductor operations](https://github.com/japs-system/japs/tree/main/client/src/app/features/conductor): `client/src/app/features/conductor`
- [Driver operations](https://github.com/japs-system/japs/tree/main/client/src/app/features/driver): `client/src/app/features/driver`
- [Audit review](https://github.com/japs-system/japs/tree/main/client/src/app/features/audit-teller): `client/src/app/features/audit-teller`

### API workflows

- [API entry](https://github.com/japs-system/japs/blob/main/server/index.js): `server/index.js`
- [Authentication API](https://github.com/japs-system/japs/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Owner API](https://github.com/japs-system/japs/blob/main/server/routes/ownerRoutes.js): `server/routes/ownerRoutes.js`
- [Fleet and routes API](https://github.com/japs-system/japs/blob/main/server/routes/busRoutes.js): `server/routes/busRoutes.js`
- [Conductor API](https://github.com/japs-system/japs/blob/main/server/routes/conductorRoutes.js): `server/routes/conductorRoutes.js`
- [Driver API](https://github.com/japs-system/japs/blob/main/server/routes/driverRoutes.js): `server/routes/driverRoutes.js`
- [Audit API](https://github.com/japs-system/japs/blob/main/server/routes/auditTellerRoutes.js): `server/routes/auditTellerRoutes.js`
- [Domain handlers](https://github.com/japs-system/japs/tree/main/server/controllers): `server/controllers`

### Domain data

- [Domain models](https://github.com/japs-system/japs/blob/main/server/models/index.js): `server/models/index.js`
- [SQL database](https://github.com/japs-system/japs/blob/main/server/config/database.js): `server/config/database.js`

### Supporting services

- [Forecasting](https://github.com/japs-system/japs/blob/main/server/services/forecast/buildForecast.js): `server/services/forecast/buildForecast.js`
- [Business insights](https://github.com/japs-system/japs/blob/main/server/services/insights/buildInsights.js): `server/services/insights/buildInsights.js`
- [Remittance detail](https://github.com/japs-system/japs/blob/main/server/services/remittance/findRemittanceDetail.js): `server/services/remittance/findRemittanceDetail.js`
- [Notifications](https://github.com/japs-system/japs/blob/main/server/services/notificationService.js): `server/services/notificationService.js`
- [Email delivery](https://github.com/japs-system/japs/blob/main/server/config/mailer.js): `server/config/mailer.js`

### Other components

- **Portal users**

## Connections

- Portal users → Login: signs in
- Portal routing → Login: routes to (evidence: `client/src/app/app.routes.ts`)
- Portal routing → Owner operations: loads (evidence: `client/src/app/app.routes.ts`)
- Portal routing → Conductor operations: loads (evidence: `client/src/app/app.routes.ts`)
- Portal routing → Driver operations: loads (evidence: `client/src/app/app.routes.ts`)
- Portal routing → Audit review: loads (evidence: `client/src/app/app.routes.ts`)
- Login → Session service: uses (evidence: `client/src/app/auth/login-page/login-page.ts`)
- Session service → Authentication API: calls
- Access guards → Session service: checks session (evidence: `client/src/app/core/guards/auth.guard.ts`)
- API entry → Authentication API: mounts (evidence: `server/index.js`)
- API entry → Owner API: mounts (evidence: `server/index.js`)
- API entry → Fleet and routes API: mounts (evidence: `server/index.js`)
- API entry → Conductor API: mounts (evidence: `server/index.js`)
- API entry → Driver API: mounts (evidence: `server/index.js`)
- API entry → Audit API: mounts (evidence: `server/index.js`)
- Owner API → Domain handlers: dispatches
- Fleet and routes API → Domain handlers: dispatches (evidence: `server/routes/busRoutes.js`)
- Conductor API → Domain handlers: dispatches (evidence: `server/routes/conductorRoutes.js`)
- Driver API → Domain handlers: dispatches
- Audit API → Domain handlers: dispatches (evidence: `server/routes/auditTellerRoutes.js`)
- Domain models → SQL database: connects (evidence: `server/models/index.js`)
- Owner API → Domain models: queries (evidence: `server/routes/ownerRoutes.js`)
- Owner API → Forecasting: builds forecasts (evidence: `server/routes/ownerRoutes.js`)
- Owner API → Business insights: builds insights (evidence: `server/routes/ownerRoutes.js`)
- Owner API → Remittance detail: finds details (evidence: `server/routes/ownerRoutes.js`)
- Domain handlers → Notifications: notifies (evidence: `server/controllers/conductorController.js`)
- Notifications → Domain models: writes notifications (evidence: `server/services/notificationService.js`)
- Domain handlers → Email delivery: sends mail (evidence: `server/controllers/conductorController.js`)
