# shashwatnarwal9/campusgig architecture

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

- Interactive diagram: https://gitdiagram.com/shashwatnarwal9/campusgig
- Repository: https://github.com/shashwatnarwal9/campusgig

## Overview

CampusGig is a student-only gig marketplace, with a workflow from institutional-email signup through gig applications, escrow-backed contracts, delivery, review or dispute, and ratings. The React frontend calls a FastAPI backend, whose services implement the marketplace and money rules over PostgreSQL. Separate capabilities include profile-file storage, timeout handling, and administrator oversight. The graph preserves documented capabilities even where their implementation was not sampled; those edges cite the README, and unsampled implementation details are represented at their existing directory paths.

Main entry points: [`code/backend/app/main.py`](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/main.py) (FastAPI application), [`code/frontend/src/routes/AppRoutes.tsx`](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/routes/AppRoutes.tsx) (App routes), [`code/backend/app/services/contract_service.py`](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/contract_service.py) (Contract and delivery services), [`code/frontend/src/services/apiClient.ts`](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/services/apiClient.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student interface"]
  node_routes["App routes<br/>[AppRoutes.tsx]"]
  node_api_client["API client<br/>[apiClient.ts]"]
  node_auth_ui["Auth interface<br/>[AuthProvider.tsx]"]
  node_gig_ui["Gig and application pages<br/>[GigsPage.tsx]"]
  node_contract_ui["Contract pages<br/>[ContractsPage.tsx]"]
  node_wallet_ui["Wallet page<br/>[WalletPage.tsx]"]
  node_admin_ui["Admin pages"]
end

subgraph group_identity["Identity and profiles"]
  node_api["FastAPI application<br/>[main.py]"]
  node_auth["Authentication service<br/>[auth_service.py]"]
  node_profile["Profile services<br/>[profile_service.py]"]
end

subgraph group_market["Gig marketplace"]
  node_gigs["Gig services<br/>[gig_service.py]"]
  node_applications["Application services"]
end

subgraph group_work["Contracts and money"]
  node_contracts["Contract and delivery services"]
  node_escrow["Escrow and ledger<br/>[escrow_service.py]"]
  node_payments["Payment services<br/>[payment_service.py]"]
  node_ratings["Ratings and reputation<br/>[rating_service.py]"]
  node_storage["Media and deliverables<br/>[storage_service.py]"]
end

subgraph group_oversight["Operations and oversight"]
  node_sweeper["Timeout sweeper<br/>[sweeper.py]"]
  node_admin["Administration and disputes<br/>[admin_service.py]"]
  node_reconciliation["Ledger reconciliation"]
  node_audit[("Audit log<br/>[audit_repo.py]")]
end

node_student(("Student"))
node_admin_actor(("Administrator"))
node_razorpay{{"Razorpay"}}
node_postgres[("PostgreSQL data<br/>[session.py]")]

node_student -->|"uses"| node_routes
node_admin_actor -->|"uses"| node_routes
node_routes -->|"routes to"| node_auth_ui
node_routes -->|"routes to"| node_gig_ui
node_routes -->|"routes to"| node_contract_ui
node_routes -->|"routes to"| node_wallet_ui
node_routes -->|"routes to"| node_admin_ui
node_auth_ui -->|"requests through"| node_api_client
node_gig_ui -.->|"requests through"| node_api_client
node_contract_ui -.->|"requests through"| node_api_client
node_wallet_ui -.->|"requests through"| node_api_client
node_admin_ui -->|"requests through"| node_api_client
node_api_client -.->|"sends HTTP"| node_api
node_api -.->|"serves auth"| node_auth
node_api -.->|"serves profile"| node_profile
node_api -.->|"serves gigs"| node_gigs
node_api -->|"serves applications"| node_applications
node_api -.->|"serves contracts"| node_contracts
node_api -.->|"serves wallet"| node_payments
node_api -.->|"serves admin"| node_admin
node_auth -->|"stores sessions"| node_postgres
node_gigs -->|"supports applications"| node_applications
node_applications -->|"awards work"| node_contracts
node_applications -->|"funds award"| node_escrow
node_contracts -->|"settles escrow"| node_escrow
node_contracts -->|"handles delivery"| node_storage
node_storage -->|"stores media"| node_postgres
node_payments -.->|"verifies payments"| node_razorpay
node_razorpay -->|"sends webhook"| node_payments
node_contracts -->|"enables ratings"| node_ratings
node_sweeper -.->|"checks deadlines"| node_postgres
node_sweeper -->|"settles timeouts"| node_contracts
node_admin -->|"runs report"| node_reconciliation
node_admin -->|"records actions"| node_audit
node_admin -->|"rules disputes"| node_contracts

click node_routes "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/routes/AppRoutes.tsx"
click node_api_client "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/services/apiClient.ts"
click node_auth_ui "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/context/AuthProvider.tsx"
click node_gig_ui "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/GigsPage.tsx"
click node_contract_ui "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/ContractsPage.tsx"
click node_wallet_ui "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/WalletPage.tsx"
click node_admin_ui "https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/AdminOverviewPage.tsx"
click node_api "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/main.py"
click node_auth "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/auth_service.py"
click node_profile "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/profile_service.py"
click node_gigs "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/gig_service.py"
click node_applications "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/application_service.py"
click node_contracts "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/contract_service.py"
click node_escrow "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/escrow_service.py"
click node_payments "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/payment_service.py"
click node_ratings "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/rating_service.py"
click node_storage "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/storage_service.py"
click node_postgres "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/db/session.py"
click node_sweeper "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/jobs/sweeper.py"
click node_admin "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/admin_service.py"
click node_reconciliation "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/reconciliation_service.py"
click node_audit "https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/repositories/audit_repo.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_routes,node_api_client,node_auth_ui,node_gig_ui,node_contract_ui,node_wallet_ui,node_admin_ui toneBlue
class node_api,node_auth,node_profile,node_postgres toneAmber
class node_gigs,node_applications toneMint
class node_contracts,node_escrow,node_payments,node_ratings,node_storage toneRose
class node_sweeper,node_admin,node_reconciliation,node_audit,node_student,node_admin_actor,node_razorpay toneIndigo
```

## Components

### Student interface

- [App routes](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/routes/AppRoutes.tsx): `code/frontend/src/routes/AppRoutes.tsx`
- [API client](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/services/apiClient.ts): `code/frontend/src/services/apiClient.ts`
- [Auth interface](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/context/AuthProvider.tsx): `code/frontend/src/context/AuthProvider.tsx`
- [Gig and application pages](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/GigsPage.tsx): `code/frontend/src/pages/GigsPage.tsx`
- [Contract pages](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/ContractsPage.tsx): `code/frontend/src/pages/ContractsPage.tsx`
- [Wallet page](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/WalletPage.tsx): `code/frontend/src/pages/WalletPage.tsx`
- [Admin pages](https://github.com/shashwatnarwal9/campusgig/blob/main/code/frontend/src/pages/AdminOverviewPage.tsx): `code/frontend/src/pages/AdminOverviewPage.tsx`

### Identity and profiles

- [FastAPI application](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/main.py): `code/backend/app/main.py`
- [Authentication service](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/auth_service.py): `code/backend/app/services/auth_service.py`
- [Profile services](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/profile_service.py): `code/backend/app/services/profile_service.py`

### Gig marketplace

- [Gig services](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/gig_service.py): `code/backend/app/services/gig_service.py`
- [Application services](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/application_service.py): `code/backend/app/services/application_service.py`

### Contracts and money

- [Contract and delivery services](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/contract_service.py): `code/backend/app/services/contract_service.py`
- [Escrow and ledger](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/escrow_service.py): `code/backend/app/services/escrow_service.py`
- [Payment services](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/payment_service.py): `code/backend/app/services/payment_service.py`
- [Ratings and reputation](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/rating_service.py): `code/backend/app/services/rating_service.py`
- [Media and deliverables](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/storage_service.py): `code/backend/app/services/storage_service.py`

### Operations and oversight

- [Timeout sweeper](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/jobs/sweeper.py): `code/backend/app/jobs/sweeper.py`
- [Administration and disputes](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/admin_service.py): `code/backend/app/services/admin_service.py`
- [Ledger reconciliation](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/services/reconciliation_service.py): `code/backend/app/services/reconciliation_service.py`
- [Audit log](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/repositories/audit_repo.py): `code/backend/app/repositories/audit_repo.py`

### Other components

- **Student**
- **Administrator**
- **Razorpay**
- [PostgreSQL data](https://github.com/shashwatnarwal9/campusgig/blob/main/code/backend/app/db/session.py): `code/backend/app/db/session.py`

## Connections

- Student → App routes: uses (evidence: `README.md`)
- Administrator → App routes: uses (evidence: `README.md`)
- App routes → Auth interface: routes to (evidence: `code/frontend/src/routes/AppRoutes.tsx`)
- App routes → Gig and application pages: routes to (evidence: `code/frontend/src/routes/AppRoutes.tsx`)
- App routes → Contract pages: routes to (evidence: `code/frontend/src/routes/AppRoutes.tsx`)
- App routes → Wallet page: routes to (evidence: `code/frontend/src/routes/AppRoutes.tsx`)
- App routes → Admin pages: routes to (evidence: `code/frontend/src/routes/AppRoutes.tsx`)
- Auth interface → API client: requests through (evidence: `code/frontend/src/context/AuthProvider.tsx`)
- Gig and application pages → API client: requests through
- Contract pages → API client: requests through
- Wallet page → API client: requests through
- Admin pages → API client: requests through (evidence: `code/frontend/src/pages/AdminOverviewPage.tsx`)
- API client → FastAPI application: sends HTTP
- FastAPI application → Authentication service: serves auth
- FastAPI application → Profile services: serves profile
- FastAPI application → Gig services: serves gigs
- FastAPI application → Application services: serves applications
- FastAPI application → Contract and delivery services: serves contracts
- FastAPI application → Payment services: serves wallet
- FastAPI application → Administration and disputes: serves admin
- Authentication service → PostgreSQL data: stores sessions (evidence: `code/backend/app/services/auth_service.py`)
- Gig services → Application services: supports applications (evidence: `code/backend/app/services/application_service.py`)
- Application services → Contract and delivery services: awards work (evidence: `code/backend/app/services/application_service.py`)
- Application services → Escrow and ledger: funds award (evidence: `code/backend/app/services/application_service.py`)
- Contract and delivery services → Escrow and ledger: settles escrow (evidence: `README.md`)
- Contract and delivery services → Media and deliverables: handles delivery (evidence: `README.md`)
- Media and deliverables → PostgreSQL data: stores media (evidence: `code/backend/app/services/storage_service.py`)
- Payment services → Razorpay: verifies payments
- Razorpay → Payment services: sends webhook (evidence: `README.md`)
- Contract and delivery services → Ratings and reputation: enables ratings (evidence: `README.md`)
- Timeout sweeper → PostgreSQL data: checks deadlines (evidence: `code/backend/app/jobs/sweeper.py`)
- Timeout sweeper → Contract and delivery services: settles timeouts (evidence: `README.md`)
- Administration and disputes → Ledger reconciliation: runs report (evidence: `README.md`)
- Administration and disputes → Audit log: records actions (evidence: `README.md`)
- Administration and disputes → Contract and delivery services: rules disputes (evidence: `README.md`)
