# nazim1971/node-vms architecture

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

- Interactive diagram: https://gitdiagram.com/nazim1971/node-vms
- Repository: https://github.com/nazim1971/node-vms

## Overview

1. **Overall shape: a modular NestJS backend monolith**
   - This repository is a single NestJS application organized as feature modules, not separate services.
   - Each domain area has its own `*.module.ts`, `*.controller.ts`, and `*.service.ts`, with shared cross-cutting concerns under `src/common`.
   - The app exposes HTTP APIs, a WebSocket gateway, and background jobs from the same codebase.

2. **Runtime and infrastructure dependencies**
   - Primary state is in **PostgreSQL** via **Prisma**.
   - **Redis** is used for JWT blacklisting, caching, and job/real-time support.
   - **BullMQ** powers scheduled background jobs.
   - **Socket.IO** provides real-time GPS/event broadcasting.
   - Logging uses **Winston**, and the service is configured for standard NestJS production hardening.

3. **Bootstrap and request pipeline**
   - `src/main.ts` bootstraps the Nest app.
   - Requests flow through global concerns before reaching controllers: validation, exception filtering, logging, response shaping, sensitive-field stripping, and auditing.
   - The repository strongly suggests a consistent API envelope for successful and error responses, which is important for diagramming the edge of the system.

4. **Multi-tenancy is a core architectural boundary**
   - Every business operation is tenant-scoped; tenant isolation is a first-class rule, not just a data convention.
   - Guards such as `tenant.guard.ts`, plus auth/role/feature guards, enforce access before a controller reaches its service.
   - The `SUPER_ADMIN` role is explicitly exempt from most tenant/feature restrictions, which is an important exception path in the architecture.

5. **Identity, authorization, and approval workflow**
   - The `auth` module handles login, refresh tokens, tenant registration, and initial super-admin seeding.
   - JWT access/refresh tokens and bcrypt are the core identity mechanisms.
   - New admin tenants go through an approval flow: pending registration, review in `admin-applications`, then activation or rejection by `SUPER_ADMIN`.
   - Authorization is layered: authentication, tenant scoping, role checks, and feature access checks.

6. **Feature-flag boundary for modules**
   - `feature-access` is a platform-level control plane for enabling/disabling tenant modules.
   - Feature guards gate entire subsystems such as `vehicles`, `workshop`, `maintenance`, `tracking`, `bookings`, `fuel`, `accounting`, and `reports`.
   - This means some domain modules are optional per tenant; in a diagram, this should be shown as a policy layer between the API and those feature modules.

7. **Core operational domains**
   - The main business modules are `vehicles`, `drivers`, `branches`, `users`, `tenants`, `contracts`, `bookings`, `trips`, `assignments`, and `scheduling`.
   - These modules model fleet operations and resource allocation.
   - `contracts` and `bookings` appear to connect the commercial side to vehicle availability, while `assignments`, `scheduling`, and `trips` manage operational execution.

8. **Maintenance, workshop, and document lifecycle**
   - `maintenance`, `documents`, `workshop`, and `fuel` form the vehicle health and servicing side of the system.
   - `workshop` includes jobs, parts/labor breakdown, and cost tracking.
   - `documents` and `maintenance` are tied to expiry/overdue alerting, which links this domain to the alert subsystem.

9. **Accounting and reporting layer**
   - `expenses`, `income`, and `accounting` provide financial tracking and reporting inputs.
   - `reports` and `accounting` generate aggregate views such as profit/loss, mileage, fuel, and usage reports.
   - These modules are downstream consumers of operational data from bookings, trips, fuel, and maintenance.

10. **Tracking and real-time telemetry**
   - `tracking` handles GPS location ingestion from drivers/vehicles.
   - The readme indicates a Redis-backed cache plus WebSocket broadcast path, so this is a hybrid flow: write location data, update cache, then push updates to connected clients.
   - `gateways/app.gateway.ts` is the real-time edge of the system and should be drawn as parallel to HTTP controllers, not inside them.

11. **Background jobs and alerting**
   - `jobs` and `alerts` form the asynchronous subsystem.
   - Scheduled jobs scan for document expiry, contract expiry, maintenance due, and offline vehicles.
   - Alerts are likely persisted and then queried via API, while the job runners are the producers.
   - This subsystem depends on PostgreSQL for state and Redis/BullMQ for scheduling/execution.

12. **Audit and observability**
   - `audit` records immutable state-changing activity through an interceptor, not by manual logging in each service.
   - `logging.interceptor.ts` and the Winston logger provide request-level observability.
   - `sensitive-fields.interceptor.ts` removes credentials from output, which is important for showing the response path in diagrams.

13. **Shared infrastructure and utilities**
   - `src/database` wraps Prisma access; this is the main persistence boundary for all feature modules.
   - `src/shared` and `src/common` hold reusable guards, decorators, pipes, helpers, filters, Redis integration, and logger config.
   - These shared pieces are what keep the feature modules thin and consistent.

14. **Data model and migration history**
   - The repository includes a full Prisma migration history plus SQL backups and migration dumps.
   - That suggests the schema is central to the design and likely stable enough to treat as a formal contract.
   - `docker-compose.yml` and the Supabase-oriented environment variables indicate the system is intended to run against managed PostgreSQL and Redis in production-like environments.

15. **How to draw the architecture**
   - Draw the app as a **single NestJS backend** with three primary entry points: HTTP controllers, WebSocket gateway, and BullMQ jobs.
   - Place **auth/tenant/role/feature guards** in front of all business modules.
   - Show **Prisma/PostgreSQL** as the authoritative data store, **Redis** as the support layer for blacklisting/cache/jobs, and **WebSocket** as the live telemetry channel.
   - Group the domain modules into functional clusters: fleet operations, maintenance/workshop, finance/reporting, admin/control-plane, and async alerts/jobs.

Main entry points: [`src/app.module.ts`](https://github.com/nazim1971/node-vms/blob/main/src/app.module.ts) (App module), [`src/feature-access/feature-access.module.ts`](https://github.com/nazim1971/node-vms/blob/main/src/feature-access/feature-access.module.ts) (Feature access), [`src/database/database.module.ts`](https://github.com/nazim1971/node-vms/blob/main/src/database/database.module.ts) (Prisma DB), [`src/bookings/bookings.module.ts`](https://github.com/nazim1971/node-vms/blob/main/src/bookings/bookings.module.ts) (Bookings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry & pipeline"]
  node_main["Bootstrap<br/>[main.ts]"]
  node_app["App module<br/>nest root module<br/>[app.module.ts]"]
  node_http_pipeline["API pipeline<br/>global interceptors/filters"]
end

subgraph group_platform["Platform services"]
  node_authz["Access control<br/>guards/decorators<br/>[tenant.guard.ts]"]
  node_feature_access["Feature access<br/>platform policy"]
  node_auth["Auth<br/>identity module<br/>[auth.module.ts]"]
  node_tenants["Tenants<br/>tenant admin<br/>[tenants.module.ts]"]
  node_users["Users<br/>identity admin<br/>[users.module.ts]"]
  node_admin_apps["Admin applications<br/>approval workflow"]
  node_db[("Prisma DB<br/>postgres persistence<br/>[database.module.ts]")]
  node_redis[("Redis<br/>cache/queue store<br/>[redis.module.ts]")]
  node_audit["Audit<br/>activity logging<br/>[audit.module.ts]"]
end

subgraph group_ops["Fleet ops"]
  node_vehicles["Vehicles<br/>fleet module<br/>[vehicles.module.ts]"]
  node_drivers["Drivers<br/>fleet module<br/>[drivers.module.ts]"]
  node_branches["Branches<br/>org structure<br/>[branches.module.ts]"]
  node_contracts["Contracts<br/>commercial module"]
  node_bookings["Bookings<br/>dispatch module<br/>[bookings.module.ts]"]
  node_assignments["Assignments<br/>allocation module"]
  node_scheduling["Scheduling<br/>availability module"]
  node_trips["Trips<br/>execution module<br/>[trips.module.ts]"]
end

subgraph group_service["Service domains"]
  node_documents["Documents<br/>compliance module"]
  node_maintenance["Maintenance<br/>service module"]
  node_workshop["Workshop<br/>repair module<br/>[workshop.module.ts]"]
  node_fuel["Fuel<br/>service module<br/>[fuel.module.ts]"]
end

subgraph group_finance["Finance & reports"]
  node_expenses["Expenses<br/>finance module<br/>[expenses.module.ts]"]
  node_income["Income<br/>finance module<br/>[income.module.ts]"]
  node_accounting["Accounting<br/>aggregation module"]
  node_reports["Reports<br/>analytics module<br/>[reports.module.ts]"]
end

subgraph group_async["Async & realtime"]
  node_tracking["Tracking<br/>telemetry module<br/>[tracking.module.ts]"]
  node_gateway(("Socket gateway<br/>realtime edge<br/>[app.gateway.ts]"))
  node_jobs["Jobs<br/>bullmq workers<br/>[jobs.module.ts]"]
  node_alerts["Alerts<br/>async module<br/>[alerts.module.ts]"]
end

node_main -->|"boots"| node_app
node_app -->|"wraps"| node_http_pipeline
node_app -->|"enforces"| node_authz
node_app -->|"uses"| node_db
node_app -->|"uses"| node_redis
node_app -->|"observes"| node_audit
node_app -->|"exposes"| node_auth
node_app -->|"exposes"| node_tenants
node_app -->|"exposes"| node_users
node_app -->|"exposes"| node_admin_apps
node_app -->|"polices"| node_feature_access
node_app -->|"exposes"| node_vehicles
node_app -->|"exposes"| node_drivers
node_app -->|"exposes"| node_branches
node_app -->|"exposes"| node_contracts
node_app -->|"exposes"| node_bookings
node_app -->|"exposes"| node_assignments
node_app -->|"exposes"| node_scheduling
node_app -->|"exposes"| node_trips
node_app -->|"exposes"| node_documents
node_app -->|"exposes"| node_maintenance
node_app -->|"exposes"| node_workshop
node_app -->|"exposes"| node_fuel
node_app -->|"exposes"| node_expenses
node_app -->|"exposes"| node_income
node_app -->|"exposes"| node_accounting
node_app -->|"exposes"| node_reports
node_app -->|"exposes"| node_tracking
node_app -->|"streams"| node_gateway
node_app -->|"runs"| node_jobs
node_app -->|"exposes"| node_alerts
node_auth -->|"reads/writes"| node_db
node_auth -->|"blacklists"| node_redis
node_admin_apps -->|"feeds"| node_auth
node_feature_access -->|"gates"| node_vehicles
node_feature_access -->|"gates"| node_bookings
node_feature_access -->|"gates"| node_maintenance
node_feature_access -->|"gates"| node_tracking
node_feature_access -->|"gates"| node_accounting
node_feature_access -->|"gates"| node_reports
node_vehicles -->|"persists"| node_db
node_drivers -->|"persists"| node_db
node_branches -->|"persists"| node_db
node_contracts -->|"allocates"| node_vehicles
node_contracts -->|"persists"| node_db
node_bookings -->|"creates"| node_assignments
node_bookings -->|"selects"| node_vehicles
node_bookings -->|"selects"| node_drivers

click node_main "https://github.com/nazim1971/node-vms/blob/main/src/main.ts"
click node_app "https://github.com/nazim1971/node-vms/blob/main/src/app.module.ts"
click node_http_pipeline "https://github.com/nazim1971/node-vms/blob/main/src/common/interceptors/response.interceptor.ts"
click node_authz "https://github.com/nazim1971/node-vms/blob/main/src/common/guards/tenant.guard.ts"
click node_feature_access "https://github.com/nazim1971/node-vms/blob/main/src/feature-access/feature-access.module.ts"
click node_auth "https://github.com/nazim1971/node-vms/blob/main/src/auth/auth.module.ts"
click node_tenants "https://github.com/nazim1971/node-vms/blob/main/src/tenants/tenants.module.ts"
click node_users "https://github.com/nazim1971/node-vms/blob/main/src/users/users.module.ts"
click node_admin_apps "https://github.com/nazim1971/node-vms/blob/main/src/admin-applications/admin-applications.module.ts"
click node_db "https://github.com/nazim1971/node-vms/blob/main/src/database/database.module.ts"
click node_redis "https://github.com/nazim1971/node-vms/blob/main/src/common/redis/redis.module.ts"
click node_vehicles "https://github.com/nazim1971/node-vms/blob/main/src/vehicles/vehicles.module.ts"
click node_drivers "https://github.com/nazim1971/node-vms/blob/main/src/drivers/drivers.module.ts"
click node_branches "https://github.com/nazim1971/node-vms/blob/main/src/branches/branches.module.ts"
click node_contracts "https://github.com/nazim1971/node-vms/blob/main/src/contracts/contracts.module.ts"
click node_bookings "https://github.com/nazim1971/node-vms/blob/main/src/bookings/bookings.module.ts"
click node_assignments "https://github.com/nazim1971/node-vms/blob/main/src/assignments/assignments.module.ts"
click node_scheduling "https://github.com/nazim1971/node-vms/blob/main/src/scheduling/scheduling.module.ts"
click node_trips "https://github.com/nazim1971/node-vms/blob/main/src/trips/trips.module.ts"
click node_documents "https://github.com/nazim1971/node-vms/blob/main/src/documents/documents.module.ts"
click node_maintenance "https://github.com/nazim1971/node-vms/blob/main/src/maintenance/maintenance.module.ts"
click node_workshop "https://github.com/nazim1971/node-vms/blob/main/src/workshop/workshop.module.ts"
click node_fuel "https://github.com/nazim1971/node-vms/blob/main/src/fuel/fuel.module.ts"
click node_expenses "https://github.com/nazim1971/node-vms/blob/main/src/expenses/expenses.module.ts"
click node_income "https://github.com/nazim1971/node-vms/blob/main/src/income/income.module.ts"
click node_accounting "https://github.com/nazim1971/node-vms/blob/main/src/accounting/accounting.module.ts"
click node_reports "https://github.com/nazim1971/node-vms/blob/main/src/reports/reports.module.ts"
click node_tracking "https://github.com/nazim1971/node-vms/blob/main/src/tracking/tracking.module.ts"
click node_gateway "https://github.com/nazim1971/node-vms/blob/main/src/gateways/app.gateway.ts"
click node_jobs "https://github.com/nazim1971/node-vms/blob/main/src/jobs/jobs.module.ts"
click node_alerts "https://github.com/nazim1971/node-vms/blob/main/src/alerts/alerts.module.ts"
click node_audit "https://github.com/nazim1971/node-vms/blob/main/src/audit/audit.module.ts"

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_main,node_app,node_http_pipeline toneBlue
class node_authz,node_feature_access,node_auth,node_tenants,node_users,node_admin_apps,node_db,node_redis,node_audit toneAmber
class node_vehicles,node_drivers,node_branches,node_contracts,node_bookings,node_assignments,node_scheduling,node_trips toneMint
class node_documents,node_maintenance,node_workshop,node_fuel toneRose
class node_expenses,node_income,node_accounting,node_reports toneIndigo
class node_tracking,node_gateway,node_jobs,node_alerts toneTeal
```

## Components

### Entry & pipeline

NestJS bootstrap and global request/response pipeline

- [Bootstrap](https://github.com/nazim1971/node-vms/blob/main/src/main.ts): nest bootstrap · Application startup and module wiring · `src/main.ts`
- [App module](https://github.com/nazim1971/node-vms/blob/main/src/app.module.ts): nest root module · Top-level composition of all feature modules · `src/app.module.ts`
- [API pipeline](https://github.com/nazim1971/node-vms/blob/main/src/common/interceptors/response.interceptor.ts): global interceptors/filters · Validation, exceptions, logging, response shaping, and sensitive-field stripping · `src/common/interceptors/response.interceptor.ts`

### Platform services

Shared infrastructure and cross-cutting controls

- [Access control](https://github.com/nazim1971/node-vms/blob/main/src/common/guards/tenant.guard.ts): guards/decorators · Auth, tenant, role, and feature guards with public/current-user decorators · `src/common/guards/tenant.guard.ts`
- [Feature access](https://github.com/nazim1971/node-vms/blob/main/src/feature-access/feature-access.module.ts): platform policy · Tenant feature gating for optional modules and SUPER_ADMIN exceptions · `src/feature-access/feature-access.module.ts`
- [Auth](https://github.com/nazim1971/node-vms/blob/main/src/auth/auth.module.ts): identity module · Login, refresh tokens, tenant registration, and super-admin seeding · `src/auth/auth.module.ts`
- [Tenants](https://github.com/nazim1971/node-vms/blob/main/src/tenants/tenants.module.ts): tenant admin · Tenant lifecycle and tenant-scoped configuration · `src/tenants/tenants.module.ts`
- [Users](https://github.com/nazim1971/node-vms/blob/main/src/users/users.module.ts): identity admin · User accounts, resets, and profile-linked identity data · `src/users/users.module.ts`
- [Admin applications](https://github.com/nazim1971/node-vms/blob/main/src/admin-applications/admin-applications.module.ts): approval workflow · Pending tenant onboarding, review, approval, or rejection · `src/admin-applications/admin-applications.module.ts`
- [Prisma DB](https://github.com/nazim1971/node-vms/blob/main/src/database/database.module.ts): postgres persistence · Repository-wide persistence boundary over PostgreSQL · `src/database/database.module.ts`
- [Redis](https://github.com/nazim1971/node-vms/blob/main/src/common/redis/redis.module.ts): cache/queue store · JWT blacklisting, caching, and job/real-time support · `src/common/redis/redis.module.ts`
- [Audit](https://github.com/nazim1971/node-vms/blob/main/src/audit/audit.module.ts): activity logging · Immutable change capture through an interceptor-backed flow · `src/audit/audit.module.ts`

### Fleet ops

Core operational domain modules

- [Vehicles](https://github.com/nazim1971/node-vms/blob/main/src/vehicles/vehicles.module.ts): fleet module · Vehicle registry and lifecycle records · `src/vehicles/vehicles.module.ts`
- [Drivers](https://github.com/nazim1971/node-vms/blob/main/src/drivers/drivers.module.ts): fleet module · Driver records and assignment-ready personnel · `src/drivers/drivers.module.ts`
- [Branches](https://github.com/nazim1971/node-vms/blob/main/src/branches/branches.module.ts): org structure · Branch-level operational locations · `src/branches/branches.module.ts`
- [Contracts](https://github.com/nazim1971/node-vms/blob/main/src/contracts/contracts.module.ts): commercial module · Vehicle contracts and availability-linked commercial terms · `src/contracts/contracts.module.ts`
- [Bookings](https://github.com/nazim1971/node-vms/blob/main/src/bookings/bookings.module.ts): dispatch module · Booking flow connecting demand to vehicles and drivers · `src/bookings/bookings.module.ts`
- [Assignments](https://github.com/nazim1971/node-vms/blob/main/src/assignments/assignments.module.ts): allocation module · Vehicle-driver allocation and operational assignment records · `src/assignments/assignments.module.ts`
- [Scheduling](https://github.com/nazim1971/node-vms/blob/main/src/scheduling/scheduling.module.ts): availability module · Availability checks and operational planning · `src/scheduling/scheduling.module.ts`
- [Trips](https://github.com/nazim1971/node-vms/blob/main/src/trips/trips.module.ts): execution module · Trip lifecycle and execution tracking · `src/trips/trips.module.ts`

### Service domains

Maintenance, workshop, and document lifecycle

- [Documents](https://github.com/nazim1971/node-vms/blob/main/src/documents/documents.module.ts): compliance module · Vehicle and operational document records and expiry tracking · `src/documents/documents.module.ts`
- [Maintenance](https://github.com/nazim1971/node-vms/blob/main/src/maintenance/maintenance.module.ts): service module · Maintenance logs and overdue/expiry-related workflows · `src/maintenance/maintenance.module.ts`
- [Workshop](https://github.com/nazim1971/node-vms/blob/main/src/workshop/workshop.module.ts): repair module · Jobs, parts/labor, and repair cost tracking · `src/workshop/workshop.module.ts`
- [Fuel](https://github.com/nazim1971/node-vms/blob/main/src/fuel/fuel.module.ts): service module · Fuel logs supporting vehicle health and reporting · `src/fuel/fuel.module.ts`

### Finance & reports

Financial tracking and aggregation

- [Expenses](https://github.com/nazim1971/node-vms/blob/main/src/expenses/expenses.module.ts): finance module · Expense capture for financial reporting · `src/expenses/expenses.module.ts`
- [Income](https://github.com/nazim1971/node-vms/blob/main/src/income/income.module.ts): finance module · Revenue capture and financial inputs · `src/income/income.module.ts`
- [Accounting](https://github.com/nazim1971/node-vms/blob/main/src/accounting/accounting.module.ts): aggregation module · Profit/loss and finance summaries over operational data · `src/accounting/accounting.module.ts`
- [Reports](https://github.com/nazim1971/node-vms/blob/main/src/reports/reports.module.ts): analytics module · Aggregate operational reporting across fleet and finance data · `src/reports/reports.module.ts`

### Async & realtime

Jobs, alerts, and live telemetry

- [Tracking](https://github.com/nazim1971/node-vms/blob/main/src/tracking/tracking.module.ts): telemetry module · GPS location ingestion and cache-backed live tracking · `src/tracking/tracking.module.ts`
- [Socket gateway](https://github.com/nazim1971/node-vms/blob/main/src/gateways/app.gateway.ts): realtime edge · Socket.IO broadcast channel for live vehicle and event updates · `src/gateways/app.gateway.ts`
- [Jobs](https://github.com/nazim1971/node-vms/blob/main/src/jobs/jobs.module.ts): bullmq workers · Scheduled background scans and queue-driven execution · `src/jobs/jobs.module.ts`
- [Alerts](https://github.com/nazim1971/node-vms/blob/main/src/alerts/alerts.module.ts): async module · Persisted alerts produced by jobs and domain events · `src/alerts/alerts.module.ts`

## Connections

- Bootstrap → App module: boots · Bootstrap starts the Nest application
- App module → API pipeline: wraps · Global pipeline applies to incoming requests
- App module → Access control: enforces · All protected handlers pass through layered guards
- App module → Prisma DB: uses · Feature modules share the Prisma/PostgreSQL boundary
- App module → Redis: uses · Shared Redis support for cache, auth, and jobs
- App module → Audit: observes · State-changing operations feed audit capture
- App module → Auth: exposes · Authentication entrypoint
- App module → Tenants: exposes · Tenant administration entrypoint
- App module → Users: exposes · User administration entrypoint
- App module → Admin applications: exposes · Tenant approval workflow entrypoint
- App module → Feature access: polices · Feature control plane gates optional subsystems
- App module → Vehicles: exposes · Fleet operations API
- App module → Drivers: exposes · Fleet personnel API
- App module → Branches: exposes · Organizational location API
- App module → Contracts: exposes · Commercial contracts API
- App module → Bookings: exposes · Booking and allocation API
- App module → Assignments: exposes · Assignment API
- App module → Scheduling: exposes · Availability and planning API
- App module → Trips: exposes · Trip execution API
- App module → Documents: exposes · Compliance documents API
- App module → Maintenance: exposes · Maintenance API
- App module → Workshop: exposes · Workshop repair API
- App module → Fuel: exposes · Fuel logging API
- App module → Expenses: exposes · Expense API
- App module → Income: exposes · Income API
- App module → Accounting: exposes · Accounting API
- App module → Reports: exposes · Reporting API
- App module → Tracking: exposes · GPS ingestion API
- App module → Socket gateway: streams · Realtime Socket.IO edge runs alongside HTTP
- App module → Jobs: runs · Background job subsystem
- App module → Alerts: exposes · Alert query and persistence API
- Auth → Prisma DB: reads/writes · Credentials, tokens, and tenant registration state
- Auth → Redis: blacklists · Refresh/JWT support via Redis
- Admin applications → Auth: feeds · Approved tenant onboarding leads into auth/activation
- Feature access → Vehicles: gates · Feature policy controls access to vehicle subsystem
- Feature access → Bookings: gates · Feature policy controls access to booking subsystem
- Feature access → Maintenance: gates · Feature policy controls access to maintenance subsystem
- Feature access → Tracking: gates · Feature policy controls access to tracking subsystem
- Feature access → Accounting: gates · Feature policy controls access to accounting subsystem
- Feature access → Reports: gates · Feature policy controls access to reporting subsystem
- Vehicles → Prisma DB: persists · Vehicle data is stored through Prisma
- Drivers → Prisma DB: persists · Driver data is stored through Prisma
- Branches → Prisma DB: persists · Branch data is stored through Prisma
- Contracts → Vehicles: allocates · Contracts constrain vehicle availability
- Contracts → Prisma DB: persists · Contract state is stored through Prisma
- Bookings → Assignments: creates · Bookings produce allocation records
- Bookings → Vehicles: selects · Booking flow selects available vehicles
- Bookings → Drivers: selects · Booking flow selects available drivers
