# dheerajrai-dev/campusloop architecture

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

- Interactive diagram: https://gitdiagram.com/dheerajrai-dev/campusloop
- Repository: https://github.com/dheerajrai-dev/campusloop

## Overview

CampusLoop is a campus-scoped peer exchange platform. Students authenticate, discover or post requests and listings, submit offers, accept a proposal, coordinate and confirm completion, then build reputation through reviews; services, messaging, exploration, and moderation are parallel capabilities. The React client calls the FastAPI API, whose domain routers operate over SQLAlchemy-backed data. README documentation establishes the broader workflow and feature branches; source excerpts directly show app startup wiring and service-page API usage, so unsampled domain links are cited to the README rather than asserted from inspected implementation.

Main entry points: [`backend/app/api/v1`](https://github.com/dheerajrai-dev/campusloop/tree/main/backend/app/api/v1) (Versioned routers), [`frontend/src/App.tsx`](https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/App.tsx) (Web application), [`frontend/src/lib/api.ts`](https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/lib/api.ts) (HTTP client), [`backend/app/main.py`](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student application"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_authui["Authentication UI"]
  node_authstate["Auth context<br/>[AuthContext.tsx]"]
  node_requestui["Request board UI"]
  node_marketui["Marketplace UI"]
  node_serviceui["Services UI"]
  node_activityui["Activity and profile"]
  node_clientapi["HTTP client<br/>[api.ts]"]
end

subgraph group_api["REST API"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_routers["Versioned routers"]
  node_identity["Identity and campus<br/>[auth.py]"]
end

subgraph group_exchange["Exchange lifecycle"]
  node_requests["Requests and offers<br/>[requests.py]"]
  node_transactions["Transaction lifecycle<br/>[transactions.py]"]
  node_marketplace["Listings<br/>[listings.py]"]
  node_services["Student services<br/>[services.py]"]
end

subgraph group_community["Campus community"]
  node_explore["Discovery and matching<br/>[explore.py]"]
  node_users["Profiles and reputation<br/>[users.py]"]
  node_moderation["Community moderation<br/>[moderation.py]"]
  node_messaging["Messages<br/>[messages.py]"]
end

subgraph group_persistence["Data layer"]
  node_dbsession["Database session<br/>[session.py]"]
  node_models[("Domain models")]
  node_seed["Demo data seeding<br/>[seed.py]"]
end

node_student(("Student"))

node_student -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_authui
node_authui -->|"authenticates via"| node_authstate
node_authstate -->|"calls"| node_clientapi
node_webapp -->|"routes to"| node_requestui
node_webapp -->|"routes to"| node_marketui
node_webapp -->|"routes to"| node_serviceui
node_webapp -->|"routes to"| node_activityui
node_requestui -->|"submits requests"| node_clientapi
node_marketui -->|"fetches listings"| node_clientapi
node_serviceui -->|"fetches and books"| node_clientapi
node_activityui -->|"tracks activity"| node_clientapi
node_clientapi -->|"sends API calls"| node_fastapi
node_fastapi -->|"mounts routes"| node_routers
node_routers -->|"dispatches auth"| node_identity
node_routers -->|"dispatches requests"| node_requests
node_requests -->|"creates on acceptance"| node_transactions
node_transactions -->|"unlocks reviews"| node_users
node_routers -->|"dispatches listings"| node_marketplace
node_routers -->|"dispatches services"| node_services
node_routers -->|"dispatches discovery"| node_explore
node_routers -->|"dispatches reports"| node_moderation
node_routers -->|"dispatches messages"| node_messaging
node_fastapi -->|"initializes database"| node_dbsession
node_fastapi -->|"seeds when enabled"| node_seed
node_dbsession -.->|"persists domain data"| node_models

click node_webapp "https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/auth"
click node_authstate "https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/context/AuthContext.tsx"
click node_requestui "https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/requests"
click node_marketui "https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/marketplace"
click node_serviceui "https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/services"
click node_activityui "https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/activity"
click node_clientapi "https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/lib/api.ts"
click node_fastapi "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/main.py"
click node_routers "https://github.com/dheerajrai-dev/campusloop/tree/main/backend/app/api/v1"
click node_identity "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/auth.py"
click node_requests "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/requests.py"
click node_transactions "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/transactions.py"
click node_marketplace "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/listings.py"
click node_services "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/services.py"
click node_explore "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/explore.py"
click node_users "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/users.py"
click node_moderation "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/moderation.py"
click node_messaging "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/messages.py"
click node_dbsession "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/db/session.py"
click node_models "https://github.com/dheerajrai-dev/campusloop/tree/main/backend/app/models"
click node_seed "https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/db/seed.py"

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_webapp,node_authui,node_authstate,node_requestui,node_marketui,node_serviceui,node_activityui,node_clientapi toneBlue
class node_fastapi,node_routers,node_identity toneAmber
class node_requests,node_transactions,node_marketplace,node_services toneMint
class node_explore,node_users,node_moderation,node_messaging toneRose
class node_dbsession,node_models,node_seed,node_student toneIndigo
```

## Components

### Student application

- [Web application](https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Authentication UI](https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/auth): `frontend/src/features/auth`
- [Auth context](https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Request board UI](https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/requests): `frontend/src/features/requests`
- [Marketplace UI](https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/marketplace): `frontend/src/features/marketplace`
- [Services UI](https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/services): `frontend/src/features/services`
- [Activity and profile](https://github.com/dheerajrai-dev/campusloop/tree/main/frontend/src/features/activity): `frontend/src/features/activity`
- [HTTP client](https://github.com/dheerajrai-dev/campusloop/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### REST API

- [FastAPI app](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/main.py): `backend/app/main.py`
- [Versioned routers](https://github.com/dheerajrai-dev/campusloop/tree/main/backend/app/api/v1): `backend/app/api/v1`
- [Identity and campus](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`

### Exchange lifecycle

- [Requests and offers](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/requests.py): `backend/app/api/v1/requests.py`
- [Transaction lifecycle](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/transactions.py): `backend/app/api/v1/transactions.py`
- [Listings](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/listings.py): `backend/app/api/v1/listings.py`
- [Student services](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/services.py): `backend/app/api/v1/services.py`

### Campus community

- [Discovery and matching](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/explore.py): `backend/app/api/v1/explore.py`
- [Profiles and reputation](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/users.py): `backend/app/api/v1/users.py`
- [Community moderation](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/moderation.py): `backend/app/api/v1/moderation.py`
- [Messages](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/api/v1/messages.py): `backend/app/api/v1/messages.py`

### Data layer

- [Database session](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Domain models](https://github.com/dheerajrai-dev/campusloop/tree/main/backend/app/models): `backend/app/models`
- [Demo data seeding](https://github.com/dheerajrai-dev/campusloop/blob/main/backend/app/db/seed.py): `backend/app/db/seed.py`

### Other components

- **Student**

## Connections

- Student → Web application: uses (evidence: `README.md`)
- Web application → Authentication UI: routes to (evidence: `README.md`)
- Authentication UI → Auth context: authenticates via (evidence: `README.md`)
- Auth context → HTTP client: calls (evidence: `frontend/src/context/AuthContext.tsx`)
- Web application → Request board UI: routes to (evidence: `README.md`)
- Web application → Marketplace UI: routes to (evidence: `README.md`)
- Web application → Services UI: routes to (evidence: `README.md`)
- Web application → Activity and profile: routes to (evidence: `README.md`)
- Request board UI → HTTP client: submits requests (evidence: `README.md`)
- Marketplace UI → HTTP client: fetches listings (evidence: `README.md`)
- Services UI → HTTP client: fetches and books (evidence: `frontend/src/features/services/ServiceDetailPage.tsx`)
- Activity and profile → HTTP client: tracks activity (evidence: `README.md`)
- HTTP client → FastAPI app: sends API calls (evidence: `README.md`)
- FastAPI app → Versioned routers: mounts routes (evidence: `backend/app/main.py`)
- Versioned routers → Identity and campus: dispatches auth (evidence: `README.md`)
- Versioned routers → Requests and offers: dispatches requests (evidence: `README.md`)
- Requests and offers → Transaction lifecycle: creates on acceptance (evidence: `README.md`)
- Transaction lifecycle → Profiles and reputation: unlocks reviews (evidence: `README.md`)
- Versioned routers → Listings: dispatches listings (evidence: `README.md`)
- Versioned routers → Student services: dispatches services (evidence: `README.md`)
- Versioned routers → Discovery and matching: dispatches discovery (evidence: `README.md`)
- Versioned routers → Community moderation: dispatches reports (evidence: `README.md`)
- Versioned routers → Messages: dispatches messages (evidence: `README.md`)
- FastAPI app → Database session: initializes database (evidence: `backend/app/main.py`)
- FastAPI app → Demo data seeding: seeds when enabled (evidence: `backend/app/main.py`)
- Database session → Domain models: persists domain data
