# jeetjm/campusmart architecture

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

- Interactive diagram: https://gitdiagram.com/jeetjm/campusmart
- Repository: https://github.com/jeetjm/campusmart

## Overview

CampusMart is a campus marketplace for student accounts, buying and selling listings, rentals, exchanges, and related community features, with administrative tools. Students browse the marketplace, inspect a listing, and can proceed through cart, checkout, and order management; sellers manage listings and orders. The frontend routes users to feature pages and calls a Node/Express API backed by MongoDB models. The source excerpts substantiate the main routing and several controller/model relationships; unsampled capabilities are retained as subsystem nodes, but their internal links are omitted where evidence is unavailable.

Main entry points: [`frontend/src/App.jsx`](https://github.com/jeetjm/campusmart/blob/main/frontend/src/App.jsx) (Page router), [`backend/server.js`](https://github.com/jeetjm/campusmart/blob/main/backend/server.js) (Express API), [`backend/controllers/reviewController.js`](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/reviewController.js) (Review service), [`frontend/src/services/api.js`](https://github.com/jeetjm/campusmart/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Page router<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_marketplace_ui["Marketplace browsing<br/>[Marketplace.jsx]"]
  node_product_ui["Product details<br/>[ProductDetails.jsx]"]
  node_reviews_ui["Product reviews<br/>[ProductReviews.jsx]"]
  node_listing_ui["Listing management<br/>[SellProduct.jsx]"]
  node_cart_checkout["Cart and checkout<br/>[Checkout.jsx]"]
  node_orders_ui["Order management<br/>[MyOrders.jsx]"]
  node_auth_ui["Account pages<br/>[Login.jsx]"]
  node_exchange_ui["Exchange offers<br/>[ExchangeOffers.jsx]"]
  node_rental_ui["Rental workflows<br/>[MyRentals.jsx]"]
  node_chat_ui["Messaging<br/>[Chat.jsx]"]
  node_notifications_ui["Notifications<br/>[Notifications.jsx]"]
end

subgraph group_commerce["Marketplace commerce"]
  node_product["Product listings"]
  node_product_data[("Product records<br/>[Product.js]")]
  node_orders["Order processing<br/>[orderController.js]"]
  node_order_data[("Order records<br/>[Order.js]")]
  node_cart_data[("Cart records<br/>[Cart.js]")]
  node_exchange["Exchange offers"]
  node_exchange_data[("Exchange records<br/>[ExchangeOffer.js]")]
  node_rentals["Rental requests"]
  node_rental_data[("Rental records<br/>[Rental.js]")]
  node_ai["AI assistance"]
end

subgraph group_community["Community features"]
  node_reviews["Review service"]
  node_review_data[("Review records<br/>[Review.js]")]
end

subgraph group_platform["API and persistence"]
  node_backend["Express API<br/>[server.js]"]
  node_auth["Authentication<br/>[authController.js]"]
  node_users[("User records<br/>[User.js]")]
end

subgraph group_admin["Administration"]
  node_admin_ui["Admin console<br/>[AdminDashboard.jsx]"]
  node_admin_api["Admin operations<br/>[adminController.js]"]
end

node_student(("Student"))
node_admin_actor(("Administrator"))

node_student -->|"opens"| node_app
node_admin_actor -->|"opens"| node_app
node_app -->|"routes to"| node_marketplace_ui
node_app -->|"routes to"| node_product_ui
node_app -->|"routes to"| node_listing_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_exchange_ui
node_app -->|"routes to"| node_rental_ui
node_app -->|"routes to"| node_chat_ui
node_app -->|"routes to"| node_notifications_ui
node_app -->|"routes to"| node_admin_ui
node_product_ui -->|"renders"| node_reviews_ui
node_marketplace_ui -->|"uses API"| node_api_client
node_product_ui -->|"uses API"| node_api_client
node_reviews_ui -->|"uses API"| node_api_client
node_api_client -.->|"requests"| node_backend
node_backend -->|"routes requests"| node_auth
node_backend -->|"routes requests"| node_product
node_backend -->|"routes requests"| node_orders
node_backend -->|"routes requests"| node_exchange
node_backend -->|"routes requests"| node_rentals
node_backend -->|"routes requests"| node_reviews
node_backend -->|"routes requests"| node_admin_api
node_product -->|"queries"| node_product_data
node_orders -->|"reads"| node_cart_data
node_orders -->|"creates and reads"| node_order_data
node_orders -->|"reads"| node_product_data
node_reviews -->|"queries"| node_review_data
node_reviews -->|"updates rating"| node_product_data
node_reviews -->|"checks purchase"| node_order_data
node_reviews -->|"checks rental"| node_rental_data
node_exchange -->|"queries"| node_exchange_data
node_exchange -->|"queries"| node_product_data
node_rentals -->|"queries"| node_rental_data
node_rentals -->|"queries"| node_product_data
node_auth -->|"queries"| node_users
node_admin_api -->|"manages"| node_users
node_admin_ui -.->|"uses API"| node_api_client

click node_app "https://github.com/jeetjm/campusmart/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/jeetjm/campusmart/blob/main/frontend/src/services/api.js"
click node_marketplace_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Marketplace.jsx"
click node_product_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/ProductDetails.jsx"
click node_reviews_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/components/ProductReviews.jsx"
click node_listing_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/SellProduct.jsx"
click node_cart_checkout "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Checkout.jsx"
click node_orders_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/MyOrders.jsx"
click node_auth_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Login.jsx"
click node_exchange_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/ExchangeOffers.jsx"
click node_rental_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/MyRentals.jsx"
click node_chat_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Chat.jsx"
click node_notifications_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Notifications.jsx"
click node_backend "https://github.com/jeetjm/campusmart/blob/main/backend/server.js"
click node_auth "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/authController.js"
click node_product "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/productController.js"
click node_product_data "https://github.com/jeetjm/campusmart/blob/main/backend/models/Product.js"
click node_orders "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/orderController.js"
click node_order_data "https://github.com/jeetjm/campusmart/blob/main/backend/models/Order.js"
click node_cart_data "https://github.com/jeetjm/campusmart/blob/main/backend/models/Cart.js"
click node_reviews "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/reviewController.js"
click node_review_data "https://github.com/jeetjm/campusmart/blob/main/backend/models/Review.js"
click node_exchange "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/exchangeController.js"
click node_exchange_data "https://github.com/jeetjm/campusmart/blob/main/backend/models/ExchangeOffer.js"
click node_rentals "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/rentalController.js"
click node_rental_data "https://github.com/jeetjm/campusmart/blob/main/backend/models/Rental.js"
click node_ai "https://github.com/jeetjm/campusmart/tree/main/backend/services"
click node_admin_ui "https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_admin_api "https://github.com/jeetjm/campusmart/blob/main/backend/controllers/adminController.js"
click node_users "https://github.com/jeetjm/campusmart/blob/main/backend/models/User.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_api_client,node_marketplace_ui,node_product_ui,node_reviews_ui,node_listing_ui,node_cart_checkout,node_orders_ui,node_auth_ui,node_exchange_ui,node_rental_ui,node_chat_ui,node_notifications_ui toneBlue
class node_product,node_product_data,node_orders,node_order_data,node_cart_data,node_exchange,node_exchange_data,node_rentals,node_rental_data,node_ai toneAmber
class node_reviews,node_review_data toneMint
class node_backend,node_auth,node_users toneRose
class node_admin_ui,node_admin_api,node_student,node_admin_actor toneIndigo
```

## Components

### Web application

- [Page router](https://github.com/jeetjm/campusmart/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/jeetjm/campusmart/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Marketplace browsing](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Marketplace.jsx): `frontend/src/pages/Marketplace.jsx`
- [Product details](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/ProductDetails.jsx): `frontend/src/pages/ProductDetails.jsx`
- [Product reviews](https://github.com/jeetjm/campusmart/blob/main/frontend/src/components/ProductReviews.jsx): `frontend/src/components/ProductReviews.jsx`
- [Listing management](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/SellProduct.jsx): `frontend/src/pages/SellProduct.jsx`
- [Cart and checkout](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Order management](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/MyOrders.jsx): `frontend/src/pages/MyOrders.jsx`
- [Account pages](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Exchange offers](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/ExchangeOffers.jsx): `frontend/src/pages/ExchangeOffers.jsx`
- [Rental workflows](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/MyRentals.jsx): `frontend/src/pages/MyRentals.jsx`
- [Messaging](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Notifications](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/Notifications.jsx): `frontend/src/pages/Notifications.jsx`

### Marketplace commerce

- [Product listings](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Product records](https://github.com/jeetjm/campusmart/blob/main/backend/models/Product.js): `backend/models/Product.js`
- [Order processing](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Order records](https://github.com/jeetjm/campusmart/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [Cart records](https://github.com/jeetjm/campusmart/blob/main/backend/models/Cart.js): `backend/models/Cart.js`
- [Exchange offers](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/exchangeController.js): `backend/controllers/exchangeController.js`
- [Exchange records](https://github.com/jeetjm/campusmart/blob/main/backend/models/ExchangeOffer.js): `backend/models/ExchangeOffer.js`
- [Rental requests](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/rentalController.js): `backend/controllers/rentalController.js`
- [Rental records](https://github.com/jeetjm/campusmart/blob/main/backend/models/Rental.js): `backend/models/Rental.js`
- [AI assistance](https://github.com/jeetjm/campusmart/tree/main/backend/services): `backend/services`

### Community features

- [Review service](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Review records](https://github.com/jeetjm/campusmart/blob/main/backend/models/Review.js): `backend/models/Review.js`

### API and persistence

- [Express API](https://github.com/jeetjm/campusmart/blob/main/backend/server.js): `backend/server.js`
- [Authentication](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [User records](https://github.com/jeetjm/campusmart/blob/main/backend/models/User.js): `backend/models/User.js`

### Administration

- [Admin console](https://github.com/jeetjm/campusmart/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [Admin operations](https://github.com/jeetjm/campusmart/blob/main/backend/controllers/adminController.js): `backend/controllers/adminController.js`

### Other components

- **Student**
- **Administrator**

## Connections

- Student → Page router: opens (evidence: `frontend/src/App.jsx`)
- Administrator → Page router: opens (evidence: `frontend/src/App.jsx`)
- Page router → Marketplace browsing: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Product details: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Listing management: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Order management: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Account pages: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Exchange offers: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Rental workflows: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Messaging: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Notifications: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Admin console: routes to (evidence: `frontend/src/App.jsx`)
- Product details → Product reviews: renders (evidence: `frontend/src/pages/ProductDetails.jsx`)
- Marketplace browsing → API client: uses API (evidence: `frontend/src/pages/Marketplace.jsx`)
- Product details → API client: uses API (evidence: `frontend/src/pages/ProductDetails.jsx`)
- Product reviews → API client: uses API (evidence: `frontend/src/components/ProductReviews.jsx`)
- API client → Express API: requests
- Express API → Authentication: routes requests (evidence: `backend/server.js`)
- Express API → Product listings: routes requests (evidence: `backend/server.js`)
- Express API → Order processing: routes requests (evidence: `backend/server.js`)
- Express API → Exchange offers: routes requests (evidence: `backend/server.js`)
- Express API → Rental requests: routes requests (evidence: `backend/server.js`)
- Express API → Review service: routes requests (evidence: `backend/server.js`)
- Express API → Admin operations: routes requests (evidence: `backend/server.js`)
- Product listings → Product records: queries (evidence: `backend/controllers/productController.js`)
- Order processing → Cart records: reads (evidence: `backend/controllers/orderController.js`)
- Order processing → Order records: creates and reads (evidence: `backend/controllers/orderController.js`)
- Order processing → Product records: reads (evidence: `backend/controllers/orderController.js`)
- Review service → Review records: queries (evidence: `backend/controllers/reviewController.js`)
- Review service → Product records: updates rating (evidence: `backend/controllers/reviewController.js`)
- Review service → Order records: checks purchase (evidence: `backend/controllers/reviewController.js`)
- Review service → Rental records: checks rental (evidence: `backend/controllers/reviewController.js`)
- Exchange offers → Exchange records: queries (evidence: `backend/controllers/exchangeController.js`)
- Exchange offers → Product records: queries (evidence: `backend/controllers/exchangeController.js`)
- Rental requests → Rental records: queries (evidence: `backend/controllers/rentalController.js`)
- Rental requests → Product records: queries (evidence: `backend/controllers/rentalController.js`)
- Authentication → User records: queries (evidence: `backend/controllers/authController.js`)
- Admin operations → User records: manages (evidence: `backend/controllers/adminController.js`)
- Admin console → API client: uses API
