# faheemahamed/vrms architecture

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

- Interactive diagram: https://gitdiagram.com/faheemahamed/vrms
- Repository: https://github.com/faheemahamed/vrms

## Overview

This is a vehicle-rental marketplace: customers discover vehicles, request rentals, manage bookings, and review completed rentals; owners list vehicles and manage booking status. The React client routes users into these flows and sends authenticated API requests to an Express backend, whose controllers enforce domain rules and persist records in MongoDB. The README also documents notifications for eligible cancellations. Backend route/controller wiring and several domain calls are evidenced in excerpts; some frontend and notification behavior is represented from documented capabilities, so unsampled links are omitted or marked unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/faheemahamed/vrms/blob/main/client/src/App.jsx) (Client routes), [`client/src/api/axiosInstance.js`](https://github.com/faheemahamed/vrms/blob/main/client/src/api/axiosInstance.js) (HTTP client), [`backend/src/app.js`](https://github.com/faheemahamed/vrms/blob/main/backend/src/app.js) (API mounting), [`backend/src/middleware/authMiddleware.js`](https://github.com/faheemahamed/vrms/blob/main/backend/src/middleware/authMiddleware.js) (JWT and roles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Rental web client"]
  node_app["Client routes<br/>[App.jsx]"]
  node_authui["Sign in/up<br/>[Login.jsx]"]
  node_browse["Vehicle discovery<br/>[Home.jsx]"]
  node_vehicleui["Vehicle details<br/>[VehicleDetails.jsx]"]
  node_dashboard["Rental dashboard<br/>[Dashboard.jsx]"]
  node_fleetui["Fleet management<br/>[OwnerVehicles.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_api_client["HTTP client<br/>[axiosInstance.js]"]
end

subgraph group_api["API and access"]
  node_server["HTTP server<br/>[server.js]"]
  node_router["API mounting<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authmw["JWT and roles<br/>[authMiddleware.js]"]
  node_vehicleroutes["Vehicle routes<br/>[vehicleRoutes.js]"]
  node_bookingroutes["Booking routes<br/>[bookingRoutes.js]"]
  node_reviewroutes["Review routes<br/>[reviewRoutes.js]"]
  node_notifyroutes["Notification routes"]
end

subgraph group_domain["Rental operations"]
  node_authctrl["Authentication<br/>[authController.js]"]
  node_vehiclectrl["Vehicle listings"]
  node_bookingctrl["Booking lifecycle"]
  node_reviewctrl["Rental reviews"]
  node_notifyctrl["Notifications"]
end

subgraph group_data["MongoDB records"]
  node_users[("User records<br/>[User.js]")]
  node_vehicles[("Vehicle records<br/>[Vehicle.js]")]
  node_bookings[("Booking records<br/>[Booking.js]")]
  node_reviews[("Review records<br/>[Review.js]")]
  node_notifications[("Notification records<br/>[Notification.js]")]
end

node_customer(("Customer"))
node_owner(("Vehicle owner"))
node_mongo[("MongoDB")]

node_customer -.->|"uses"| node_app
node_owner -.->|"uses"| node_app
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_vehicleui
node_app -->|"protects route"| node_dashboard
node_app -->|"renders"| node_navbar
node_browse -->|"requests listings"| node_api_client
node_vehicleui -->|"requests details"| node_api_client
node_authui -.->|"submits credentials"| node_api_client
node_dashboard -->|"loads rentals"| node_api_client
node_dashboard -->|"renders"| node_fleetui
node_fleetui -->|"manages listings"| node_api_client
node_navbar -->|"requests account"| node_api_client
node_api_client -.->|"sends API requests"| node_server
node_server -->|"starts"| node_router
node_router -->|"mounts"| node_authroutes
node_router -->|"mounts"| node_vehicleroutes
node_router -->|"mounts"| node_bookingroutes
node_router -->|"mounts"| node_reviewroutes
node_router -->|"mounts"| node_notifyroutes
node_authroutes -->|"dispatches"| node_authctrl
node_authroutes -->|"protects"| node_authmw
node_vehicleroutes -->|"dispatches"| node_vehiclectrl
node_vehicleroutes -->|"protects"| node_authmw
node_bookingroutes -->|"dispatches"| node_bookingctrl
node_bookingroutes -->|"protects"| node_authmw
node_reviewroutes -->|"dispatches"| node_reviewctrl
node_reviewroutes -->|"protects"| node_authmw
node_notifyroutes -->|"dispatches"| node_notifyctrl
node_notifyroutes -->|"protects"| node_authmw
node_authmw -->|"loads user"| node_users
node_authctrl -->|"reads/writes"| node_users
node_vehiclectrl -->|"reads/writes"| node_vehicles
node_vehiclectrl -->|"checks availability"| node_bookings
node_bookingctrl -->|"loads vehicle"| node_vehicles
node_bookingctrl -->|"creates and updates"| node_bookings
node_bookingctrl -->|"loads customer"| node_users
node_bookingctrl -->|"creates cancellation notice"| node_notifications
node_reviewctrl -->|"checks completion"| node_bookings
node_reviewctrl -->|"reads/writes"| node_reviews
node_notifyctrl -->|"reads/updates"| node_notifications
node_users -.->|"persists"| node_mongo
node_vehicles -.->|"persists"| node_mongo
node_bookings -.->|"persists"| node_mongo
node_reviews -.->|"persists"| node_mongo
node_notifications -.->|"persists"| node_mongo

click node_app "https://github.com/faheemahamed/vrms/blob/main/client/src/App.jsx"
click node_authui "https://github.com/faheemahamed/vrms/blob/main/client/src/pages/Login.jsx"
click node_browse "https://github.com/faheemahamed/vrms/blob/main/client/src/pages/Home.jsx"
click node_vehicleui "https://github.com/faheemahamed/vrms/blob/main/client/src/pages/VehicleDetails.jsx"
click node_dashboard "https://github.com/faheemahamed/vrms/blob/main/client/src/pages/Dashboard.jsx"
click node_fleetui "https://github.com/faheemahamed/vrms/blob/main/client/src/components/OwnerVehicles.jsx"
click node_navbar "https://github.com/faheemahamed/vrms/blob/main/client/src/components/Navbar.jsx"
click node_api_client "https://github.com/faheemahamed/vrms/blob/main/client/src/api/axiosInstance.js"
click node_server "https://github.com/faheemahamed/vrms/blob/main/backend/server.js"
click node_router "https://github.com/faheemahamed/vrms/blob/main/backend/src/app.js"
click node_authroutes "https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/authRoutes.js"
click node_authmw "https://github.com/faheemahamed/vrms/blob/main/backend/src/middleware/authMiddleware.js"
click node_authctrl "https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/authController.js"
click node_vehiclectrl "https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/vehicleController.js"
click node_bookingctrl "https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/bookingController.js"
click node_reviewctrl "https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/reviewController.js"
click node_notifyctrl "https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/notificationController.js"
click node_vehicleroutes "https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/vehicleRoutes.js"
click node_bookingroutes "https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/bookingRoutes.js"
click node_reviewroutes "https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/reviewRoutes.js"
click node_notifyroutes "https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/notificationRoutes.js"
click node_users "https://github.com/faheemahamed/vrms/blob/main/backend/src/models/User.js"
click node_vehicles "https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Vehicle.js"
click node_bookings "https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Booking.js"
click node_reviews "https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Review.js"
click node_notifications "https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Notification.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_app,node_authui,node_browse,node_vehicleui,node_dashboard,node_fleetui,node_navbar,node_api_client toneBlue
class node_server,node_router,node_authroutes,node_authmw,node_vehicleroutes,node_bookingroutes,node_reviewroutes,node_notifyroutes,node_mongo toneAmber
class node_authctrl,node_vehiclectrl,node_bookingctrl,node_reviewctrl,node_notifyctrl toneMint
class node_users,node_vehicles,node_bookings,node_reviews,node_notifications toneRose
class node_customer,node_owner toneIndigo
```

## Components

### Rental web client

- [Client routes](https://github.com/faheemahamed/vrms/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Sign in/up](https://github.com/faheemahamed/vrms/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Vehicle discovery](https://github.com/faheemahamed/vrms/blob/main/client/src/pages/Home.jsx): `client/src/pages/Home.jsx`
- [Vehicle details](https://github.com/faheemahamed/vrms/blob/main/client/src/pages/VehicleDetails.jsx): `client/src/pages/VehicleDetails.jsx`
- [Rental dashboard](https://github.com/faheemahamed/vrms/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Fleet management](https://github.com/faheemahamed/vrms/blob/main/client/src/components/OwnerVehicles.jsx): `client/src/components/OwnerVehicles.jsx`
- [Navigation](https://github.com/faheemahamed/vrms/blob/main/client/src/components/Navbar.jsx): `client/src/components/Navbar.jsx`
- [HTTP client](https://github.com/faheemahamed/vrms/blob/main/client/src/api/axiosInstance.js): `client/src/api/axiosInstance.js`

### API and access

- [HTTP server](https://github.com/faheemahamed/vrms/blob/main/backend/server.js): `backend/server.js`
- [API mounting](https://github.com/faheemahamed/vrms/blob/main/backend/src/app.js): `backend/src/app.js`
- [Auth routes](https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`
- [JWT and roles](https://github.com/faheemahamed/vrms/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`
- [Vehicle routes](https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/vehicleRoutes.js): `backend/src/routes/vehicleRoutes.js`
- [Booking routes](https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/bookingRoutes.js): `backend/src/routes/bookingRoutes.js`
- [Review routes](https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/reviewRoutes.js): `backend/src/routes/reviewRoutes.js`
- [Notification routes](https://github.com/faheemahamed/vrms/blob/main/backend/src/routes/notificationRoutes.js): `backend/src/routes/notificationRoutes.js`

### Rental operations

- [Authentication](https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Vehicle listings](https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/vehicleController.js): `backend/src/controllers/vehicleController.js`
- [Booking lifecycle](https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/bookingController.js): `backend/src/controllers/bookingController.js`
- [Rental reviews](https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/reviewController.js): `backend/src/controllers/reviewController.js`
- [Notifications](https://github.com/faheemahamed/vrms/blob/main/backend/src/controllers/notificationController.js): `backend/src/controllers/notificationController.js`

### MongoDB records

- [User records](https://github.com/faheemahamed/vrms/blob/main/backend/src/models/User.js): `backend/src/models/User.js`
- [Vehicle records](https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Vehicle.js): `backend/src/models/Vehicle.js`
- [Booking records](https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Booking.js): `backend/src/models/Booking.js`
- [Review records](https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Review.js): `backend/src/models/Review.js`
- [Notification records](https://github.com/faheemahamed/vrms/blob/main/backend/src/models/Notification.js): `backend/src/models/Notification.js`

### Other components

- **Customer**
- **Vehicle owner**
- **MongoDB**

## Connections

- Customer → Client routes: uses (evidence: `README.md`)
- Vehicle owner → Client routes: uses (evidence: `README.md`)
- Client routes → Vehicle discovery: routes to (evidence: `client/src/App.jsx`)
- Client routes → Sign in/up: routes to (evidence: `client/src/App.jsx`)
- Client routes → Vehicle details: routes to (evidence: `client/src/App.jsx`)
- Client routes → Rental dashboard: protects route (evidence: `client/src/App.jsx`)
- Client routes → Navigation: renders (evidence: `client/src/App.jsx`)
- Vehicle discovery → HTTP client: requests listings (evidence: `client/src/pages/Home.jsx`)
- Vehicle details → HTTP client: requests details (evidence: `client/src/pages/VehicleDetails.jsx`)
- Sign in/up → HTTP client: submits credentials (evidence: `README.md`)
- Rental dashboard → HTTP client: loads rentals (evidence: `client/src/pages/Dashboard.jsx`)
- Rental dashboard → Fleet management: renders (evidence: `client/src/pages/Dashboard.jsx`)
- Fleet management → HTTP client: manages listings (evidence: `client/src/components/OwnerVehicles.jsx`)
- Navigation → HTTP client: requests account (evidence: `client/src/components/Navbar.jsx`)
- HTTP client → HTTP server: sends API requests (evidence: `client/src/api/axiosInstance.js`)
- HTTP server → API mounting: starts (evidence: `backend/server.js`)
- API mounting → Auth routes: mounts (evidence: `backend/src/app.js`)
- API mounting → Vehicle routes: mounts (evidence: `backend/src/app.js`)
- API mounting → Booking routes: mounts (evidence: `backend/src/app.js`)
- API mounting → Review routes: mounts (evidence: `backend/src/app.js`)
- API mounting → Notification routes: mounts (evidence: `backend/src/app.js`)
- Auth routes → Authentication: dispatches (evidence: `backend/src/routes/authRoutes.js`)
- Auth routes → JWT and roles: protects (evidence: `backend/src/routes/authRoutes.js`)
- Vehicle routes → Vehicle listings: dispatches (evidence: `backend/src/routes/vehicleRoutes.js`)
- Vehicle routes → JWT and roles: protects (evidence: `backend/src/routes/vehicleRoutes.js`)
- Booking routes → Booking lifecycle: dispatches (evidence: `backend/src/routes/bookingRoutes.js`)
- Booking routes → JWT and roles: protects (evidence: `backend/src/routes/bookingRoutes.js`)
- Review routes → Rental reviews: dispatches (evidence: `backend/src/routes/reviewRoutes.js`)
- Review routes → JWT and roles: protects (evidence: `backend/src/routes/reviewRoutes.js`)
- Notification routes → Notifications: dispatches (evidence: `backend/src/routes/notificationRoutes.js`)
- Notification routes → JWT and roles: protects (evidence: `backend/src/routes/notificationRoutes.js`)
- JWT and roles → User records: loads user (evidence: `backend/src/middleware/authMiddleware.js`)
- Authentication → User records: reads/writes (evidence: `backend/src/controllers/authController.js`)
- Vehicle listings → Vehicle records: reads/writes (evidence: `backend/src/controllers/vehicleController.js`)
- Vehicle listings → Booking records: checks availability (evidence: `backend/src/controllers/vehicleController.js`)
- Booking lifecycle → Vehicle records: loads vehicle (evidence: `backend/src/controllers/bookingController.js`)
- Booking lifecycle → Booking records: creates and updates (evidence: `backend/src/controllers/bookingController.js`)
- Booking lifecycle → User records: loads customer (evidence: `backend/src/controllers/bookingController.js`)
- Booking lifecycle → Notification records: creates cancellation notice (evidence: `backend/src/controllers/bookingController.js`)
- Rental reviews → Booking records: checks completion (evidence: `backend/src/controllers/reviewController.js`)
- Rental reviews → Review records: reads/writes (evidence: `backend/src/controllers/reviewController.js`)
- Notifications → Notification records: reads/updates (evidence: `backend/src/controllers/notificationController.js`)
- User records → MongoDB: persists
- Vehicle records → MongoDB: persists
- Booking records → MongoDB: persists
- Review records → MongoDB: persists
- Notification records → MongoDB: persists
