# mansi-91/kutumb architecture

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

- Interactive diagram: https://gitdiagram.com/mansi-91/kutumb
- Repository: https://github.com/mansi-91/kutumb

## Overview

Kutumb is a society-operations web app: residents, staff, security, and admins use a routed React client to access authenticated REST features such as complaints, bills, bookings, visitors, notices, and emergencies. Express route handlers enforce access and implement domain operations over MongoDB models; billing also supports optional Razorpay payments. The graph preserves the README’s major capabilities. Several client pages and routes were not excerpted, so their connections are shown only where README or indexed references support them; optional or unverified links are dashed.

Main entry points: [`client/src/api.js`](https://github.com/mansi-91/kutumb/blob/main/client/src/api.js) (REST client), [`server/routes/dashboard.js`](https://github.com/mansi-91/kutumb/blob/main/server/routes/dashboard.js) (Society dashboard), [`server/models/User.js`](https://github.com/mansi-91/kutumb/blob/main/server/models/User.js) (User records), [`server/routes/complaints.js`](https://github.com/mansi-91/kutumb/blob/main/server/routes/complaints.js) (Complaint handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["Route shell<br/>[App.jsx]"]
  node_api["REST client<br/>[api.js]"]
end

subgraph group_identity["Identity and access"]
  node_authstate["Session context<br/>[AuthContext.jsx]"]
  node_authroutes["Authentication<br/>[auth.js]"]
  node_authmw["JWT authorization<br/>[auth.js]"]
end

subgraph group_operations["Society operations"]
  node_users["Resident management<br/>[users.js]"]
  node_complaints["Complaint handling<br/>[complaints.js]"]
  node_staffjobs["Staff assignment<br/>[staffJobs.js]"]
  node_billing["Bills and fees<br/>[bills.js]"]
  node_bookings["Facility booking<br/>[bookings.js]"]
  node_notices["Notices<br/>[notices.js]"]
  node_visitors["Visitor passes<br/>[visitors.js]"]
  node_emergencies["Emergency SOS<br/>[emergencies.js]"]
  node_dashboard["Society dashboard<br/>[dashboard.js]"]
end

subgraph group_persistence["Domain data"]
  node_billmodel["Bill records<br/>[Bill.js]"]
  node_bookingmodel["Booking records<br/>[Booking.js]"]
  node_complaintmodel["Complaint records<br/>[Complaint.js]"]
  node_emergencymodel["Emergency records<br/>[Emergency.js]"]
  node_facilitymodel["Facility records<br/>[Facility.js]"]
  node_noticemodel["Notice records<br/>[Notice.js]"]
  node_usermodel["User records<br/>[User.js]"]
  node_visitormodel["Visitor records<br/>[Visitor.js]"]
end

node_members(("Society users"))
node_payments["Payment gateway"]
node_mongo[("MongoDB")]

node_members -->|"use"| node_app
node_app -->|"checks session"| node_authstate
node_authstate -->|"loads profile"| node_api
node_api -.->|"sends REST requests"| node_authroutes
node_api -.->|"sends REST requests"| node_users
node_api -.->|"sends REST requests"| node_complaints
node_api -.->|"sends REST requests"| node_billing
node_api -.->|"sends REST requests"| node_bookings
node_api -.->|"sends REST requests"| node_notices
node_api -.->|"sends REST requests"| node_visitors
node_api -.->|"sends REST requests"| node_emergencies
node_api -.->|"sends REST requests"| node_dashboard
node_authroutes -->|"authenticates users"| node_usermodel
node_authroutes -.->|"emails reset link"| node_members
node_authmw -->|"loads identity"| node_usermodel
node_users -->|"manages users"| node_usermodel
node_complaints -->|"manages complaints"| node_complaintmodel
node_complaints -->|"assigns staff"| node_staffjobs
node_complaints -->|"looks up staff"| node_usermodel
node_billing -->|"creates and updates"| node_billmodel
node_billing -->|"selects residents"| node_usermodel
node_billing -.->|"creates payment order"| node_payments
node_bookings -->|"manages bookings"| node_bookingmodel
node_bookings -->|"checks facilities"| node_facilitymodel
node_notices -->|"manages notices"| node_noticemodel
node_visitors -->|"manages visits"| node_visitormodel
node_emergencies -->|"records alerts"| node_emergencymodel
node_dashboard -->|"reads metrics"| node_usermodel
node_dashboard -->|"reads metrics"| node_complaintmodel
node_dashboard -->|"reads metrics"| node_billmodel
node_dashboard -->|"reads metrics"| node_visitormodel
node_dashboard -->|"reads metrics"| node_emergencymodel
node_dashboard -->|"reads metrics"| node_bookingmodel
node_billmodel -.->|"persists records"| node_mongo
node_bookingmodel -.->|"persists records"| node_mongo
node_complaintmodel -.->|"persists records"| node_mongo
node_emergencymodel -.->|"persists records"| node_mongo
node_facilitymodel -.->|"persists records"| node_mongo
node_noticemodel -.->|"persists records"| node_mongo
node_usermodel -.->|"persists records"| node_mongo
node_visitormodel -.->|"persists records"| node_mongo

click node_app "https://github.com/mansi-91/kutumb/blob/main/client/src/App.jsx"
click node_authstate "https://github.com/mansi-91/kutumb/blob/main/client/src/context/AuthContext.jsx"
click node_api "https://github.com/mansi-91/kutumb/blob/main/client/src/api.js"
click node_authroutes "https://github.com/mansi-91/kutumb/blob/main/server/routes/auth.js"
click node_authmw "https://github.com/mansi-91/kutumb/blob/main/server/middleware/auth.js"
click node_users "https://github.com/mansi-91/kutumb/blob/main/server/routes/users.js"
click node_complaints "https://github.com/mansi-91/kutumb/blob/main/server/routes/complaints.js"
click node_staffjobs "https://github.com/mansi-91/kutumb/blob/main/server/utils/staffJobs.js"
click node_billing "https://github.com/mansi-91/kutumb/blob/main/server/routes/bills.js"
click node_bookings "https://github.com/mansi-91/kutumb/blob/main/server/routes/bookings.js"
click node_notices "https://github.com/mansi-91/kutumb/blob/main/server/routes/notices.js"
click node_visitors "https://github.com/mansi-91/kutumb/blob/main/server/routes/visitors.js"
click node_emergencies "https://github.com/mansi-91/kutumb/blob/main/server/routes/emergencies.js"
click node_dashboard "https://github.com/mansi-91/kutumb/blob/main/server/routes/dashboard.js"
click node_billmodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Bill.js"
click node_bookingmodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Booking.js"
click node_complaintmodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Complaint.js"
click node_emergencymodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Emergency.js"
click node_facilitymodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Facility.js"
click node_noticemodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Notice.js"
click node_usermodel "https://github.com/mansi-91/kutumb/blob/main/server/models/User.js"
click node_visitormodel "https://github.com/mansi-91/kutumb/blob/main/server/models/Visitor.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,node_members toneBlue
class node_authstate,node_authroutes,node_authmw,node_mongo toneAmber
class node_users,node_complaints,node_staffjobs,node_billing,node_bookings,node_notices,node_visitors,node_emergencies,node_dashboard toneMint
class node_billmodel,node_bookingmodel,node_complaintmodel,node_emergencymodel,node_facilitymodel,node_noticemodel,node_usermodel,node_visitormodel toneRose
class node_payments toneIndigo
```

## Components

### React client

- [Route shell](https://github.com/mansi-91/kutumb/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [REST client](https://github.com/mansi-91/kutumb/blob/main/client/src/api.js): `client/src/api.js`

### Identity and access

- [Session context](https://github.com/mansi-91/kutumb/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Authentication](https://github.com/mansi-91/kutumb/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [JWT authorization](https://github.com/mansi-91/kutumb/blob/main/server/middleware/auth.js): `server/middleware/auth.js`

### Society operations

- [Resident management](https://github.com/mansi-91/kutumb/blob/main/server/routes/users.js): `server/routes/users.js`
- [Complaint handling](https://github.com/mansi-91/kutumb/blob/main/server/routes/complaints.js): `server/routes/complaints.js`
- [Staff assignment](https://github.com/mansi-91/kutumb/blob/main/server/utils/staffJobs.js): `server/utils/staffJobs.js`
- [Bills and fees](https://github.com/mansi-91/kutumb/blob/main/server/routes/bills.js): `server/routes/bills.js`
- [Facility booking](https://github.com/mansi-91/kutumb/blob/main/server/routes/bookings.js): `server/routes/bookings.js`
- [Notices](https://github.com/mansi-91/kutumb/blob/main/server/routes/notices.js): `server/routes/notices.js`
- [Visitor passes](https://github.com/mansi-91/kutumb/blob/main/server/routes/visitors.js): `server/routes/visitors.js`
- [Emergency SOS](https://github.com/mansi-91/kutumb/blob/main/server/routes/emergencies.js): `server/routes/emergencies.js`
- [Society dashboard](https://github.com/mansi-91/kutumb/blob/main/server/routes/dashboard.js): `server/routes/dashboard.js`

### Domain data

- [Bill records](https://github.com/mansi-91/kutumb/blob/main/server/models/Bill.js): `server/models/Bill.js`
- [Booking records](https://github.com/mansi-91/kutumb/blob/main/server/models/Booking.js): `server/models/Booking.js`
- [Complaint records](https://github.com/mansi-91/kutumb/blob/main/server/models/Complaint.js): `server/models/Complaint.js`
- [Emergency records](https://github.com/mansi-91/kutumb/blob/main/server/models/Emergency.js): `server/models/Emergency.js`
- [Facility records](https://github.com/mansi-91/kutumb/blob/main/server/models/Facility.js): `server/models/Facility.js`
- [Notice records](https://github.com/mansi-91/kutumb/blob/main/server/models/Notice.js): `server/models/Notice.js`
- [User records](https://github.com/mansi-91/kutumb/blob/main/server/models/User.js): `server/models/User.js`
- [Visitor records](https://github.com/mansi-91/kutumb/blob/main/server/models/Visitor.js): `server/models/Visitor.js`

### Other components

- **Society users**
- **Payment gateway**
- **MongoDB**

## Connections

- Society users → Route shell: use (evidence: `README.md`)
- Route shell → Session context: checks session (evidence: `client/src/App.jsx`)
- Session context → REST client: loads profile (evidence: `client/src/context/AuthContext.jsx`)
- REST client → Authentication: sends REST requests
- REST client → Resident management: sends REST requests
- REST client → Complaint handling: sends REST requests
- REST client → Bills and fees: sends REST requests
- REST client → Facility booking: sends REST requests
- REST client → Notices: sends REST requests
- REST client → Visitor passes: sends REST requests
- REST client → Emergency SOS: sends REST requests
- REST client → Society dashboard: sends REST requests
- Authentication → User records: authenticates users (evidence: `server/routes/auth.js`)
- Authentication → Society users: emails reset link
- JWT authorization → User records: loads identity (evidence: `server/middleware/auth.js`)
- Resident management → User records: manages users (evidence: `server/routes/users.js`)
- Complaint handling → Complaint records: manages complaints (evidence: `server/routes/complaints.js`)
- Complaint handling → Staff assignment: assigns staff (evidence: `server/routes/complaints.js`)
- Complaint handling → User records: looks up staff (evidence: `server/routes/complaints.js`)
- Bills and fees → Bill records: creates and updates (evidence: `server/routes/bills.js`)
- Bills and fees → User records: selects residents (evidence: `server/routes/bills.js`)
- Bills and fees → Payment gateway: creates payment order (evidence: `server/routes/bills.js`)
- Facility booking → Booking records: manages bookings (evidence: `server/routes/bookings.js`)
- Facility booking → Facility records: checks facilities (evidence: `server/routes/bookings.js`)
- Notices → Notice records: manages notices (evidence: `server/routes/notices.js`)
- Visitor passes → Visitor records: manages visits (evidence: `server/routes/visitors.js`)
- Emergency SOS → Emergency records: records alerts (evidence: `server/routes/emergencies.js`)
- Society dashboard → User records: reads metrics (evidence: `server/routes/dashboard.js`)
- Society dashboard → Complaint records: reads metrics (evidence: `server/routes/dashboard.js`)
- Society dashboard → Bill records: reads metrics (evidence: `server/routes/dashboard.js`)
- Society dashboard → Visitor records: reads metrics (evidence: `server/routes/dashboard.js`)
- Society dashboard → Emergency records: reads metrics (evidence: `server/routes/dashboard.js`)
- Society dashboard → Booking records: reads metrics (evidence: `server/routes/dashboard.js`)
- Bill records → MongoDB: persists records
- Booking records → MongoDB: persists records
- Complaint records → MongoDB: persists records
- Emergency records → MongoDB: persists records
- Facility records → MongoDB: persists records
- Notice records → MongoDB: persists records
- User records → MongoDB: persists records
- Visitor records → MongoDB: persists records
