# 21-sharanya/campusfind architecture

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

- Interactive diagram: https://gitdiagram.com/21-sharanya/campusfind
- Repository: https://github.com/21-sharanya/campusfind

## Overview

CampusFind is a campus lost-and-found portal. Students post lost or found items, browse and filter listings, inspect a listing, and can submit a verification-answer claim; finders can review claims, while posters use a PIN to edit, delete, or mark items returned. The client calls an Express API whose controller enforces these operations, persists item records, and computes match suggestions. The README documents the full feature set; some client and server implementation details were not sampled, so those relationships are shown only where the excerpts or documentation support them.

Main entry points: [`client/src/api.js`](https://github.com/21-sharanya/campusfind/blob/main/client/src/api.js) (HTTP client), [`client/src/App.jsx`](https://github.com/21-sharanya/campusfind/blob/main/client/src/App.jsx) (Page router), [`client/src/pages/ItemDetail.jsx`](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/ItemDetail.jsx) (Item detail), [`client/src/pages/Report.jsx`](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Report.jsx) (Report item)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student portal"]
  node_app["Page router<br/>[App.jsx]"]
  node_home["Recent items<br/>[Home.jsx]"]
  node_browse["Search &amp; filters<br/>[Browse.jsx]"]
  node_report["Report item<br/>[Report.jsx]"]
  node_reportform["Item form<br/>[ReportForm.jsx]"]
  node_detail["Item detail<br/>[ItemDetail.jsx]"]
  node_claimform["Claim submission<br/>[ClaimForm.jsx]"]
  node_claimslist["Claim review<br/>[ClaimsList.jsx]"]
  node_matchpanel["Match suggestions<br/>[MatchPanel.jsx]"]
  node_edit["Edit item<br/>[EditItem.jsx]"]
  node_api["HTTP client<br/>[api.js]"]
end

subgraph group_server["Item API"]
  node_routes["Item routes<br/>[itemRoutes.js]"]
  node_controller["Item operations<br/>[Itemcontroller.js]"]
  node_errors["Error responses<br/>[errorHandler.js]"]
end

subgraph group_matching["Matching"]
  node_matcher["Match scoring<br/>[matchScore.js]"]
end

subgraph group_storage["Persistence"]
  node_itemmodel["Item schema<br/>[Item.js]"]
  node_dbconfig["Database connection<br/>[db.js]"]
end

node_student(("Student"))
node_mongodb[("MongoDB")]

node_student -->|"uses portal"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_detail
node_app -->|"routes to"| node_edit
node_app -->|"routes to"| node_report
node_home -->|"fetches listings"| node_api
node_browse -->|"searches listings"| node_api
node_report -->|"creates item"| node_api
node_report -->|"renders"| node_reportform
node_detail -->|"loads and updates"| node_api
node_detail -->|"renders"| node_claimform
node_detail -->|"renders claims"| node_claimslist
node_detail -->|"renders matches"| node_matchpanel
node_edit -->|"updates item"| node_api
node_edit -->|"renders"| node_reportform
node_claimform -->|"submits claim"| node_api
node_matchpanel -->|"requests matches"| node_api
node_api -->|"sends HTTP requests"| node_routes
node_routes -->|"dispatches requests"| node_controller
node_controller -->|"reads and writes"| node_itemmodel
node_controller -->|"scores candidates"| node_matcher
node_dbconfig -->|"connects to"| node_mongodb
node_itemmodel -->|"persists records"| node_mongodb

click node_app "https://github.com/21-sharanya/campusfind/blob/main/client/src/App.jsx"
click node_home "https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Home.jsx"
click node_browse "https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Browse.jsx"
click node_report "https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Report.jsx"
click node_reportform "https://github.com/21-sharanya/campusfind/blob/main/client/src/components/ReportForm.jsx"
click node_detail "https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/ItemDetail.jsx"
click node_claimform "https://github.com/21-sharanya/campusfind/blob/main/client/src/components/ClaimForm.jsx"
click node_claimslist "https://github.com/21-sharanya/campusfind/blob/main/client/src/components/ClaimsList.jsx"
click node_matchpanel "https://github.com/21-sharanya/campusfind/blob/main/client/src/components/MatchPanel.jsx"
click node_edit "https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/EditItem.jsx"
click node_api "https://github.com/21-sharanya/campusfind/blob/main/client/src/api.js"
click node_routes "https://github.com/21-sharanya/campusfind/blob/main/server/routes/itemRoutes.js"
click node_controller "https://github.com/21-sharanya/campusfind/blob/main/server/controllers/Itemcontroller.js"
click node_errors "https://github.com/21-sharanya/campusfind/blob/main/server/middleware/errorHandler.js"
click node_matcher "https://github.com/21-sharanya/campusfind/blob/main/server/utils/matchScore.js"
click node_itemmodel "https://github.com/21-sharanya/campusfind/blob/main/server/models/Item.js"
click node_dbconfig "https://github.com/21-sharanya/campusfind/blob/main/server/config/db.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_home,node_browse,node_report,node_reportform,node_detail,node_claimform,node_claimslist,node_matchpanel,node_edit,node_api toneBlue
class node_routes,node_controller,node_errors,node_mongodb toneAmber
class node_matcher toneMint
class node_itemmodel,node_dbconfig toneRose
class node_student toneIndigo
```

## Components

### Student portal

- [Page router](https://github.com/21-sharanya/campusfind/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Recent items](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Home.jsx): `client/src/pages/Home.jsx`
- [Search & filters](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Browse.jsx): `client/src/pages/Browse.jsx`
- [Report item](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/Report.jsx): `client/src/pages/Report.jsx`
- [Item form](https://github.com/21-sharanya/campusfind/blob/main/client/src/components/ReportForm.jsx): `client/src/components/ReportForm.jsx`
- [Item detail](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/ItemDetail.jsx): `client/src/pages/ItemDetail.jsx`
- [Claim submission](https://github.com/21-sharanya/campusfind/blob/main/client/src/components/ClaimForm.jsx): `client/src/components/ClaimForm.jsx`
- [Claim review](https://github.com/21-sharanya/campusfind/blob/main/client/src/components/ClaimsList.jsx): `client/src/components/ClaimsList.jsx`
- [Match suggestions](https://github.com/21-sharanya/campusfind/blob/main/client/src/components/MatchPanel.jsx): `client/src/components/MatchPanel.jsx`
- [Edit item](https://github.com/21-sharanya/campusfind/blob/main/client/src/pages/EditItem.jsx): `client/src/pages/EditItem.jsx`
- [HTTP client](https://github.com/21-sharanya/campusfind/blob/main/client/src/api.js): `client/src/api.js`

### Item API

- [Item routes](https://github.com/21-sharanya/campusfind/blob/main/server/routes/itemRoutes.js): `server/routes/itemRoutes.js`
- [Item operations](https://github.com/21-sharanya/campusfind/blob/main/server/controllers/Itemcontroller.js): `server/controllers/Itemcontroller.js`
- [Error responses](https://github.com/21-sharanya/campusfind/blob/main/server/middleware/errorHandler.js): `server/middleware/errorHandler.js`

### Matching

- [Match scoring](https://github.com/21-sharanya/campusfind/blob/main/server/utils/matchScore.js): `server/utils/matchScore.js`

### Persistence

- [Item schema](https://github.com/21-sharanya/campusfind/blob/main/server/models/Item.js): `server/models/Item.js`
- [Database connection](https://github.com/21-sharanya/campusfind/blob/main/server/config/db.js): `server/config/db.js`

### Other components

- **Student**
- **MongoDB**

## Connections

- Student → Page router: uses portal (evidence: `README.md`)
- Page router → Recent items: routes to (evidence: `client/src/App.jsx`)
- Page router → Search & filters: routes to (evidence: `client/src/App.jsx`)
- Page router → Item detail: routes to (evidence: `client/src/App.jsx`)
- Page router → Edit item: routes to (evidence: `client/src/App.jsx`)
- Page router → Report item: routes to (evidence: `client/src/App.jsx`)
- Recent items → HTTP client: fetches listings (evidence: `client/src/pages/Home.jsx`)
- Search & filters → HTTP client: searches listings (evidence: `client/src/pages/Browse.jsx`)
- Report item → HTTP client: creates item (evidence: `client/src/pages/Report.jsx`)
- Report item → Item form: renders (evidence: `client/src/pages/Report.jsx`)
- Item detail → HTTP client: loads and updates (evidence: `client/src/pages/ItemDetail.jsx`)
- Item detail → Claim submission: renders (evidence: `client/src/pages/ItemDetail.jsx`)
- Item detail → Claim review: renders claims (evidence: `client/src/pages/ItemDetail.jsx`)
- Item detail → Match suggestions: renders matches (evidence: `client/src/pages/ItemDetail.jsx`)
- Edit item → HTTP client: updates item (evidence: `client/src/pages/EditItem.jsx`)
- Edit item → Item form: renders (evidence: `client/src/pages/EditItem.jsx`)
- Claim submission → HTTP client: submits claim (evidence: `client/src/components/ClaimForm.jsx`)
- Match suggestions → HTTP client: requests matches (evidence: `client/src/components/MatchPanel.jsx`)
- HTTP client → Item routes: sends HTTP requests (evidence: `README.md`)
- Item routes → Item operations: dispatches requests (evidence: `server/routes/itemRoutes.js`)
- Item operations → Item schema: reads and writes (evidence: `server/controllers/Itemcontroller.js`)
- Item operations → Match scoring: scores candidates (evidence: `server/controllers/Itemcontroller.js`)
- Database connection → MongoDB: connects to (evidence: `server/config/db.js`)
- Item schema → MongoDB: persists records (evidence: `README.md`)
