# vinaysingh5706/campusshare architecture

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

- Interactive diagram: https://gitdiagram.com/vinaysingh5706/campusshare
- Repository: https://github.com/vinaysingh5706/campusshare

## Overview

CampusShare is a campus-only peer-to-peer rental marketplace. Students discover or post resources, request a rental, receive an authoritative quote, and progress through approval, return, deposit, and completion; ratings and trust scoring support safe reuse. The browser calls the FastAPI app, whose route handlers coordinate validation, authentication, services, and persisted records. The README documents the broader capabilities; only selected source excerpts were available, so unsampled feature links are shown only where the README or source index supports them.

Main entry points: [`app/main.py`](https://github.com/vinaysingh5706/campusshare/blob/main/app/main.py) (FastAPI application), [`app/models`](https://github.com/vinaysingh5706/campusshare/tree/main/app/models) (Marketplace and user records), [`app/routes/rentals.py`](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/rentals.py) (Rental lifecycle and quotes), [`app/schemas`](https://github.com/vinaysingh5706/campusshare/tree/main/app/schemas) (Request validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_browser["Browser client"]
  node_fetch["Fetch API wrapper<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_application["FastAPI application<br/>[main.py]"]
  node_auth["JWT and role auth<br/>[auth.py]"]
  node_auth_routes["Registration and login<br/>[auth.py]"]
  node_schemas["Request validation"]
end

subgraph group_market["Marketplace workflows"]
  node_listing_routes["Resource discovery and listings<br/>[listings.py]"]
  node_rental_routes["Rental lifecycle and quotes<br/>[rentals.py]"]
  node_rental_logic["Quote and overdue logic<br/>[rental_service.py]"]
  node_wishlist_routes["Saved resources<br/>[wishlist.py]"]
end

subgraph group_community["Community and moderation"]
  node_user_routes["Profiles and reputation<br/>[users.py]"]
  node_trust_logic["Trust score engine<br/>[trust_service.py]"]
  node_rating_routes["Peer reviews<br/>[ratings.py]"]
  node_message_routes["Peer messaging<br/>[messages.py]"]
  node_notification_routes["Notifications<br/>[notifications.py]"]
  node_notification_logic["Notification dispatcher"]
  node_report_routes["Reports and disputes<br/>[reports.py]"]
  node_admin_routes["Admin moderation<br/>[admin.py]"]
end

subgraph group_persistence["Persistence"]
  node_listing_model["Listing records<br/>[listing.py]"]
  node_rental_model["Rental records<br/>[rental.py]"]
  node_database[("Database sessions<br/>[database.py]")]
  node_records[("Marketplace and user records")]
end

node_students(("Students"))
node_storage[("PostgreSQL or SQLite")]

node_students -->|"use"| node_browser
node_browser -->|"makes requests"| node_fetch
node_fetch -->|"sends HTTP"| node_application
node_application -->|"mounts routes"| node_auth_routes
node_application -->|"uses sessions"| node_database
node_application -->|"mounts routes"| node_listing_routes
node_application -->|"mounts routes"| node_rental_routes
node_application -->|"mounts routes"| node_user_routes
node_application -->|"mounts routes"| node_rating_routes
node_application -->|"mounts routes"| node_message_routes
node_application -->|"mounts routes"| node_notification_routes
node_application -->|"mounts routes"| node_wishlist_routes
node_application -->|"mounts routes"| node_report_routes
node_application -->|"mounts routes"| node_admin_routes
node_auth_routes -->|"uses auth"| node_auth
node_auth_routes -->|"validates with"| node_schemas
node_listing_routes -->|"checks identity"| node_auth
node_listing_routes -->|"validates with"| node_schemas
node_listing_routes -->|"queries and updates"| node_listing_model
node_rental_routes -->|"checks identity"| node_auth
node_rental_routes -->|"validates with"| node_schemas
node_rental_routes -->|"calculates and syncs"| node_rental_logic
node_rental_routes -->|"creates and updates"| node_rental_model
node_rental_routes -->|"reads listing"| node_listing_model
node_rental_logic -->|"updates overdue"| node_rental_model
node_rental_logic -->|"reads pricing"| node_listing_model
node_user_routes -->|"uses scoring"| node_trust_logic
node_rating_routes -->|"updates reputation"| node_trust_logic
node_rating_routes -->|"dispatches notice"| node_notification_logic
node_message_routes -->|"dispatches notice"| node_notification_logic
node_notification_routes -->|"validates with"| node_schemas
node_wishlist_routes -->|"validates with"| node_schemas
node_report_routes -->|"validates with"| node_schemas
node_admin_routes -->|"guards admin"| node_auth
node_admin_routes -->|"uses rental logic"| node_rental_logic
node_notification_logic -->|"creates notifications"| node_records
node_trust_logic -->|"reads and updates scores"| node_records
node_database -->|"connects"| node_storage
node_records -->|"uses ORM base"| node_database
node_listing_routes -.->|"queries records"| node_records
node_rental_routes -.->|"queries records"| node_records
node_rating_routes -.->|"queries records"| node_records
node_message_routes -.->|"queries records"| node_records
node_notification_routes -.->|"queries records"| node_records
node_wishlist_routes -.->|"queries records"| node_records
node_report_routes -.->|"queries records"| node_records
node_admin_routes -.->|"moderates records"| node_records

click node_fetch "https://github.com/vinaysingh5706/campusshare/blob/main/frontend/js/api.js"
click node_application "https://github.com/vinaysingh5706/campusshare/blob/main/app/main.py"
click node_auth "https://github.com/vinaysingh5706/campusshare/blob/main/app/auth.py"
click node_auth_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/auth.py"
click node_schemas "https://github.com/vinaysingh5706/campusshare/tree/main/app/schemas"
click node_listing_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/listings.py"
click node_listing_model "https://github.com/vinaysingh5706/campusshare/blob/main/app/models/listing.py"
click node_rental_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/rentals.py"
click node_rental_logic "https://github.com/vinaysingh5706/campusshare/blob/main/app/services/rental_service.py"
click node_rental_model "https://github.com/vinaysingh5706/campusshare/blob/main/app/models/rental.py"
click node_user_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/users.py"
click node_trust_logic "https://github.com/vinaysingh5706/campusshare/blob/main/app/services/trust_service.py"
click node_rating_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/ratings.py"
click node_message_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/messages.py"
click node_notification_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/notifications.py"
click node_notification_logic "https://github.com/vinaysingh5706/campusshare/blob/main/app/services/notification_service.py"
click node_wishlist_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/wishlist.py"
click node_report_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/reports.py"
click node_admin_routes "https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/admin.py"
click node_database "https://github.com/vinaysingh5706/campusshare/blob/main/app/database.py"
click node_records "https://github.com/vinaysingh5706/campusshare/tree/main/app/models"

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_browser,node_fetch toneBlue
class node_application,node_auth,node_auth_routes,node_schemas,node_storage toneAmber
class node_listing_routes,node_rental_routes,node_rental_logic,node_wishlist_routes toneMint
class node_user_routes,node_trust_logic,node_rating_routes,node_message_routes,node_notification_routes,node_notification_logic,node_report_routes,node_admin_routes toneRose
class node_listing_model,node_rental_model,node_database,node_records,node_students toneIndigo
```

## Components

### Browser client

- **Browser client**
- [Fetch API wrapper](https://github.com/vinaysingh5706/campusshare/blob/main/frontend/js/api.js): `frontend/js/api.js`

### API and identity

- [FastAPI application](https://github.com/vinaysingh5706/campusshare/blob/main/app/main.py): `app/main.py`
- [JWT and role auth](https://github.com/vinaysingh5706/campusshare/blob/main/app/auth.py): `app/auth.py`
- [Registration and login](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/auth.py): `app/routes/auth.py`
- [Request validation](https://github.com/vinaysingh5706/campusshare/tree/main/app/schemas): `app/schemas`

### Marketplace workflows

- [Resource discovery and listings](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/listings.py): `app/routes/listings.py`
- [Rental lifecycle and quotes](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/rentals.py): `app/routes/rentals.py`
- [Quote and overdue logic](https://github.com/vinaysingh5706/campusshare/blob/main/app/services/rental_service.py): `app/services/rental_service.py`
- [Saved resources](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/wishlist.py): `app/routes/wishlist.py`

### Community and moderation

- [Profiles and reputation](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/users.py): `app/routes/users.py`
- [Trust score engine](https://github.com/vinaysingh5706/campusshare/blob/main/app/services/trust_service.py): `app/services/trust_service.py`
- [Peer reviews](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/ratings.py): `app/routes/ratings.py`
- [Peer messaging](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/messages.py): `app/routes/messages.py`
- [Notifications](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/notifications.py): `app/routes/notifications.py`
- [Notification dispatcher](https://github.com/vinaysingh5706/campusshare/blob/main/app/services/notification_service.py): `app/services/notification_service.py`
- [Reports and disputes](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/reports.py): `app/routes/reports.py`
- [Admin moderation](https://github.com/vinaysingh5706/campusshare/blob/main/app/routes/admin.py): `app/routes/admin.py`

### Persistence

- [Listing records](https://github.com/vinaysingh5706/campusshare/blob/main/app/models/listing.py): `app/models/listing.py`
- [Rental records](https://github.com/vinaysingh5706/campusshare/blob/main/app/models/rental.py): `app/models/rental.py`
- [Database sessions](https://github.com/vinaysingh5706/campusshare/blob/main/app/database.py): `app/database.py`
- [Marketplace and user records](https://github.com/vinaysingh5706/campusshare/tree/main/app/models): `app/models`

### Other components

- **Students**
- **PostgreSQL or SQLite**

## Connections

- Students → Browser client: use
- Browser client → Fetch API wrapper: makes requests
- Fetch API wrapper → FastAPI application: sends HTTP
- FastAPI application → Registration and login: mounts routes (evidence: `app/main.py`)
- FastAPI application → Database sessions: uses sessions (evidence: `app/main.py`)
- FastAPI application → Resource discovery and listings: mounts routes
- FastAPI application → Rental lifecycle and quotes: mounts routes
- FastAPI application → Profiles and reputation: mounts routes
- FastAPI application → Peer reviews: mounts routes
- FastAPI application → Peer messaging: mounts routes
- FastAPI application → Notifications: mounts routes
- FastAPI application → Saved resources: mounts routes
- FastAPI application → Reports and disputes: mounts routes
- FastAPI application → Admin moderation: mounts routes
- Registration and login → JWT and role auth: uses auth (evidence: `app/routes/auth.py`)
- Registration and login → Request validation: validates with (evidence: `app/routes/auth.py`)
- Resource discovery and listings → JWT and role auth: checks identity (evidence: `app/routes/listings.py`)
- Resource discovery and listings → Request validation: validates with (evidence: `app/routes/listings.py`)
- Resource discovery and listings → Listing records: queries and updates (evidence: `app/routes/listings.py`)
- Rental lifecycle and quotes → JWT and role auth: checks identity (evidence: `app/routes/rentals.py`)
- Rental lifecycle and quotes → Request validation: validates with (evidence: `app/routes/rentals.py`)
- Rental lifecycle and quotes → Quote and overdue logic: calculates and syncs (evidence: `app/routes/rentals.py`)
- Rental lifecycle and quotes → Rental records: creates and updates (evidence: `app/routes/rentals.py`)
- Rental lifecycle and quotes → Listing records: reads listing (evidence: `app/routes/rentals.py`)
- Quote and overdue logic → Rental records: updates overdue (evidence: `app/services/rental_service.py`)
- Quote and overdue logic → Listing records: reads pricing (evidence: `app/services/rental_service.py`)
- Profiles and reputation → Trust score engine: uses scoring (evidence: `app/routes/users.py`)
- Peer reviews → Trust score engine: updates reputation (evidence: `app/routes/ratings.py`)
- Peer reviews → Notification dispatcher: dispatches notice (evidence: `app/routes/ratings.py`)
- Peer messaging → Notification dispatcher: dispatches notice (evidence: `app/routes/messages.py`)
- Notifications → Request validation: validates with (evidence: `app/routes/notifications.py`)
- Saved resources → Request validation: validates with (evidence: `app/routes/wishlist.py`)
- Reports and disputes → Request validation: validates with (evidence: `app/routes/reports.py`)
- Admin moderation → JWT and role auth: guards admin (evidence: `app/routes/admin.py`)
- Admin moderation → Quote and overdue logic: uses rental logic (evidence: `app/routes/admin.py`)
- Notification dispatcher → Marketplace and user records: creates notifications (evidence: `app/services/notification_service.py`)
- Trust score engine → Marketplace and user records: reads and updates scores (evidence: `app/services/trust_service.py`)
- Database sessions → PostgreSQL or SQLite: connects
- Marketplace and user records → Database sessions: uses ORM base (evidence: `app/models/listing.py`)
- Resource discovery and listings → Marketplace and user records: queries records (evidence: `app/routes/listings.py`)
- Rental lifecycle and quotes → Marketplace and user records: queries records (evidence: `app/routes/rentals.py`)
- Peer reviews → Marketplace and user records: queries records (evidence: `app/routes/ratings.py`)
- Peer messaging → Marketplace and user records: queries records (evidence: `app/routes/messages.py`)
- Notifications → Marketplace and user records: queries records (evidence: `app/routes/notifications.py`)
- Saved resources → Marketplace and user records: queries records (evidence: `app/routes/wishlist.py`)
- Reports and disputes → Marketplace and user records: queries records (evidence: `app/routes/reports.py`)
- Admin moderation → Marketplace and user records: moderates records (evidence: `app/routes/admin.py`)
