# nischalsb/bader-rides architecture

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

- Interactive diagram: https://gitdiagram.com/nischalsb/bader-rides
- Repository: https://github.com/nischalsb/bader-rides

## Overview

BadgerRides is a UW–Madison student carpooling app. Students authenticate with university email, post or browse rides, join rides or find matches, and coordinate through ride-linked conversations. The frontend routes these activities and calls an authenticated API; backend controllers handle account, ride, and conversation operations against Prisma-backed data. Password recovery and real-time chat are additional capabilities. The README documents the product scope; source excerpts establish selected controller and frontend behavior, while some route and integration details are supported only by the source index.

Main entry points: [`frontend/src/App.jsx`](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/App.jsx) (App router), [`frontend/src/utils/api.js`](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/utils/api.js) (API client), [`backend/src/controllers/rideController.js`](https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/rideController.js) (Ride operations), [`backend/src/prismaClient.js`](https://github.com/nischalsb/bader-rides/blob/main/backend/src/prismaClient.js) (Prisma client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student app"]
  node_app["App router<br/>[App.jsx]"]
  node_authpage["Sign in / register<br/>[AuthPage.jsx]"]
  node_browse["Browse rides<br/>[BrowseRides.jsx]"]
  node_post["Post ride<br/>[PostRide.jsx]"]
  node_matching["Ride matching<br/>[Matching.jsx]"]
  node_myrides["My rides<br/>[MyRides.jsx]"]
  node_messages["Messages<br/>[Messages.jsx]"]
  node_apiutil["API client<br/>[api.js]"]
  node_appdata["Ride data hook<br/>[useAppData.js]"]
end

subgraph group_server["API services"]
  node_authroutes["Auth routes<br/>[auth.js]"]
  node_rideroutes["Ride routes<br/>[rides.js]"]
  node_convoroutes["Conversation routes<br/>[conversations.js]"]
  node_authctrl["Account and recovery<br/>[authController.js]"]
  node_jwt["JWT authentication<br/>[authenticateJWT.js]"]
  node_ridectrl["Ride operations<br/>[rideController.js]"]
  node_matchingservice["Match finder<br/>[matchingService.js]"]
  node_rideservice["Ride enrichment<br/>[rideService.js]"]
  node_convctrl["Conversation operations"]
  node_email["Email delivery<br/>[emailService.js]"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma client<br/>[prismaClient.js]"]
  node_db[("PostgreSQL data<br/>[schema.prisma]")]
end

subgraph group_realtime["Live messaging"]
  node_socket["Socket.IO server<br/>[socket.js]"]
end

node_student(("UW student"))
node_emailprovider(("Email provider"))

node_student -->|"uses"| node_app
node_app -->|"routes to"| node_authpage
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_post
node_app -->|"routes to"| node_matching
node_app -->|"routes to"| node_myrides
node_app -->|"routes to"| node_messages
node_authpage -->|"submits credentials"| node_apiutil
node_app -->|"checks session"| node_apiutil
node_app -->|"loads app data"| node_appdata
node_appdata -->|"requests data"| node_apiutil
node_apiutil -.->|"calls API"| node_authroutes
node_apiutil -.->|"calls API"| node_rideroutes
node_apiutil -.->|"calls API"| node_convoroutes
node_authroutes -->|"dispatches"| node_authctrl
node_rideroutes -->|"dispatches"| node_ridectrl
node_convoroutes -->|"dispatches"| node_convctrl
node_authctrl -->|"signs tokens"| node_jwt
node_authctrl -->|"sends reset email"| node_email
node_email -.->|"delivers email"| node_emailprovider
node_ridectrl -->|"finds matches"| node_matchingservice
node_ridectrl -->|"enriches rides"| node_rideservice
node_ridectrl -.->|"creates conversation"| node_convctrl
node_authctrl -->|"reads and writes"| node_prisma
node_ridectrl -->|"reads and writes"| node_prisma
node_convctrl -->|"reads and writes"| node_prisma
node_matchingservice -->|"queries rides"| node_prisma
node_prisma -.->|"persists records"| node_db
node_app -.->|"connects"| node_socket
node_convctrl -.->|"emits messages"| node_socket

click node_app "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/App.jsx"
click node_authpage "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/AuthPage.jsx"
click node_browse "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/BrowseRides.jsx"
click node_post "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/PostRide.jsx"
click node_matching "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/Matching.jsx"
click node_myrides "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/MyRides.jsx"
click node_messages "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/Messages.jsx"
click node_apiutil "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/utils/api.js"
click node_appdata "https://github.com/nischalsb/bader-rides/blob/main/frontend/src/hooks/useAppData.js"
click node_authroutes "https://github.com/nischalsb/bader-rides/blob/main/backend/src/routes/auth.js"
click node_rideroutes "https://github.com/nischalsb/bader-rides/blob/main/backend/src/routes/rides.js"
click node_convoroutes "https://github.com/nischalsb/bader-rides/blob/main/backend/src/routes/conversations.js"
click node_authctrl "https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/authController.js"
click node_jwt "https://github.com/nischalsb/bader-rides/blob/main/backend/src/middleware/authenticateJWT.js"
click node_ridectrl "https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/rideController.js"
click node_matchingservice "https://github.com/nischalsb/bader-rides/blob/main/backend/src/services/matchingService.js"
click node_rideservice "https://github.com/nischalsb/bader-rides/blob/main/backend/src/services/rideService.js"
click node_convctrl "https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/conversationController.js"
click node_email "https://github.com/nischalsb/bader-rides/blob/main/backend/src/services/emailService.js"
click node_prisma "https://github.com/nischalsb/bader-rides/blob/main/backend/src/prismaClient.js"
click node_db "https://github.com/nischalsb/bader-rides/blob/main/backend/prisma/schema.prisma"
click node_socket "https://github.com/nischalsb/bader-rides/blob/main/backend/src/socket.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_authpage,node_browse,node_post,node_matching,node_myrides,node_messages,node_apiutil,node_appdata toneBlue
class node_authroutes,node_rideroutes,node_convoroutes,node_authctrl,node_jwt,node_ridectrl,node_matchingservice,node_rideservice,node_convctrl,node_email toneAmber
class node_prisma,node_db toneMint
class node_socket toneRose
class node_student,node_emailprovider toneIndigo
```

## Components

### Student app

- [App router](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign in / register](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/AuthPage.jsx): `frontend/src/pages/AuthPage.jsx`
- [Browse rides](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/BrowseRides.jsx): `frontend/src/pages/BrowseRides.jsx`
- [Post ride](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/PostRide.jsx): `frontend/src/pages/PostRide.jsx`
- [Ride matching](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/Matching.jsx): `frontend/src/pages/Matching.jsx`
- [My rides](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/MyRides.jsx): `frontend/src/pages/MyRides.jsx`
- [Messages](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/pages/Messages.jsx): `frontend/src/pages/Messages.jsx`
- [API client](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/utils/api.js): `frontend/src/utils/api.js`
- [Ride data hook](https://github.com/nischalsb/bader-rides/blob/main/frontend/src/hooks/useAppData.js): `frontend/src/hooks/useAppData.js`

### API services

- [Auth routes](https://github.com/nischalsb/bader-rides/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Ride routes](https://github.com/nischalsb/bader-rides/blob/main/backend/src/routes/rides.js): `backend/src/routes/rides.js`
- [Conversation routes](https://github.com/nischalsb/bader-rides/blob/main/backend/src/routes/conversations.js): `backend/src/routes/conversations.js`
- [Account and recovery](https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [JWT authentication](https://github.com/nischalsb/bader-rides/blob/main/backend/src/middleware/authenticateJWT.js): `backend/src/middleware/authenticateJWT.js`
- [Ride operations](https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/rideController.js): `backend/src/controllers/rideController.js`
- [Match finder](https://github.com/nischalsb/bader-rides/blob/main/backend/src/services/matchingService.js): `backend/src/services/matchingService.js`
- [Ride enrichment](https://github.com/nischalsb/bader-rides/blob/main/backend/src/services/rideService.js): `backend/src/services/rideService.js`
- [Conversation operations](https://github.com/nischalsb/bader-rides/blob/main/backend/src/controllers/conversationController.js): `backend/src/controllers/conversationController.js`
- [Email delivery](https://github.com/nischalsb/bader-rides/blob/main/backend/src/services/emailService.js): `backend/src/services/emailService.js`

### Persistence

- [Prisma client](https://github.com/nischalsb/bader-rides/blob/main/backend/src/prismaClient.js): `backend/src/prismaClient.js`
- [PostgreSQL data](https://github.com/nischalsb/bader-rides/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Live messaging

- [Socket.IO server](https://github.com/nischalsb/bader-rides/blob/main/backend/src/socket.js): `backend/src/socket.js`

### Other components

- **UW student**
- **Email provider**

## Connections

- UW student → App router: uses (evidence: `README.md`)
- App router → Sign in / register: routes to (evidence: `frontend/src/App.jsx`)
- App router → Browse rides: routes to (evidence: `frontend/src/App.jsx`)
- App router → Post ride: routes to (evidence: `frontend/src/App.jsx`)
- App router → Ride matching: routes to (evidence: `frontend/src/App.jsx`)
- App router → My rides: routes to (evidence: `frontend/src/App.jsx`)
- App router → Messages: routes to (evidence: `frontend/src/App.jsx`)
- Sign in / register → API client: submits credentials (evidence: `frontend/src/pages/AuthPage.jsx`)
- App router → API client: checks session (evidence: `frontend/src/App.jsx`)
- App router → Ride data hook: loads app data (evidence: `frontend/src/App.jsx`)
- Ride data hook → API client: requests data (evidence: `frontend/src/hooks/useAppData.js`)
- API client → Auth routes: calls API
- API client → Ride routes: calls API
- API client → Conversation routes: calls API
- Auth routes → Account and recovery: dispatches (evidence: `backend/src/routes/auth.js`)
- Ride routes → Ride operations: dispatches (evidence: `backend/src/routes/rides.js`)
- Conversation routes → Conversation operations: dispatches (evidence: `backend/src/routes/conversations.js`)
- Account and recovery → JWT authentication: signs tokens (evidence: `backend/src/controllers/authController.js`)
- Account and recovery → Email delivery: sends reset email (evidence: `backend/src/controllers/authController.js`)
- Email delivery → Email provider: delivers email
- Ride operations → Match finder: finds matches (evidence: `backend/src/controllers/rideController.js`)
- Ride operations → Ride enrichment: enriches rides (evidence: `backend/src/controllers/rideController.js`)
- Ride operations → Conversation operations: creates conversation
- Account and recovery → Prisma client: reads and writes (evidence: `backend/src/controllers/authController.js`)
- Ride operations → Prisma client: reads and writes (evidence: `backend/src/controllers/rideController.js`)
- Conversation operations → Prisma client: reads and writes (evidence: `backend/src/controllers/conversationController.js`)
- Match finder → Prisma client: queries rides (evidence: `backend/src/services/matchingService.js`)
- Prisma client → PostgreSQL data: persists records
- App router → Socket.IO server: connects
- Conversation operations → Socket.IO server: emits messages
