# anishkrishk/bruinsplit architecture

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

- Interactive diagram: https://gitdiagram.com/anishkrishk/bruinsplit
- Repository: https://github.com/anishkrishk/bruinsplit

## Overview

BruinSplit helps UCLA students find and coordinate shared rides. The main workflow is account access, browsing or posting rides, joining and managing ride membership, then coordinating with friends and other riders. The frontend routes users through ride, profile, and communication features; backend routes dispatch requests to domain controllers and services, with Supabase providing persistence. The README documents the product capabilities, while sampled sources show selected wiring; unsampled implementations and some frontend-to-backend links are represented only where the evidence supports them.

Main entry points: [`backend/server.js`](https://github.com/anishkrishk/bruinsplit/blob/main/backend/server.js) (HTTP server), [`frontend/bruinsplit/src/App.jsx`](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/App.jsx) (App routing), [`frontend/bruinsplit/src/pages/api/rides.js`](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/rides.js) (Ride API client), [`frontend/bruinsplit/src/pages/Postings.jsx`](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/Postings.jsx) (Ride postings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Student app"]
  node_app["App routing<br/>[App.jsx]"]
  node_authctx["Session context<br/>[AuthContext.jsx]"]
end

subgraph group_ride["Ride coordination"]
  node_postings["Ride postings<br/>[Postings.jsx]"]
  node_myrides["My rides<br/>[MyRides.jsx]"]
  node_ridecard["Ride details<br/>[card.jsx]"]
  node_rideapi["Ride API client<br/>[rides.js]"]
end

subgraph group_social["Social features"]
  node_profileui["Profiles<br/>[Profile.jsx]"]
  node_friendsapi["Friends API client<br/>[friends.js]"]
  node_messages["In-app messaging"]
  node_messagesapi["Messages API client<br/>[messages.js]"]
  node_callui["Audio and video calls<br/>[audioCall.jsx]"]
  node_callmanager["WebRTC call manager<br/>[callManager.js]"]
  node_callsapi["Calls API client<br/>[calls.js]"]
end

subgraph group_backend["Backend API"]
  node_server["HTTP server<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoute.js]"]
  node_rideroutes["Ride routes<br/>[ridesRoute.js]"]
  node_socialroutes["Social routes<br/>[friendsRoute.js]"]
  node_messageroutes["Message routes<br/>[messagesRoute.js]"]
  node_callroutes["Call routes<br/>[callsRoute.js]"]
  node_ridecontroller["Ride controller<br/>[ridesController.js]"]
  node_socialcontroller["Friends controller"]
  node_profilecontroller["Profile controller"]
  node_callcontroller["Call controller<br/>[callsController.js]"]
  node_messagescontroller["Messages controller"]
  node_rideservice["Ride services<br/>[rideService.js]"]
  node_friendservice["Friend services<br/>[friendsService.js]"]
  node_profileservice["Profile services<br/>[profileService.js]"]
  node_uploadservice["Photo uploads<br/>[uploadService.js]"]
  node_callservice["Call membership check<br/>[callsService.js]"]
end

subgraph group_data["Persistence"]
  node_supabase[("Supabase<br/>[supabase.js]")]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"provides session"| node_authctx
node_app -->|"routes to"| node_postings
node_app -->|"routes to"| node_myrides
node_app -->|"routes to"| node_profileui
node_postings -->|"requests rides"| node_rideapi
node_postings -->|"requests friends"| node_friendsapi
node_postings -->|"renders"| node_ridecard
node_myrides -.->|"requests rides"| node_rideapi
node_ridecard -.->|"loads ride details"| node_rideapi
node_profileui -->|"reads session"| node_authctx
node_profileui -->|"requests friends"| node_friendsapi
node_profileui -->|"requests rides"| node_rideapi
node_messages -.->|"exchanges messages"| node_messagesapi
node_callui -.->|"uses"| node_callmanager
node_callmanager -->|"signals peers"| node_callsapi
node_rideapi -->|"calls ride endpoints"| node_server
node_callsapi -.->|"calls API"| node_server
node_server -->|"registers"| node_authroutes
node_server -->|"registers"| node_rideroutes
node_server -->|"registers"| node_socialroutes
node_server -->|"registers"| node_messageroutes
node_server -->|"registers"| node_callroutes
node_rideroutes -->|"dispatches"| node_ridecontroller
node_socialroutes -->|"dispatches"| node_socialcontroller
node_messageroutes -->|"dispatches"| node_messagescontroller
node_callroutes -->|"dispatches"| node_callcontroller
node_ridecontroller -->|"delegates"| node_rideservice
node_socialcontroller -->|"delegates"| node_friendservice
node_profilecontroller -->|"delegates"| node_profileservice
node_profilecontroller -->|"uploads photos"| node_uploadservice
node_callcontroller -->|"checks membership"| node_callservice
node_rideservice -->|"reads and writes"| node_supabase
node_friendservice -->|"reads and writes"| node_supabase
node_profileservice -->|"reads and writes"| node_supabase
node_uploadservice -->|"uses storage"| node_supabase

click node_app "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/App.jsx"
click node_authctx "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/context/AuthContext.jsx"
click node_postings "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/Postings.jsx"
click node_myrides "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/MyRides.jsx"
click node_ridecard "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/card.jsx"
click node_rideapi "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/rides.js"
click node_profileui "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/Profile.jsx"
click node_friendsapi "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/friends.js"
click node_messages "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/MessagesSidebar.jsx"
click node_messagesapi "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/messages.js"
click node_callui "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/audioCall.jsx"
click node_callmanager "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/utils/callManager.js"
click node_callsapi "https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/calls.js"
click node_server "https://github.com/anishkrishk/bruinsplit/blob/main/backend/server.js"
click node_authroutes "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/authRoute.js"
click node_rideroutes "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/ridesRoute.js"
click node_socialroutes "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/friendsRoute.js"
click node_messageroutes "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/messagesRoute.js"
click node_callroutes "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/callsRoute.js"
click node_ridecontroller "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/ridesController.js"
click node_socialcontroller "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/friendsController.js"
click node_profilecontroller "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/profileController.js"
click node_callcontroller "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/callsController.js"
click node_messagescontroller "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/messagesController.js"
click node_rideservice "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/rideService.js"
click node_friendservice "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/friendsService.js"
click node_profileservice "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/profileService.js"
click node_uploadservice "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/uploadService.js"
click node_callservice "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/callsService.js"
click node_supabase "https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/supabase.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_authctx toneBlue
class node_postings,node_myrides,node_ridecard,node_rideapi toneAmber
class node_profileui,node_friendsapi,node_messages,node_messagesapi,node_callui,node_callmanager,node_callsapi toneMint
class node_server,node_authroutes,node_rideroutes,node_socialroutes,node_messageroutes,node_callroutes,node_ridecontroller,node_socialcontroller,node_profilecontroller,node_callcontroller,node_messagescontroller,node_rideservice,node_friendservice,node_profileservice,node_uploadservice,node_callservice toneRose
class node_supabase,node_student toneIndigo
```

## Components

### Student app

- [App routing](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/App.jsx): `frontend/bruinsplit/src/App.jsx`
- [Session context](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/context/AuthContext.jsx): `frontend/bruinsplit/src/context/AuthContext.jsx`

### Ride coordination

- [Ride postings](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/Postings.jsx): `frontend/bruinsplit/src/pages/Postings.jsx`
- [My rides](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/MyRides.jsx): `frontend/bruinsplit/src/pages/MyRides.jsx`
- [Ride details](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/card.jsx): `frontend/bruinsplit/src/components/card.jsx`
- [Ride API client](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/rides.js): `frontend/bruinsplit/src/pages/api/rides.js`

### Social features

- [Profiles](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/Profile.jsx): `frontend/bruinsplit/src/pages/Profile.jsx`
- [Friends API client](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/friends.js): `frontend/bruinsplit/src/pages/api/friends.js`
- [In-app messaging](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/MessagesSidebar.jsx): `frontend/bruinsplit/src/components/MessagesSidebar.jsx`
- [Messages API client](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/messages.js): `frontend/bruinsplit/src/pages/api/messages.js`
- [Audio and video calls](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/audioCall.jsx): `frontend/bruinsplit/src/components/audioCall.jsx`
- [WebRTC call manager](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/components/utils/callManager.js): `frontend/bruinsplit/src/components/utils/callManager.js`
- [Calls API client](https://github.com/anishkrishk/bruinsplit/blob/main/frontend/bruinsplit/src/pages/api/calls.js): `frontend/bruinsplit/src/pages/api/calls.js`

### Backend API

- [HTTP server](https://github.com/anishkrishk/bruinsplit/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/authRoute.js): `backend/src/routes/authRoute.js`
- [Ride routes](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/ridesRoute.js): `backend/src/routes/ridesRoute.js`
- [Social routes](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/friendsRoute.js): `backend/src/routes/friendsRoute.js`
- [Message routes](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/messagesRoute.js): `backend/src/routes/messagesRoute.js`
- [Call routes](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/routes/callsRoute.js): `backend/src/routes/callsRoute.js`
- [Ride controller](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/ridesController.js): `backend/src/controllers/ridesController.js`
- [Friends controller](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/friendsController.js): `backend/src/controllers/friendsController.js`
- [Profile controller](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/profileController.js): `backend/src/controllers/profileController.js`
- [Call controller](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/callsController.js): `backend/src/controllers/callsController.js`
- [Messages controller](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/controllers/messagesController.js): `backend/src/controllers/messagesController.js`
- [Ride services](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/rideService.js): `backend/src/services/rideService.js`
- [Friend services](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/friendsService.js): `backend/src/services/friendsService.js`
- [Profile services](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/profileService.js): `backend/src/services/profileService.js`
- [Photo uploads](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/uploadService.js): `backend/src/services/uploadService.js`
- [Call membership check](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/services/callsService.js): `backend/src/services/callsService.js`

### Persistence

- [Supabase](https://github.com/anishkrishk/bruinsplit/blob/main/backend/src/supabase.js): `backend/src/supabase.js`

### Other components

- **Student**

## Connections

- Student → App routing: uses (evidence: `README.md`)
- App routing → Session context: provides session (evidence: `frontend/bruinsplit/src/App.jsx`)
- App routing → Ride postings: routes to (evidence: `frontend/bruinsplit/src/App.jsx`)
- App routing → My rides: routes to (evidence: `frontend/bruinsplit/src/App.jsx`)
- App routing → Profiles: routes to (evidence: `frontend/bruinsplit/src/App.jsx`)
- Ride postings → Ride API client: requests rides (evidence: `frontend/bruinsplit/src/pages/Postings.jsx`)
- Ride postings → Friends API client: requests friends (evidence: `frontend/bruinsplit/src/pages/Postings.jsx`)
- Ride postings → Ride details: renders (evidence: `frontend/bruinsplit/src/pages/Postings.jsx`)
- My rides → Ride API client: requests rides
- Ride details → Ride API client: loads ride details
- Profiles → Session context: reads session (evidence: `frontend/bruinsplit/src/pages/Profile.jsx`)
- Profiles → Friends API client: requests friends (evidence: `frontend/bruinsplit/src/pages/Profile.jsx`)
- Profiles → Ride API client: requests rides (evidence: `frontend/bruinsplit/src/pages/Profile.jsx`)
- In-app messaging → Messages API client: exchanges messages
- Audio and video calls → WebRTC call manager: uses
- WebRTC call manager → Calls API client: signals peers (evidence: `frontend/bruinsplit/src/components/utils/callManager.js`)
- Ride API client → HTTP server: calls ride endpoints (evidence: `frontend/bruinsplit/src/pages/api/rides.js`)
- Calls API client → HTTP server: calls API
- HTTP server → Auth routes: registers (evidence: `backend/server.js`)
- HTTP server → Ride routes: registers (evidence: `backend/server.js`)
- HTTP server → Social routes: registers (evidence: `backend/server.js`)
- HTTP server → Message routes: registers (evidence: `backend/server.js`)
- HTTP server → Call routes: registers (evidence: `backend/server.js`)
- Ride routes → Ride controller: dispatches
- Social routes → Friends controller: dispatches (evidence: `backend/src/routes/friendsRoute.js`)
- Message routes → Messages controller: dispatches (evidence: `backend/src/routes/messagesRoute.js`)
- Call routes → Call controller: dispatches (evidence: `backend/src/routes/callsRoute.js`)
- Ride controller → Ride services: delegates (evidence: `backend/src/controllers/ridesController.js`)
- Friends controller → Friend services: delegates (evidence: `backend/src/controllers/friendsController.js`)
- Profile controller → Profile services: delegates (evidence: `backend/src/controllers/profileController.js`)
- Profile controller → Photo uploads: uploads photos (evidence: `backend/src/controllers/profileController.js`)
- Call controller → Call membership check: checks membership (evidence: `backend/src/controllers/callsController.js`)
- Ride services → Supabase: reads and writes (evidence: `backend/src/services/rideService.js`)
- Friend services → Supabase: reads and writes (evidence: `backend/src/services/friendsService.js`)
- Profile services → Supabase: reads and writes (evidence: `backend/src/services/profileService.js`)
- Photo uploads → Supabase: uses storage (evidence: `backend/src/services/uploadService.js`)
