# cosenhub07/cosen architecture

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

- Interactive diagram: https://gitdiagram.com/cosenhub07/cosen
- Repository: https://github.com/cosenhub07/cosen

## Overview

Cosen is a campus services marketplace: students discover or post services, arrange orders, pay, communicate, and complete transactions; sellers and buyers also use profiles and reviews. The React app routes users into marketplace, account, messaging, payment, and administration screens, while an Express API handles domain operations backed by Supabase. Authentication, notifications, and administrative moderation support those workflows. Messaging includes Socket.IO behavior visible in the server excerpt. Several screens and route implementations were not sampled, so their internal calls are omitted; documented route mounting and explicit imports support the relationships shown.

Main entry points: [`client/src/App.jsx`](https://github.com/cosenhub07/cosen/blob/main/client/src/App.jsx) (App routing), [`server/server.js`](https://github.com/cosenhub07/cosen/blob/main/server/server.js) (Express API), [`client/src/lib/api.js`](https://github.com/cosenhub07/cosen/blob/main/client/src/lib/api.js) (API client), [`server/config/db.js`](https://github.com/cosenhub07/cosen/blob/main/server/config/db.js) (Supabase)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student marketplace"]
  node_app["App routing<br/>[App.jsx]"]
  node_authui["Account screens<br/>[Signup.jsx]"]
  node_authstate["Auth state<br/>[authStore.js]"]
  node_api["API client<br/>[api.js]"]
  node_browse["Browse services<br/>[Browse.jsx]"]
  node_service["Service details<br/>[ServiceDetail.jsx]"]
  node_posting["Service posting<br/>[PostService.jsx]"]
  node_profile["Profiles<br/>[Profile.jsx]"]
  node_ordersui["Order workflow<br/>[OrderDetail.jsx]"]
  node_checkout["Razorpay checkout<br/>[useRazorpay.js]"]
  node_messagesui["Messages<br/>[Messages.jsx]"]
  node_dashboard["Student dashboard<br/>[Dashboard.jsx]"]
end

subgraph group_server["API and domain"]
  node_server["Express API<br/>[server.js]"]
  node_authroutes["Authentication<br/>[auth.js]"]
  node_services["Service operations<br/>[services.js]"]
  node_orders["Order operations<br/>[orders.js]"]
  node_payments["Payment operations<br/>[payments.js]"]
  node_conversations["Conversations<br/>[conversations.js]"]
  node_messaging["Live messaging<br/>[server.js]"]
  node_reviews["Reviews<br/>[reviews.js]"]
  node_notifications["Notifications"]
  node_database[("Supabase<br/>[db.js]")]
  node_adminroutes["Admin operations<br/>[admin.js]"]
end

subgraph group_admin["Administration"]
  node_adminui["Admin screens<br/>[AdminOrders.jsx]"]
  node_adminapi["Admin API client<br/>[adminApi.js]"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_service
node_app -->|"routes to"| node_posting
node_app -->|"routes to"| node_ordersui
node_app -->|"routes to"| node_messagesui
node_app -->|"routes to"| node_dashboard
node_authui -.->|"uses"| node_authstate
node_authstate -->|"requests through"| node_api
node_browse -.->|"requests through"| node_api
node_service -.->|"requests through"| node_api
node_posting -.->|"requests through"| node_api
node_profile -.->|"requests through"| node_api
node_ordersui -.->|"requests through"| node_api
node_ordersui -.->|"opens checkout"| node_checkout
node_messagesui -.->|"connects to"| node_messaging
node_api -.->|"sends API requests"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_services
node_server -->|"mounts routes"| node_orders
node_server -->|"mounts routes"| node_payments
node_server -->|"mounts routes"| node_conversations
node_server -->|"mounts routes"| node_reviews
node_authroutes -->|"queries"| node_database
node_services -->|"queries"| node_database
node_orders -->|"reads and writes"| node_database
node_payments -->|"queries"| node_database
node_conversations -->|"queries"| node_database
node_reviews -->|"queries"| node_database
node_server -->|"handles sockets"| node_messaging
node_messaging -->|"saves messages"| node_database
node_orders -->|"creates notifications"| node_notifications
node_payments -->|"creates notifications"| node_notifications
node_reviews -->|"creates notifications"| node_notifications
node_app -->|"routes to"| node_adminui
node_adminui -->|"requests through"| node_adminapi
node_adminapi -->|"uses"| node_api
node_server -->|"mounts routes"| node_adminroutes
node_adminroutes -->|"queries"| node_database

click node_app "https://github.com/cosenhub07/cosen/blob/main/client/src/App.jsx"
click node_authui "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Signup.jsx"
click node_authstate "https://github.com/cosenhub07/cosen/blob/main/client/src/store/authStore.js"
click node_api "https://github.com/cosenhub07/cosen/blob/main/client/src/lib/api.js"
click node_browse "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Browse.jsx"
click node_service "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/ServiceDetail.jsx"
click node_posting "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/PostService.jsx"
click node_profile "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Profile.jsx"
click node_ordersui "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/OrderDetail.jsx"
click node_checkout "https://github.com/cosenhub07/cosen/blob/main/client/src/hooks/useRazorpay.js"
click node_messagesui "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Messages.jsx"
click node_dashboard "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Dashboard.jsx"
click node_server "https://github.com/cosenhub07/cosen/blob/main/server/server.js"
click node_authroutes "https://github.com/cosenhub07/cosen/blob/main/server/routes/auth.js"
click node_services "https://github.com/cosenhub07/cosen/blob/main/server/routes/services.js"
click node_orders "https://github.com/cosenhub07/cosen/blob/main/server/routes/orders.js"
click node_payments "https://github.com/cosenhub07/cosen/blob/main/server/routes/payments.js"
click node_conversations "https://github.com/cosenhub07/cosen/blob/main/server/routes/conversations.js"
click node_messaging "https://github.com/cosenhub07/cosen/blob/main/server/server.js"
click node_reviews "https://github.com/cosenhub07/cosen/blob/main/server/routes/reviews.js"
click node_notifications "https://github.com/cosenhub07/cosen/blob/main/server/utils/createNotification.js"
click node_database "https://github.com/cosenhub07/cosen/blob/main/server/config/db.js"
click node_adminui "https://github.com/cosenhub07/cosen/blob/main/client/src/pages/admin/AdminOrders.jsx"
click node_adminapi "https://github.com/cosenhub07/cosen/blob/main/client/src/lib/adminApi.js"
click node_adminroutes "https://github.com/cosenhub07/cosen/blob/main/server/routes/admin.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_authui,node_authstate,node_api,node_browse,node_service,node_posting,node_profile,node_ordersui,node_checkout,node_messagesui,node_dashboard toneBlue
class node_server,node_authroutes,node_services,node_orders,node_payments,node_conversations,node_messaging,node_reviews,node_notifications,node_database,node_adminroutes toneAmber
class node_adminui,node_adminapi toneMint
class node_student toneIndigo
```

## Components

### Student marketplace

- [App routing](https://github.com/cosenhub07/cosen/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Account screens](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Signup.jsx): `client/src/pages/Signup.jsx`
- [Auth state](https://github.com/cosenhub07/cosen/blob/main/client/src/store/authStore.js): `client/src/store/authStore.js`
- [API client](https://github.com/cosenhub07/cosen/blob/main/client/src/lib/api.js): `client/src/lib/api.js`
- [Browse services](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Browse.jsx): `client/src/pages/Browse.jsx`
- [Service details](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/ServiceDetail.jsx): `client/src/pages/ServiceDetail.jsx`
- [Service posting](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/PostService.jsx): `client/src/pages/PostService.jsx`
- [Profiles](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Order workflow](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/OrderDetail.jsx): `client/src/pages/OrderDetail.jsx`
- [Razorpay checkout](https://github.com/cosenhub07/cosen/blob/main/client/src/hooks/useRazorpay.js): `client/src/hooks/useRazorpay.js`
- [Messages](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Messages.jsx): `client/src/pages/Messages.jsx`
- [Student dashboard](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`

### API and domain

- [Express API](https://github.com/cosenhub07/cosen/blob/main/server/server.js): `server/server.js`
- [Authentication](https://github.com/cosenhub07/cosen/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Service operations](https://github.com/cosenhub07/cosen/blob/main/server/routes/services.js): `server/routes/services.js`
- [Order operations](https://github.com/cosenhub07/cosen/blob/main/server/routes/orders.js): `server/routes/orders.js`
- [Payment operations](https://github.com/cosenhub07/cosen/blob/main/server/routes/payments.js): `server/routes/payments.js`
- [Conversations](https://github.com/cosenhub07/cosen/blob/main/server/routes/conversations.js): `server/routes/conversations.js`
- [Live messaging](https://github.com/cosenhub07/cosen/blob/main/server/server.js): `server/server.js`
- [Reviews](https://github.com/cosenhub07/cosen/blob/main/server/routes/reviews.js): `server/routes/reviews.js`
- [Notifications](https://github.com/cosenhub07/cosen/blob/main/server/utils/createNotification.js): `server/utils/createNotification.js`
- [Supabase](https://github.com/cosenhub07/cosen/blob/main/server/config/db.js): `server/config/db.js`
- [Admin operations](https://github.com/cosenhub07/cosen/blob/main/server/routes/admin.js): `server/routes/admin.js`

### Administration

- [Admin screens](https://github.com/cosenhub07/cosen/blob/main/client/src/pages/admin/AdminOrders.jsx): `client/src/pages/admin/AdminOrders.jsx`
- [Admin API client](https://github.com/cosenhub07/cosen/blob/main/client/src/lib/adminApi.js): `client/src/lib/adminApi.js`

### Other components

- **Student**

## Connections

- Student → App routing: uses
- App routing → Account screens: routes to (evidence: `client/src/App.jsx`)
- App routing → Browse services: routes to (evidence: `client/src/App.jsx`)
- App routing → Service details: routes to (evidence: `client/src/App.jsx`)
- App routing → Service posting: routes to (evidence: `client/src/App.jsx`)
- App routing → Order workflow: routes to (evidence: `client/src/App.jsx`)
- App routing → Messages: routes to (evidence: `client/src/App.jsx`)
- App routing → Student dashboard: routes to (evidence: `client/src/App.jsx`)
- Account screens → Auth state: uses
- Auth state → API client: requests through (evidence: `client/src/store/authStore.js`)
- Browse services → API client: requests through
- Service details → API client: requests through (evidence: `client/src/pages/ServiceDetail.jsx`)
- Service posting → API client: requests through (evidence: `client/src/pages/PostService.jsx`)
- Profiles → API client: requests through
- Order workflow → API client: requests through (evidence: `client/src/pages/OrderDetail.jsx`)
- Order workflow → Razorpay checkout: opens checkout (evidence: `client/src/pages/OrderDetail.jsx`)
- Messages → Live messaging: connects to
- API client → Express API: sends API requests
- Express API → Authentication: mounts routes (evidence: `server/server.js`)
- Express API → Service operations: mounts routes (evidence: `server/server.js`)
- Express API → Order operations: mounts routes (evidence: `server/server.js`)
- Express API → Payment operations: mounts routes (evidence: `server/server.js`)
- Express API → Conversations: mounts routes (evidence: `server/server.js`)
- Express API → Reviews: mounts routes (evidence: `server/server.js`)
- Authentication → Supabase: queries (evidence: `server/routes/auth.js`)
- Service operations → Supabase: queries (evidence: `server/routes/services.js`)
- Order operations → Supabase: reads and writes (evidence: `server/routes/orders.js`)
- Payment operations → Supabase: queries (evidence: `server/routes/payments.js`)
- Conversations → Supabase: queries (evidence: `server/routes/conversations.js`)
- Reviews → Supabase: queries (evidence: `server/routes/reviews.js`)
- Express API → Live messaging: handles sockets (evidence: `server/server.js`)
- Live messaging → Supabase: saves messages (evidence: `server/server.js`)
- Order operations → Notifications: creates notifications (evidence: `server/routes/orders.js`)
- Payment operations → Notifications: creates notifications (evidence: `server/routes/payments.js`)
- Reviews → Notifications: creates notifications (evidence: `server/routes/reviews.js`)
- App routing → Admin screens: routes to (evidence: `client/src/App.jsx`)
- Admin screens → Admin API client: requests through (evidence: `client/src/pages/admin/AdminOrders.jsx`)
- Admin API client → API client: uses (evidence: `client/src/lib/adminApi.js`)
- Express API → Admin operations: mounts routes (evidence: `server/server.js`)
- Admin operations → Supabase: queries (evidence: `server/routes/admin.js`)
