# mohit0129/car-marketplace architecture

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

- Interactive diagram: https://gitdiagram.com/mohit0129/car-marketplace
- Repository: https://github.com/mohit0129/car-marketplace

## Overview

This is a React/Express marketplace for used-car sales and rentals. The primary journey is browsing listings, opening a car detail page, then buying or arranging a rental; sellers can submit listings, while admins manage platform activity and reports. The graph also preserves authentication, payments, reviews, and rental booking as distinct capabilities. Some server route wiring and page-to-API calls are not shown in the excerpts, so those connections are omitted rather than inferred.

Main entry points: [`Client/src/App.jsx`](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/App.jsx) (Client router), [`Server/api/reportController.js`](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reportController.js) (Report controller), [`Client/src/admin/AdminDashboard.jsx`](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/AdminDashboard.jsx) (Admin dashboard), [`Server/app.js`](https://github.com/mohit0129/car-marketplace/blob/main/Server/app.js) (Express application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer experience"]
  node_app["Client router<br/>[App.jsx]"]
  node_home["Home and discovery<br/>[Home.jsx]"]
  node_explore["Car exploration<br/>[CarExplore.jsx]"]
  node_buy["Purchase details<br/>[BuyCarDetails.jsx]"]
  node_rent["Rental details<br/>[RentCarDetails.jsx]"]
  node_sell["Sell a car<br/>[SellCar.jsx]"]
  node_payment["Payment flow<br/>[Payment.jsx]"]
  node_auth["User authentication<br/>[UserAuth.jsx]"]
  node_api_config["API configuration<br/>[apiConfig.js]"]
end

subgraph group_server["Marketplace services"]
  node_server["Express application<br/>[app.js]"]
  node_listings_api["Listings API<br/>[listings.js]"]
  node_bookings_api["Bookings API<br/>[bookings.js]"]
  node_payments_api["Payments API<br/>[payments.js]"]
  node_reviews_api["Reviews API<br/>[reviews.js]"]
  node_report_api["Report generation<br/>[report-generate.js]"]
  node_report_routes["Report routes<br/>[reportRoutes.js]"]
  node_report_controller["Report controller"]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_car_admin["Listing moderation<br/>[CarManagement.jsx]"]
  node_booking_admin["Booking management"]
  node_user_admin["User management<br/>[UserManagement.jsx]"]
  node_payment_admin["Payment management"]
  node_report_ui["Report design<br/>[ReportDesign.jsx]"]
end

subgraph group_data["Persistence"]
  node_listing_model[("Car listings<br/>[CarListing.js]")]
  node_booking_model[("Bookings<br/>[Booking.js]")]
  node_payment_model[("Payments<br/>[Payment.js]")]
  node_review_model[("Reviews<br/>[Review.js]")]
  node_user_model[("Users<br/>[Users.js]")]
  node_db_connection["Database connection<br/>[db.js]"]
end

node_visitor(("Buyer, renter, seller"))
node_mongo[("MongoDB")]

node_visitor -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_explore
node_app -->|"routes to"| node_buy
node_app -->|"routes to"| node_rent
node_app -->|"routes to"| node_sell
node_app -->|"routes to"| node_payment
node_app -->|"imports"| node_auth
node_app -->|"routes to"| node_admin_ui
node_app -->|"routes to"| node_car_admin
node_app -->|"routes to"| node_booking_admin
node_server -->|"connects"| node_db_connection
node_db_connection -->|"connects"| node_mongo
node_listings_api -->|"reads and writes"| node_listing_model
node_listings_api -->|"uses"| node_review_model
node_bookings_api -->|"reads and writes"| node_booking_model
node_payments_api -->|"reads and writes"| node_payment_model
node_reviews_api -->|"uses"| node_review_model
node_report_routes -->|"routes to"| node_report_controller
node_report_controller -->|"aggregates"| node_listing_model
node_report_controller -->|"aggregates"| node_booking_model
node_report_controller -->|"aggregates"| node_payment_model
node_report_controller -->|"queries"| node_user_model
node_server -->|"mounts"| node_report_api
node_admin_ui -.->|"administers"| node_user_admin
node_admin_ui -.->|"administers"| node_payment_admin
node_admin_ui -.->|"manages reports"| node_report_ui

click node_app "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/App.jsx"
click node_home "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/main/Home.jsx"
click node_explore "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/CarExplore.jsx"
click node_buy "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/BuyCarDetails.jsx"
click node_rent "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/RentCarDetails.jsx"
click node_sell "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/SellCar.jsx"
click node_payment "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/Payment.jsx"
click node_auth "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/auth/UserAuth.jsx"
click node_api_config "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/config/apiConfig.js"
click node_admin_ui "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/AdminDashboard.jsx"
click node_car_admin "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/CarManagement.jsx"
click node_booking_admin "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/BookingManagement.jsx"
click node_user_admin "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/UserManagement.jsx"
click node_payment_admin "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/PaymentManagement.jsx"
click node_report_ui "https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/ReportDesign.jsx"
click node_server "https://github.com/mohit0129/car-marketplace/blob/main/Server/app.js"
click node_listings_api "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/listings.js"
click node_bookings_api "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/bookings.js"
click node_payments_api "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/payments.js"
click node_reviews_api "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reviews.js"
click node_report_api "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/report-generate.js"
click node_report_routes "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reportRoutes.js"
click node_report_controller "https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reportController.js"
click node_listing_model "https://github.com/mohit0129/car-marketplace/blob/main/Server/models/CarListing.js"
click node_booking_model "https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Booking.js"
click node_payment_model "https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Payment.js"
click node_review_model "https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Review.js"
click node_user_model "https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Users.js"
click node_db_connection "https://github.com/mohit0129/car-marketplace/blob/main/Server/db.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_home,node_explore,node_buy,node_rent,node_sell,node_payment,node_auth,node_api_config toneBlue
class node_server,node_listings_api,node_bookings_api,node_payments_api,node_reviews_api,node_report_api,node_report_routes,node_report_controller,node_mongo toneAmber
class node_admin_ui,node_car_admin,node_booking_admin,node_user_admin,node_payment_admin,node_report_ui toneMint
class node_listing_model,node_booking_model,node_payment_model,node_review_model,node_user_model,node_db_connection toneRose
class node_visitor toneIndigo
```

## Components

### Customer experience

- [Client router](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/App.jsx): `Client/src/App.jsx`
- [Home and discovery](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/main/Home.jsx): `Client/src/main/Home.jsx`
- [Car exploration](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/CarExplore.jsx): `Client/src/pages/CarExplore.jsx`
- [Purchase details](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/BuyCarDetails.jsx): `Client/src/pages/BuyCarDetails.jsx`
- [Rental details](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/RentCarDetails.jsx): `Client/src/pages/RentCarDetails.jsx`
- [Sell a car](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/SellCar.jsx): `Client/src/pages/SellCar.jsx`
- [Payment flow](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/pages/Payment.jsx): `Client/src/pages/Payment.jsx`
- [User authentication](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/auth/UserAuth.jsx): `Client/src/auth/UserAuth.jsx`
- [API configuration](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/config/apiConfig.js): `Client/src/config/apiConfig.js`

### Marketplace services

- [Express application](https://github.com/mohit0129/car-marketplace/blob/main/Server/app.js): `Server/app.js`
- [Listings API](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/listings.js): `Server/api/listings.js`
- [Bookings API](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/bookings.js): `Server/api/bookings.js`
- [Payments API](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/payments.js): `Server/api/payments.js`
- [Reviews API](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reviews.js): `Server/api/reviews.js`
- [Report generation](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/report-generate.js): `Server/api/report-generate.js`
- [Report routes](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reportRoutes.js): `Server/api/reportRoutes.js`
- [Report controller](https://github.com/mohit0129/car-marketplace/blob/main/Server/api/reportController.js): `Server/api/reportController.js`

### Administration

- [Admin dashboard](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/AdminDashboard.jsx): `Client/src/admin/AdminDashboard.jsx`
- [Listing moderation](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/CarManagement.jsx): `Client/src/admin/CarManagement.jsx`
- [Booking management](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/BookingManagement.jsx): `Client/src/admin/BookingManagement.jsx`
- [User management](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/UserManagement.jsx): `Client/src/admin/UserManagement.jsx`
- [Payment management](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/PaymentManagement.jsx): `Client/src/admin/PaymentManagement.jsx`
- [Report design](https://github.com/mohit0129/car-marketplace/blob/main/Client/src/admin/ReportDesign.jsx): `Client/src/admin/ReportDesign.jsx`

### Persistence

- [Car listings](https://github.com/mohit0129/car-marketplace/blob/main/Server/models/CarListing.js): `Server/models/CarListing.js`
- [Bookings](https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Booking.js): `Server/models/Booking.js`
- [Payments](https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Payment.js): `Server/models/Payment.js`
- [Reviews](https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Review.js): `Server/models/Review.js`
- [Users](https://github.com/mohit0129/car-marketplace/blob/main/Server/models/Users.js): `Server/models/Users.js`
- [Database connection](https://github.com/mohit0129/car-marketplace/blob/main/Server/db.js): `Server/db.js`

### Other components

- **Buyer, renter, seller**
- **MongoDB**

## Connections

- Buyer, renter, seller → Client router: uses
- Client router → Home and discovery: routes to (evidence: `Client/src/App.jsx`)
- Client router → Car exploration: routes to (evidence: `Client/src/App.jsx`)
- Client router → Purchase details: routes to (evidence: `Client/src/App.jsx`)
- Client router → Rental details: routes to (evidence: `Client/src/App.jsx`)
- Client router → Sell a car: routes to (evidence: `Client/src/App.jsx`)
- Client router → Payment flow: routes to (evidence: `Client/src/App.jsx`)
- Client router → User authentication: imports (evidence: `Client/src/App.jsx`)
- Client router → Admin dashboard: routes to (evidence: `Client/src/App.jsx`)
- Client router → Listing moderation: routes to (evidence: `Client/src/App.jsx`)
- Client router → Booking management: routes to (evidence: `Client/src/App.jsx`)
- Express application → Database connection: connects (evidence: `Server/app.js`)
- Database connection → MongoDB: connects (evidence: `Server/db.js`)
- Listings API → Car listings: reads and writes (evidence: `Server/api/listings.js`)
- Listings API → Reviews: uses (evidence: `Server/api/listings.js`)
- Bookings API → Bookings: reads and writes (evidence: `Server/api/bookings.js`)
- Payments API → Payments: reads and writes (evidence: `Server/api/payments.js`)
- Reviews API → Reviews: uses (evidence: `Server/api/reviews.js`)
- Report routes → Report controller: routes to (evidence: `Server/api/reportRoutes.js`)
- Report controller → Car listings: aggregates (evidence: `Server/api/reportController.js`)
- Report controller → Bookings: aggregates (evidence: `Server/api/reportController.js`)
- Report controller → Payments: aggregates (evidence: `Server/api/reportController.js`)
- Report controller → Users: queries (evidence: `Server/api/reportController.js`)
- Express application → Report generation: mounts (evidence: `Server/app.js`)
- Admin dashboard → User management: administers
- Admin dashboard → Payment management: administers
- Admin dashboard → Report design: manages reports
