# kumarvijay09/unideal architecture

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

- Interactive diagram: https://gitdiagram.com/kumarvijay09/unideal
- Repository: https://github.com/kumarvijay09/unideal

## Overview

CampusCart is a student-to-student campus marketplace. Students browse and filter listings, authenticate, post items, save listings, message sellers, and negotiate offers; accepted deals can move listings through reserved/processing to sold states. The React app uses a shared API client to reach an Express REST backend, whose domain routes use a persistent JSON database. The README documents image uploads, campus metadata, and health checks as additional capabilities. Edges reflect shown imports, calls, route mounts, or README statements; unsampled route internals are not inferred.

Main entry points: [`server/index.js`](https://github.com/kumarvijay09/unideal/blob/main/server/index.js) (Express entry), [`src/App.tsx`](https://github.com/kumarvijay09/unideal/blob/main/src/App.tsx) (Marketplace app), [`server/database/db.js`](https://github.com/kumarvijay09/unideal/blob/main/server/database/db.js) (JSON database), [`src/services/api.ts`](https://github.com/kumarvijay09/unideal/blob/main/src/services/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Marketplace interface"]
  node_app["Marketplace app<br/>[App.tsx]"]
  node_authmodal["Account dialog<br/>[AuthModal.tsx]"]
  node_sellmodal["Sell dialog<br/>[SellModal.tsx]"]
  node_listingmodal["Listing details"]
  node_chatmodal["Chat dialog<br/>[ChatModal.tsx]"]
  node_icons["Icon set<br/>[Icons.tsx]"]
  node_clientapi["API client<br/>[api.ts]"]
end

subgraph group_api["REST API"]
  node_server["Express entry<br/>[index.js]"]
end

subgraph group_commerce["Commerce domains"]
  node_listingroute["Listing routes<br/>[listings.routes.js]"]
  node_offersroute["Offer routes<br/>[offers.routes.js]"]
  node_messagesroute["Messaging routes<br/>[messages.routes.js]"]
  node_uploadroute["Image upload<br/>[upload.routes.js]"]
end

subgraph group_platform["Identity and platform"]
  node_authroute["Authentication routes<br/>[auth.routes.js]"]
  node_authmw["JWT middleware<br/>[auth.js]"]
  node_metaroute["Campus metadata<br/>[meta.routes.js]"]
  node_healthroute["Health probe<br/>[health.routes.js]"]
  node_uploadmw["Upload handling<br/>[upload.js]"]
end

subgraph group_data["Persistent data"]
  node_storage[("JSON database<br/>[db.js]")]
  node_seed["Seed records<br/>[seedData.js]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"opens"| node_authmodal
node_app -->|"opens"| node_sellmodal
node_app -->|"opens"| node_listingmodal
node_app -->|"opens"| node_chatmodal
node_app -->|"requests through"| node_clientapi
node_authmodal -->|"calls"| node_clientapi
node_sellmodal -->|"calls"| node_clientapi
node_listingmodal -->|"calls"| node_clientapi
node_chatmodal -->|"calls"| node_clientapi
node_app -->|"renders"| node_icons
node_clientapi -->|"sends REST requests"| node_server
node_server -->|"mounts"| node_authroute
node_server -->|"mounts"| node_listingroute
node_server -->|"mounts"| node_offersroute
node_server -->|"mounts"| node_messagesroute
node_server -->|"mounts"| node_metaroute
node_server -->|"mounts"| node_healthroute
node_authroute -->|"guards routes"| node_authmw
node_listingroute -->|"guards routes"| node_authmw
node_offersroute -->|"guards routes"| node_authmw
node_messagesroute -->|"guards routes"| node_authmw
node_authmw -->|"looks up users"| node_storage
node_authroute -->|"reads and writes"| node_storage
node_listingroute -->|"reads and writes"| node_storage
node_offersroute -->|"reads and writes"| node_storage
node_messagesroute -->|"reads and writes"| node_storage
node_metaroute -->|"reads statistics"| node_storage
node_healthroute -->|"checks health"| node_storage
node_storage -->|"loads seed data"| node_seed
node_server -->|"mounts"| node_uploadroute
node_uploadroute -->|"uses"| node_uploadmw
node_student -->|"uploads item photos"| node_uploadroute

click node_app "https://github.com/kumarvijay09/unideal/blob/main/src/App.tsx"
click node_authmodal "https://github.com/kumarvijay09/unideal/blob/main/src/components/AuthModal.tsx"
click node_sellmodal "https://github.com/kumarvijay09/unideal/blob/main/src/components/SellModal.tsx"
click node_listingmodal "https://github.com/kumarvijay09/unideal/blob/main/src/components/ListingDetailModal.tsx"
click node_chatmodal "https://github.com/kumarvijay09/unideal/blob/main/src/components/ChatModal.tsx"
click node_icons "https://github.com/kumarvijay09/unideal/blob/main/src/components/Icons.tsx"
click node_clientapi "https://github.com/kumarvijay09/unideal/blob/main/src/services/api.ts"
click node_server "https://github.com/kumarvijay09/unideal/blob/main/server/index.js"
click node_authroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/auth.routes.js"
click node_authmw "https://github.com/kumarvijay09/unideal/blob/main/server/middleware/auth.js"
click node_listingroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/listings.routes.js"
click node_offersroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/offers.routes.js"
click node_messagesroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/messages.routes.js"
click node_uploadroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/upload.routes.js"
click node_metaroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/meta.routes.js"
click node_healthroute "https://github.com/kumarvijay09/unideal/blob/main/server/routes/health.routes.js"
click node_storage "https://github.com/kumarvijay09/unideal/blob/main/server/database/db.js"
click node_seed "https://github.com/kumarvijay09/unideal/blob/main/server/database/seedData.js"
click node_uploadmw "https://github.com/kumarvijay09/unideal/blob/main/server/middleware/upload.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_authmodal,node_sellmodal,node_listingmodal,node_chatmodal,node_icons,node_clientapi toneBlue
class node_server toneAmber
class node_listingroute,node_offersroute,node_messagesroute,node_uploadroute toneMint
class node_authroute,node_authmw,node_metaroute,node_healthroute,node_uploadmw toneRose
class node_storage,node_seed,node_student toneIndigo
```

## Components

### Marketplace interface

- [Marketplace app](https://github.com/kumarvijay09/unideal/blob/main/src/App.tsx): `src/App.tsx`
- [Account dialog](https://github.com/kumarvijay09/unideal/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Sell dialog](https://github.com/kumarvijay09/unideal/blob/main/src/components/SellModal.tsx): `src/components/SellModal.tsx`
- [Listing details](https://github.com/kumarvijay09/unideal/blob/main/src/components/ListingDetailModal.tsx): `src/components/ListingDetailModal.tsx`
- [Chat dialog](https://github.com/kumarvijay09/unideal/blob/main/src/components/ChatModal.tsx): `src/components/ChatModal.tsx`
- [Icon set](https://github.com/kumarvijay09/unideal/blob/main/src/components/Icons.tsx): `src/components/Icons.tsx`
- [API client](https://github.com/kumarvijay09/unideal/blob/main/src/services/api.ts): `src/services/api.ts`

### REST API

- [Express entry](https://github.com/kumarvijay09/unideal/blob/main/server/index.js): `server/index.js`

### Commerce domains

- [Listing routes](https://github.com/kumarvijay09/unideal/blob/main/server/routes/listings.routes.js): `server/routes/listings.routes.js`
- [Offer routes](https://github.com/kumarvijay09/unideal/blob/main/server/routes/offers.routes.js): `server/routes/offers.routes.js`
- [Messaging routes](https://github.com/kumarvijay09/unideal/blob/main/server/routes/messages.routes.js): `server/routes/messages.routes.js`
- [Image upload](https://github.com/kumarvijay09/unideal/blob/main/server/routes/upload.routes.js): `server/routes/upload.routes.js`

### Identity and platform

- [Authentication routes](https://github.com/kumarvijay09/unideal/blob/main/server/routes/auth.routes.js): `server/routes/auth.routes.js`
- [JWT middleware](https://github.com/kumarvijay09/unideal/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [Campus metadata](https://github.com/kumarvijay09/unideal/blob/main/server/routes/meta.routes.js): `server/routes/meta.routes.js`
- [Health probe](https://github.com/kumarvijay09/unideal/blob/main/server/routes/health.routes.js): `server/routes/health.routes.js`
- [Upload handling](https://github.com/kumarvijay09/unideal/blob/main/server/middleware/upload.js): `server/middleware/upload.js`

### Persistent data

- [JSON database](https://github.com/kumarvijay09/unideal/blob/main/server/database/db.js): `server/database/db.js`
- [Seed records](https://github.com/kumarvijay09/unideal/blob/main/server/database/seedData.js): `server/database/seedData.js`

### Other components

- **Student**

## Connections

- Student → Marketplace app: uses (evidence: `README.md`)
- Marketplace app → Account dialog: opens (evidence: `src/App.tsx`)
- Marketplace app → Sell dialog: opens (evidence: `src/App.tsx`)
- Marketplace app → Listing details: opens (evidence: `src/App.tsx`)
- Marketplace app → Chat dialog: opens (evidence: `src/App.tsx`)
- Marketplace app → API client: requests through (evidence: `src/App.tsx`)
- Account dialog → API client: calls (evidence: `src/components/AuthModal.tsx`)
- Sell dialog → API client: calls (evidence: `src/components/SellModal.tsx`)
- Listing details → API client: calls (evidence: `src/components/ListingDetailModal.tsx`)
- Chat dialog → API client: calls (evidence: `src/components/ChatModal.tsx`)
- Marketplace app → Icon set: renders (evidence: `src/App.tsx`)
- API client → Express entry: sends REST requests (evidence: `src/services/api.ts`)
- Express entry → Authentication routes: mounts (evidence: `server/index.js`)
- Express entry → Listing routes: mounts (evidence: `server/index.js`)
- Express entry → Offer routes: mounts (evidence: `server/index.js`)
- Express entry → Messaging routes: mounts (evidence: `server/index.js`)
- Express entry → Campus metadata: mounts (evidence: `server/index.js`)
- Express entry → Health probe: mounts (evidence: `server/index.js`)
- Authentication routes → JWT middleware: guards routes (evidence: `server/routes/auth.routes.js`)
- Listing routes → JWT middleware: guards routes (evidence: `server/routes/listings.routes.js`)
- Offer routes → JWT middleware: guards routes (evidence: `server/routes/offers.routes.js`)
- Messaging routes → JWT middleware: guards routes (evidence: `server/routes/messages.routes.js`)
- JWT middleware → JSON database: looks up users (evidence: `server/middleware/auth.js`)
- Authentication routes → JSON database: reads and writes (evidence: `server/routes/auth.routes.js`)
- Listing routes → JSON database: reads and writes (evidence: `server/routes/listings.routes.js`)
- Offer routes → JSON database: reads and writes (evidence: `server/routes/offers.routes.js`)
- Messaging routes → JSON database: reads and writes (evidence: `server/routes/messages.routes.js`)
- Campus metadata → JSON database: reads statistics (evidence: `server/routes/meta.routes.js`)
- Health probe → JSON database: checks health (evidence: `server/routes/health.routes.js`)
- JSON database → Seed records: loads seed data (evidence: `server/database/db.js`)
- Express entry → Image upload: mounts (evidence: `server/index.js`)
- Image upload → Upload handling: uses (evidence: `server/routes/upload.routes.js`)
- Student → Image upload: uploads item photos (evidence: `README.md`)
