# vrindanarang/unithrift architecture

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

- Interactive diagram: https://gitdiagram.com/vrindanarang/unithrift
- Repository: https://github.com/vrindanarang/unithrift

## Overview

Campus Exchange is a campus-restricted student marketplace. Students authenticate, browse or manage listings, and can create wanted requests; listings may trigger matching-request email notifications. The map includes documented marketplace, account, dashboard, and upload capabilities, plus repository-backed chat, AI, wishlist, and administration branches. Several frontend and backend subsystems are represented by their exact tree directories because their implementation files were not sampled; their internal links are omitted where evidence does not establish call ownership.

Main entry points: [`backend/src/app.js`](https://github.com/vrindanarang/unithrift/blob/main/backend/src/app.js) (Express API), [`backend/src/controllers/listing.controller.js`](https://github.com/vrindanarang/unithrift/blob/main/backend/src/controllers/listing.controller.js) (Listing handlers), [`frontend/src/App.jsx`](https://github.com/vrindanarang/unithrift/blob/main/frontend/src/App.jsx) (Web application), [`backend/src/services/auth.service.js`](https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/auth.service.js) (Account and verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student experience"]
  node_web["Web application<br/>[App.jsx]"]
  node_account_ui["Account experience<br/>[AuthContext.jsx]"]
  node_market_ui["Marketplace and dashboard"]
  node_api_client["HTTP client<br/>[axios.js]"]
end

subgraph group_api["API and domain"]
  node_api_app["Express API<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[auth.routes.js]"]
  node_auth_controller["Authentication handlers<br/>[auth.controller.js]"]
  node_auth_service["Account and verification<br/>[auth.service.js]"]
  node_listing_routes["Listing routes<br/>[listing.routes.js]"]
  node_listing_controller["Listing handlers"]
  node_listing_service["Listing search and management<br/>[listing.service.js]"]
  node_wanted["Wanted requests"]
  node_other_routes["User, wishlist, admin, AI"]
  node_other_services["Domain services"]
  node_chat["Chat API and service<br/>[chat.routes.js]"]
end

subgraph group_platform["Data and integrations"]
  node_database[("MySQL via Prisma<br/>[db.js]")]
  node_media["Cloudinary images<br/>[uploadImage.js]"]
  node_email["Email delivery<br/>[email.service.js]"]
end

subgraph group_realtime["Realtime and discovery"]
  node_socket["Socket.IO<br/>[index.js]"]
  node_embeddings["Semantic embeddings"]
  node_gemini["Gemini service<br/>[gemini.js]"]
end

node_student(("Student"))

node_student -->|"uses"| node_web
node_web -->|"hosts"| node_account_ui
node_web -.->|"renders"| node_market_ui
node_account_ui -->|"requests through"| node_api_client
node_api_client -.->|"calls"| node_api_app
node_api_app -->|"routes to"| node_auth_routes
node_api_app -->|"routes to"| node_listing_routes
node_api_app -->|"routes to"| node_other_routes
node_api_app -->|"routes to"| node_chat
node_auth_routes -->|"dispatches to"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"reads and writes"| node_database
node_auth_service -->|"sends verification"| node_email
node_listing_routes -->|"dispatches to"| node_listing_controller
node_listing_controller -->|"calls"| node_listing_service
node_listing_controller -->|"uploads images"| node_media
node_listing_controller -->|"notifies matches"| node_wanted
node_listing_service -.->|"persists listings"| node_database
node_wanted -.->|"emails matches"| node_email
node_other_routes -.->|"dispatches to"| node_other_services
node_other_routes -->|"includes chat endpoints"| node_chat
node_other_services -.->|"uses data store"| node_database
node_chat -.->|"supports realtime messaging"| node_socket
node_embeddings -->|"requests vectors"| node_gemini

click node_web "https://github.com/vrindanarang/unithrift/blob/main/frontend/src/App.jsx"
click node_account_ui "https://github.com/vrindanarang/unithrift/blob/main/frontend/src/context/AuthContext.jsx"
click node_market_ui "https://github.com/vrindanarang/unithrift/tree/main/frontend/src/pages"
click node_api_client "https://github.com/vrindanarang/unithrift/blob/main/frontend/src/api/axios.js"
click node_api_app "https://github.com/vrindanarang/unithrift/blob/main/backend/src/app.js"
click node_auth_routes "https://github.com/vrindanarang/unithrift/blob/main/backend/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/vrindanarang/unithrift/blob/main/backend/src/controllers/auth.controller.js"
click node_auth_service "https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/auth.service.js"
click node_listing_routes "https://github.com/vrindanarang/unithrift/blob/main/backend/src/routes/listing.routes.js"
click node_listing_controller "https://github.com/vrindanarang/unithrift/blob/main/backend/src/controllers/listing.controller.js"
click node_listing_service "https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/listing.service.js"
click node_wanted "https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/wantedRequest.service.js"
click node_other_routes "https://github.com/vrindanarang/unithrift/tree/main/backend/src/routes"
click node_other_services "https://github.com/vrindanarang/unithrift/tree/main/backend/src/services"
click node_chat "https://github.com/vrindanarang/unithrift/blob/main/backend/src/routes/chat.routes.js"
click node_database "https://github.com/vrindanarang/unithrift/blob/main/backend/src/config/db.js"
click node_media "https://github.com/vrindanarang/unithrift/blob/main/backend/src/utils/uploadImage.js"
click node_email "https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/email.service.js"
click node_socket "https://github.com/vrindanarang/unithrift/blob/main/backend/src/socket/index.js"
click node_embeddings "https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/embedding.service.js"
click node_gemini "https://github.com/vrindanarang/unithrift/blob/main/backend/src/config/gemini.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_account_ui,node_market_ui,node_api_client toneBlue
class node_api_app,node_auth_routes,node_auth_controller,node_auth_service,node_listing_routes,node_listing_controller,node_listing_service,node_wanted,node_other_routes,node_other_services,node_chat toneAmber
class node_database,node_media,node_email toneMint
class node_socket,node_embeddings,node_gemini toneRose
class node_student toneIndigo
```

## Components

### Student experience

- [Web application](https://github.com/vrindanarang/unithrift/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Account experience](https://github.com/vrindanarang/unithrift/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Marketplace and dashboard](https://github.com/vrindanarang/unithrift/tree/main/frontend/src/pages): `frontend/src/pages`
- [HTTP client](https://github.com/vrindanarang/unithrift/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`

### API and domain

- [Express API](https://github.com/vrindanarang/unithrift/blob/main/backend/src/app.js): `backend/src/app.js`
- [Authentication routes](https://github.com/vrindanarang/unithrift/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Authentication handlers](https://github.com/vrindanarang/unithrift/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Account and verification](https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/auth.service.js): `backend/src/services/auth.service.js`
- [Listing routes](https://github.com/vrindanarang/unithrift/blob/main/backend/src/routes/listing.routes.js): `backend/src/routes/listing.routes.js`
- [Listing handlers](https://github.com/vrindanarang/unithrift/blob/main/backend/src/controllers/listing.controller.js): `backend/src/controllers/listing.controller.js`
- [Listing search and management](https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/listing.service.js): `backend/src/services/listing.service.js`
- [Wanted requests](https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/wantedRequest.service.js): `backend/src/services/wantedRequest.service.js`
- [User, wishlist, admin, AI](https://github.com/vrindanarang/unithrift/tree/main/backend/src/routes): `backend/src/routes`
- [Domain services](https://github.com/vrindanarang/unithrift/tree/main/backend/src/services): `backend/src/services`
- [Chat API and service](https://github.com/vrindanarang/unithrift/blob/main/backend/src/routes/chat.routes.js): `backend/src/routes/chat.routes.js`

### Data and integrations

- [MySQL via Prisma](https://github.com/vrindanarang/unithrift/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [Cloudinary images](https://github.com/vrindanarang/unithrift/blob/main/backend/src/utils/uploadImage.js): `backend/src/utils/uploadImage.js`
- [Email delivery](https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/email.service.js): `backend/src/services/email.service.js`

### Realtime and discovery

- [Socket.IO](https://github.com/vrindanarang/unithrift/blob/main/backend/src/socket/index.js): `backend/src/socket/index.js`
- [Semantic embeddings](https://github.com/vrindanarang/unithrift/blob/main/backend/src/services/embedding.service.js): `backend/src/services/embedding.service.js`
- [Gemini service](https://github.com/vrindanarang/unithrift/blob/main/backend/src/config/gemini.js): `backend/src/config/gemini.js`

### Other components

- **Student**

## Connections

- Student → Web application: uses (evidence: `README.md`)
- Web application → Account experience: hosts (evidence: `frontend/src/main.jsx`)
- Web application → Marketplace and dashboard: renders
- Account experience → HTTP client: requests through (evidence: `frontend/src/context/AuthContext.jsx`)
- HTTP client → Express API: calls
- Express API → Authentication routes: routes to (evidence: `backend/src/app.js`)
- Express API → Listing routes: routes to (evidence: `backend/src/app.js`)
- Express API → User, wishlist, admin, AI: routes to (evidence: `backend/src/app.js`)
- Express API → Chat API and service: routes to (evidence: `backend/src/app.js`)
- Authentication routes → Authentication handlers: dispatches to (evidence: `backend/src/routes/auth.routes.js`)
- Authentication handlers → Account and verification: calls (evidence: `backend/src/controllers/auth.controller.js`)
- Account and verification → MySQL via Prisma: reads and writes (evidence: `backend/src/services/auth.service.js`)
- Account and verification → Email delivery: sends verification (evidence: `backend/src/services/auth.service.js`)
- Listing routes → Listing handlers: dispatches to (evidence: `backend/src/routes/listing.routes.js`)
- Listing handlers → Listing search and management: calls (evidence: `backend/src/controllers/listing.controller.js`)
- Listing handlers → Cloudinary images: uploads images (evidence: `backend/src/controllers/listing.controller.js`)
- Listing handlers → Wanted requests: notifies matches (evidence: `backend/src/controllers/listing.controller.js`)
- Listing search and management → MySQL via Prisma: persists listings
- Wanted requests → Email delivery: emails matches (evidence: `README.md`)
- User, wishlist, admin, AI → Domain services: dispatches to
- User, wishlist, admin, AI → Chat API and service: includes chat endpoints (evidence: `backend/src/app.js`)
- Domain services → MySQL via Prisma: uses data store (evidence: `backend/src/services/auth.service.js`)
- Chat API and service → Socket.IO: supports realtime messaging
- Semantic embeddings → Gemini service: requests vectors (evidence: `backend/src/services/embedding.service.js`)
