# pandeymohit20/rentcar-backend architecture

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

- Interactive diagram: https://gitdiagram.com/pandeymohit20/rentcar-backend
- Repository: https://github.com/pandeymohit20/rentcar-backend

## Overview

RentCar is a multi-tenant car-rental backend API. Its central user-facing flow exposes versioned REST endpoints for authentication, fleet discovery and availability, bookings, payments, and related records; staff-facing domains support fleet and platform operations. The README documents a controller → service → repository design and Prisma/MySQL persistence. The route registry and some controllers are excerpted, but most domain implementations are not, so links between domain stages are limited to documented capabilities rather than inferred calls.

Main entry points: [`src/routes/index.js`](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/routes/index.js) (API router), [`src/app.js`](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/app.js) (Express app), [`src/modules/auth`](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/auth) (Auth), [`src/middlewares/authenticate.js`](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/middlewares/authenticate.js) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API foundation"]
  node_app["Express app<br/>[app.js]"]
  node_router["API router<br/>[index.js]"]
  node_database[("Prisma / MySQL<br/>[database.js]")]
end

subgraph group_identity["Identity and access"]
  node_authmw["Authentication<br/>[authenticate.js]"]
  node_auth["Auth"]
  node_users["User accounts"]
end

subgraph group_rental["Rental lifecycle"]
  node_fleet["Fleet catalog"]
  node_availability["Availability"]
  node_pricing["Pricing"]
  node_bookings["Bookings"]
  node_bookingreads["Booking reads"]
  node_payments["Payments"]
  node_refunds["Refunds"]
  node_wallet["Wallet"]
  node_invoices["Invoices"]
end

subgraph group_operations["Platform operations"]
  node_vendors["Vendors"]
  node_locations["Locations"]
  node_inventory["Inventory"]
  node_kyc["KYC"]
  node_analytics["Analytics and reports"]
  node_support["Customer support"]
  node_reviews["Reviews"]
end

node_clients(("API clients"))

node_clients -->|"send requests"| node_app
node_app -->|"mounts API"| node_router
node_router -->|"mounts routes"| node_auth
node_router -.->|"mounts routes"| node_users
node_router -->|"mounts routes"| node_fleet
node_router -->|"mounts routes"| node_availability
node_router -.->|"mounts routes"| node_bookings
node_router -.->|"mounts routes"| node_payments
node_router -.->|"mounts routes"| node_bookingreads
node_router -->|"mounts routes"| node_refunds
node_router -->|"mounts routes"| node_invoices
node_router -.->|"mounts routes"| node_vendors
node_router -.->|"mounts routes"| node_locations
node_router -->|"mounts routes"| node_inventory
node_router -->|"mounts routes"| node_kyc
node_router -.->|"mounts routes"| node_analytics
node_router -->|"mounts routes"| node_support
node_router -->|"mounts routes"| node_reviews
node_authmw -->|"loads auth constants"| node_auth
node_app -.->|"configures through modules"| node_database

click node_app "https://github.com/pandeymohit20/rentcar-backend/blob/main/src/app.js"
click node_router "https://github.com/pandeymohit20/rentcar-backend/blob/main/src/routes/index.js"
click node_authmw "https://github.com/pandeymohit20/rentcar-backend/blob/main/src/middlewares/authenticate.js"
click node_auth "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/auth"
click node_users "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/users"
click node_vendors "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/vendors"
click node_locations "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/locations"
click node_fleet "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/cars"
click node_availability "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/availability"
click node_pricing "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/pricing"
click node_bookings "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/bookings"
click node_bookingreads "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/bookingReads"
click node_payments "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/payments"
click node_refunds "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/refunds"
click node_wallet "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/wallet"
click node_invoices "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/invoices"
click node_inventory "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/inventory"
click node_kyc "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/kyc"
click node_analytics "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/analytics"
click node_support "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/support"
click node_reviews "https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/reviews"
click node_database "https://github.com/pandeymohit20/rentcar-backend/blob/main/src/config/database.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_router,node_database,node_clients toneBlue
class node_authmw,node_auth,node_users toneAmber
class node_fleet,node_availability,node_pricing,node_bookings,node_bookingreads,node_payments,node_refunds,node_wallet,node_invoices toneMint
class node_vendors,node_locations,node_inventory,node_kyc,node_analytics,node_support,node_reviews toneRose
```

## Components

### API foundation

- [Express app](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/app.js): `src/app.js`
- [API router](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/routes/index.js): `src/routes/index.js`
- [Prisma / MySQL](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/config/database.js): `src/config/database.js`

### Identity and access

- [Authentication](https://github.com/pandeymohit20/rentcar-backend/blob/main/src/middlewares/authenticate.js): `src/middlewares/authenticate.js`
- [Auth](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/auth): `src/modules/auth`
- [User accounts](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/users): `src/modules/users`

### Rental lifecycle

- [Fleet catalog](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/cars): `src/modules/cars`
- [Availability](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/availability): `src/modules/availability`
- [Pricing](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/pricing): `src/modules/pricing`
- [Bookings](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/bookings): `src/modules/bookings`
- [Booking reads](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/bookingReads): `src/modules/bookingReads`
- [Payments](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/payments): `src/modules/payments`
- [Refunds](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/refunds): `src/modules/refunds`
- [Wallet](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/wallet): `src/modules/wallet`
- [Invoices](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/invoices): `src/modules/invoices`

### Platform operations

- [Vendors](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/vendors): `src/modules/vendors`
- [Locations](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/locations): `src/modules/locations`
- [Inventory](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/inventory): `src/modules/inventory`
- [KYC](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/kyc): `src/modules/kyc`
- [Analytics and reports](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/analytics): `src/modules/analytics`
- [Customer support](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/support): `src/modules/support`
- [Reviews](https://github.com/pandeymohit20/rentcar-backend/tree/main/src/modules/reviews): `src/modules/reviews`

### Other components

- **API clients**

## Connections

- API clients → Express app: send requests (evidence: `README.md`)
- Express app → API router: mounts API (evidence: `src/app.js`)
- API router → Auth: mounts routes (evidence: `src/routes/index.js`)
- API router → User accounts: mounts routes (evidence: `src/routes/index.js`)
- API router → Fleet catalog: mounts routes (evidence: `src/routes/index.js`)
- API router → Availability: mounts routes (evidence: `src/routes/index.js`)
- API router → Bookings: mounts routes (evidence: `src/routes/index.js`)
- API router → Payments: mounts routes (evidence: `src/routes/index.js`)
- API router → Booking reads: mounts routes (evidence: `src/routes/index.js`)
- API router → Refunds: mounts routes (evidence: `src/routes/index.js`)
- API router → Invoices: mounts routes (evidence: `src/routes/index.js`)
- API router → Vendors: mounts routes (evidence: `src/routes/index.js`)
- API router → Locations: mounts routes (evidence: `src/routes/index.js`)
- API router → Inventory: mounts routes (evidence: `src/routes/index.js`)
- API router → KYC: mounts routes (evidence: `src/routes/index.js`)
- API router → Analytics and reports: mounts routes (evidence: `src/routes/index.js`)
- API router → Customer support: mounts routes (evidence: `src/routes/index.js`)
- API router → Reviews: mounts routes (evidence: `src/routes/index.js`)
- Authentication → Auth: loads auth constants (evidence: `src/middlewares/authenticate.js`)
- Express app → Prisma / MySQL: configures through modules
