# naresh-kumar08/campus_ride_share architecture

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

## Overview

Campus Ride Share is a student-only ride marketplace: students register and authenticate, browse or post rides, request and confirm bookings, complete trips, then rate participants or report complaints. Administrators manage users, rides, and complaints. The React app calls an Express API; its controllers implement domain rules over MongoDB models. The README documents OTP email verification and the major rating, complaint, and admin capabilities. Some UI and controller internals were not sampled, so their links are shown only where the README or source index supports them.

Main entry points: [`Backend/models/User.js`](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/User.js) (User records), [`Backend/middleware/auth.js`](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/middleware/auth.js) (JWT access control), [`Backend/models`](https://github.com/naresh-kumar08/campus_ride_share/tree/main/Backend/models) (Ride and booking records), [`Frontend/src/App.js`](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/App.js) (App routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student web app"]
  node_web["App routes<br/>[App.js]"]
  node_authui["Account screens<br/>[Register.js]"]
  node_authstate["Auth state<br/>[AuthContext.js]"]
  node_apiclient["API client<br/>[api.js]"]
  node_rideui["Ride discovery<br/>[Dashboard.js]"]
  node_historyui["Trip history<br/>[PreviousRides.js]"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.js]"]
end

subgraph group_identity["Identity and access"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_authlogic["Account services<br/>[authController.js]"]
  node_authguard["JWT access control<br/>[auth.js]"]
  node_users[("User records<br/>[User.js]")]
end

subgraph group_mobility["Rides and bookings"]
  node_rideroutes["Ride routes<br/>[rideRoutes.js]"]
  node_ridelogic["Ride management<br/>[rideController.js]"]
  node_ridebookings[("Ride and booking records")]
  node_bookingroutes["Booking routes<br/>[bookingRoutes.js]"]
  node_bookinglogic["Booking lifecycle"]
end

subgraph group_trust["Trust and administration"]
  node_ratinglogic["Two-sided ratings"]
  node_ratingdata[("Rating records<br/>[Rating.js]")]
  node_complaintlogic["Complaints"]
  node_complaintdata[("Complaint records<br/>[Complaint.js]")]
  node_adminroutes["Admin routes<br/>[adminRoutes.js]"]
  node_adminlogic["Admin management<br/>[adminController.js]"]
end

subgraph group_platform["API and persistence"]
  node_server["Express API<br/>[server.js]"]
  node_email["Email service<br/>[emailService.js]"]
end

node_student(("Student"))
node_mailprovider["Gmail SMTP"]
node_database[("MongoDB")]

node_student -->|"uses"| node_web
node_web -->|"routes to"| node_authui
node_web -->|"routes to"| node_rideui
node_web -->|"routes to"| node_historyui
node_web -->|"routes to"| node_adminui
node_authui -->|"uses"| node_authstate
node_authstate -->|"calls"| node_apiclient
node_rideui -->|"calls"| node_apiclient
node_historyui -->|"calls"| node_apiclient
node_adminui -->|"calls"| node_apiclient
node_apiclient -->|"sends requests"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_rideroutes
node_server -->|"mounts"| node_bookingroutes
node_server -->|"mounts"| node_adminroutes
node_authroutes -->|"dispatches"| node_authlogic
node_authroutes -->|"uses"| node_authguard
node_authlogic -->|"reads and writes"| node_users
node_authlogic -->|"sends verification"| node_email
node_authlogic -->|"creates tokens"| node_authguard
node_authguard -.->|"checks identity"| node_users
node_rideroutes -->|"dispatches"| node_ridelogic
node_rideroutes -->|"uses"| node_authguard
node_ridelogic -->|"reads and writes"| node_ridebookings
node_ridelogic -->|"checks rider"| node_users
node_bookingroutes -->|"dispatches"| node_bookinglogic
node_bookingroutes -->|"uses"| node_authguard
node_bookinglogic -->|"reads and writes"| node_ridebookings
node_bookinglogic -->|"checks participants"| node_users
node_bookinglogic -->|"checks prior ratings"| node_ratingdata
node_bookinglogic -->|"sends notices"| node_email
node_email -->|"sends mail"| node_mailprovider
node_adminroutes -->|"dispatches"| node_adminlogic
node_adminroutes -->|"uses"| node_authguard
node_adminlogic -->|"manages"| node_users
node_adminlogic -->|"manages"| node_ridebookings
node_adminlogic -->|"manages"| node_complaintdata
node_adminlogic -->|"reads"| node_ratingdata
node_ratinglogic -->|"records ratings"| node_ratingdata
node_ratinglogic -->|"checks trips"| node_ridebookings
node_ratinglogic -->|"updates ratings"| node_users
node_complaintlogic -->|"records reports"| node_complaintdata
node_complaintlogic -->|"checks trip"| node_ridebookings
node_complaintlogic -->|"notifies admin"| node_email
node_database -.->|"stores"| node_ridebookings
node_database -.->|"stores"| node_users
node_database -.->|"stores"| node_ratingdata
node_database -.->|"stores"| node_complaintdata

click node_web "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/App.js"
click node_authui "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/Register.js"
click node_authstate "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/context/AuthContext.js"
click node_apiclient "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/api.js"
click node_rideui "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/Dashboard.js"
click node_historyui "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/PreviousRides.js"
click node_adminui "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/AdminDashboard.js"
click node_server "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/server.js"
click node_authroutes "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/authRoutes.js"
click node_authlogic "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/authController.js"
click node_authguard "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/middleware/auth.js"
click node_users "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/User.js"
click node_rideroutes "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/rideRoutes.js"
click node_ridelogic "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/rideController.js"
click node_ridebookings "https://github.com/naresh-kumar08/campus_ride_share/tree/main/Backend/models"
click node_bookingroutes "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/bookingRoutes.js"
click node_bookinglogic "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/bookingController.js"
click node_ratinglogic "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/ratingController.js"
click node_ratingdata "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/Rating.js"
click node_complaintlogic "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/complaintController.js"
click node_complaintdata "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/Complaint.js"
click node_adminroutes "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/adminRoutes.js"
click node_adminlogic "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/adminController.js"
click node_email "https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/utils/emailService.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_web,node_authui,node_authstate,node_apiclient,node_rideui,node_historyui,node_adminui toneBlue
class node_authroutes,node_authlogic,node_authguard,node_users,node_database toneAmber
class node_rideroutes,node_ridelogic,node_ridebookings,node_bookingroutes,node_bookinglogic toneMint
class node_ratinglogic,node_ratingdata,node_complaintlogic,node_complaintdata,node_adminroutes,node_adminlogic toneRose
class node_server,node_email,node_student,node_mailprovider toneIndigo
```

## Components

### Student web app

- [App routes](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/App.js): `Frontend/src/App.js`
- [Account screens](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/Register.js): `Frontend/src/pages/Register.js`
- [Auth state](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/context/AuthContext.js): `Frontend/src/context/AuthContext.js`
- [API client](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/api.js): `Frontend/src/api.js`
- [Ride discovery](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/Dashboard.js): `Frontend/src/pages/Dashboard.js`
- [Trip history](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/PreviousRides.js): `Frontend/src/pages/PreviousRides.js`
- [Admin dashboard](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Frontend/src/pages/AdminDashboard.js): `Frontend/src/pages/AdminDashboard.js`

### Identity and access

- [Auth routes](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/authRoutes.js): `Backend/routes/authRoutes.js`
- [Account services](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/authController.js): `Backend/controllers/authController.js`
- [JWT access control](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/middleware/auth.js): `Backend/middleware/auth.js`
- [User records](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/User.js): `Backend/models/User.js`

### Rides and bookings

- [Ride routes](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/rideRoutes.js): `Backend/routes/rideRoutes.js`
- [Ride management](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/rideController.js): `Backend/controllers/rideController.js`
- [Ride and booking records](https://github.com/naresh-kumar08/campus_ride_share/tree/main/Backend/models): `Backend/models`
- [Booking routes](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/bookingRoutes.js): `Backend/routes/bookingRoutes.js`
- [Booking lifecycle](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/bookingController.js): `Backend/controllers/bookingController.js`

### Trust and administration

- [Two-sided ratings](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/ratingController.js): `Backend/controllers/ratingController.js`
- [Rating records](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/Rating.js): `Backend/models/Rating.js`
- [Complaints](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/complaintController.js): `Backend/controllers/complaintController.js`
- [Complaint records](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/models/Complaint.js): `Backend/models/Complaint.js`
- [Admin routes](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/routes/adminRoutes.js): `Backend/routes/adminRoutes.js`
- [Admin management](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/controllers/adminController.js): `Backend/controllers/adminController.js`

### API and persistence

- [Express API](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/server.js): `Backend/server.js`
- [Email service](https://github.com/naresh-kumar08/campus_ride_share/blob/main/Backend/utils/emailService.js): `Backend/utils/emailService.js`

### Other components

- **Student**
- **Gmail SMTP**
- **MongoDB**

## Connections

- Student → App routes: uses
- App routes → Account screens: routes to (evidence: `Frontend/src/App.js`)
- App routes → Ride discovery: routes to (evidence: `Frontend/src/App.js`)
- App routes → Trip history: routes to (evidence: `Frontend/src/App.js`)
- App routes → Admin dashboard: routes to (evidence: `Frontend/src/App.js`)
- Account screens → Auth state: uses (evidence: `Frontend/src/pages/Register.js`)
- Auth state → API client: calls (evidence: `Frontend/src/context/AuthContext.js`)
- Ride discovery → API client: calls (evidence: `Frontend/src/pages/Dashboard.js`)
- Trip history → API client: calls (evidence: `Frontend/src/pages/PreviousRides.js`)
- Admin dashboard → API client: calls (evidence: `Frontend/src/pages/AdminDashboard.js`)
- API client → Express API: sends requests
- Express API → Auth routes: mounts (evidence: `Backend/server.js`)
- Express API → Ride routes: mounts (evidence: `Backend/server.js`)
- Express API → Booking routes: mounts (evidence: `Backend/server.js`)
- Express API → Admin routes: mounts (evidence: `Backend/server.js`)
- Auth routes → Account services: dispatches (evidence: `Backend/routes/authRoutes.js`)
- Auth routes → JWT access control: uses (evidence: `Backend/routes/authRoutes.js`)
- Account services → User records: reads and writes (evidence: `Backend/controllers/authController.js`)
- Account services → Email service: sends verification (evidence: `Backend/controllers/authController.js`)
- Account services → JWT access control: creates tokens (evidence: `Backend/controllers/authController.js`)
- JWT access control → User records: checks identity
- Ride routes → Ride management: dispatches (evidence: `Backend/routes/rideRoutes.js`)
- Ride routes → JWT access control: uses (evidence: `Backend/routes/rideRoutes.js`)
- Ride management → Ride and booking records: reads and writes (evidence: `Backend/controllers/rideController.js`)
- Ride management → User records: checks rider (evidence: `Backend/controllers/rideController.js`)
- Booking routes → Booking lifecycle: dispatches (evidence: `Backend/routes/bookingRoutes.js`)
- Booking routes → JWT access control: uses (evidence: `Backend/routes/bookingRoutes.js`)
- Booking lifecycle → Ride and booking records: reads and writes (evidence: `Backend/controllers/bookingController.js`)
- Booking lifecycle → User records: checks participants (evidence: `Backend/controllers/bookingController.js`)
- Booking lifecycle → Rating records: checks prior ratings (evidence: `Backend/controllers/bookingController.js`)
- Booking lifecycle → Email service: sends notices (evidence: `Backend/controllers/bookingController.js`)
- Email service → Gmail SMTP: sends mail (evidence: `Backend/utils/emailService.js`)
- Admin routes → Admin management: dispatches (evidence: `Backend/routes/adminRoutes.js`)
- Admin routes → JWT access control: uses (evidence: `Backend/routes/adminRoutes.js`)
- Admin management → User records: manages (evidence: `Backend/controllers/adminController.js`)
- Admin management → Ride and booking records: manages (evidence: `Backend/controllers/adminController.js`)
- Admin management → Complaint records: manages (evidence: `Backend/controllers/adminController.js`)
- Admin management → Rating records: reads (evidence: `Backend/controllers/adminController.js`)
- Two-sided ratings → Rating records: records ratings (evidence: `Backend/controllers/ratingController.js`)
- Two-sided ratings → Ride and booking records: checks trips (evidence: `Backend/controllers/ratingController.js`)
- Two-sided ratings → User records: updates ratings (evidence: `Backend/controllers/ratingController.js`)
- Complaints → Complaint records: records reports (evidence: `Backend/controllers/complaintController.js`)
- Complaints → Ride and booking records: checks trip (evidence: `Backend/controllers/complaintController.js`)
- Complaints → Email service: notifies admin (evidence: `Backend/controllers/complaintController.js`)
- MongoDB → Ride and booking records: stores
- MongoDB → User records: stores
- MongoDB → Rating records: stores
- MongoDB → Complaint records: stores
