# hardikluhar/staymate-roommate-apartment-finding-web-application-public architecture

> Architecture diagram of the GitHub repository hardikluhar/staymate-roommate-apartment-finding-web-application-public, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public
- Repository: https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public

## Overview

StayMate is a rental marketplace for seekers and property owners, with an admin surface. The principal journey is: a user registers or logs in, completes role-specific setup, a seeker discovers listings and expresses interest, an owner manages listings and requests, and a seeker reserves a listing and signs an agreement. The graph shows the documented client routes and server API capabilities; source excerpts do not expose most client API calls, so those links are marked unverified rather than asserted as observed calls.

Main entry points: [`client/src/App.jsx`](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/App.jsx) (Route application), [`server/index.js`](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/index.js) (HTTP route registry), [`client/src/pages/seeker/SeekerDashboard.jsx`](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/seeker/SeekerDashboard.jsx) (Seeker discovery), [`server/config/db.js`](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/config/db.js) (MySQL connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Route application<br/>[App.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_access["Route guards<br/>[ProtectedRoute.jsx]"]
  node_setupguard["Setup guard<br/>[SetupRoute.jsx]"]
  node_authpages["Login and signup<br/>[Login.jsx]"]
  node_landing["Marketplace landing<br/>[Landing.jsx]"]
  node_ownerlisting["Owner listings<br/>[OwnerOverview.jsx]"]
  node_ownerrequests["Owner requests<br/>[OwnerRequests.jsx]"]
  node_ownersettings["Owner settings<br/>[OwnerSettings.jsx]"]
  node_seekerdash["Seeker discovery"]
  node_seekerprofile["Seeker profile<br/>[SeekerProfile.jsx]"]
  node_ownersetup["Owner setup<br/>[OwnerSetup.jsx]"]
  node_seekersetup["Seeker setup<br/>[SeekerSetup.jsx]"]
  node_admin["Admin console<br/>[AdminListings.jsx]"]
  node_agreementmodal["Agreement interface<br/>[AgreementModal.jsx]"]
end

subgraph group_server["API and domain services"]
  node_api["HTTP route registry<br/>[index.js]"]
  node_authroutes["Authentication API<br/>[auth.js]"]
  node_listingroutes["Listings API<br/>[listings.js]"]
  node_interests["Interest workflow<br/>[interests.js]"]
  node_reservations["Reservations<br/>[reservations.js]"]
  node_agreementroutes["Agreement API<br/>[agreements.js]"]
  node_agreementgen["Agreement generator"]
  node_profiles["Profile API<br/>[profile.js]"]
  node_notifications["Notifications API<br/>[notifications.js]"]
  node_occupants["Occupants API<br/>[occupants.js]"]
  node_adminapi["Admin API<br/>[admin.js]"]
  node_authmw["Token verification<br/>[auth.js]"]
end

subgraph group_data["Persistence"]
  node_dbpool["MySQL connection<br/>[db.js]"]
  node_schema[("Marketplace tables<br/>[init_db.js]")]
end

node_visitor(("Marketplace user"))

node_visitor -->|"opens"| node_app
node_app -->|"provides auth"| node_authstate
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_authpages
node_app -->|"guards role routes"| node_access
node_app -->|"guards setup"| node_setupguard
node_app -->|"routes to"| node_ownerlisting
node_app -->|"routes to"| node_ownerrequests
node_app -->|"routes to"| node_ownersettings
node_app -->|"routes to"| node_seekerdash
node_app -->|"routes to"| node_seekerprofile
node_app -->|"routes to"| node_ownersetup
node_app -->|"routes to"| node_seekersetup
node_app -->|"routes to"| node_admin
node_ownerrequests -->|"renders"| node_agreementmodal
node_seekerdash -->|"renders"| node_agreementmodal
node_authpages -->|"uses"| node_authstate
node_ownerlisting -.->|"requests listings"| node_listingroutes
node_seekerdash -.->|"loads listings"| node_listingroutes
node_ownerrequests -.->|"manages interests"| node_interests
node_seekerdash -.->|"submits interest"| node_interests
node_seekerdash -.->|"creates reservations"| node_reservations
node_agreementmodal -.->|"signs agreement"| node_agreementroutes
node_ownersettings -.->|"updates profile"| node_profiles
node_seekerdash -.->|"loads notices"| node_notifications
node_ownerlisting -.->|"manages occupants"| node_occupants
node_admin -.->|"admin actions"| node_adminapi
node_api -->|"mounts"| node_authroutes
node_api -->|"mounts"| node_listingroutes
node_api -->|"mounts"| node_interests
node_api -->|"mounts"| node_reservations
node_api -->|"mounts"| node_agreementroutes
node_api -->|"mounts"| node_profiles
node_api -->|"mounts"| node_notifications
node_api -->|"mounts"| node_occupants
node_api -->|"mounts"| node_adminapi
node_authroutes -->|"queries"| node_dbpool
node_listingroutes -->|"queries"| node_dbpool
node_interests -->|"queries"| node_dbpool
node_reservations -->|"queries"| node_dbpool
node_agreementroutes -->|"queries"| node_dbpool
node_agreementroutes -->|"generates HTML"| node_agreementgen
node_agreementroutes -->|"verifies token"| node_authmw
node_reservations -->|"verifies token"| node_authmw
node_dbpool -.->|"initializes schema"| node_schema

click node_app "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/App.jsx"
click node_authstate "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/context/AuthContext.jsx"
click node_access "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/components/ProtectedRoute.jsx"
click node_setupguard "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/components/SetupRoute.jsx"
click node_authpages "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/Login.jsx"
click node_landing "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/Landing.jsx"
click node_ownerlisting "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/owner/OwnerOverview.jsx"
click node_ownerrequests "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/owner/OwnerRequests.jsx"
click node_ownersettings "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/owner/OwnerSettings.jsx"
click node_seekerdash "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/seeker/SeekerDashboard.jsx"
click node_seekerprofile "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/seeker/SeekerProfile.jsx"
click node_ownersetup "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/setup/OwnerSetup.jsx"
click node_seekersetup "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/setup/SeekerSetup.jsx"
click node_admin "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/admin/AdminListings.jsx"
click node_agreementmodal "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/components/AgreementModal.jsx"
click node_api "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/index.js"
click node_authroutes "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/auth.js"
click node_listingroutes "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/listings.js"
click node_interests "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/interests.js"
click node_reservations "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/reservations.js"
click node_agreementroutes "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/agreements.js"
click node_agreementgen "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/utils/agreementGenerator.js"
click node_profiles "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/profile.js"
click node_notifications "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/notifications.js"
click node_occupants "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/occupants.js"
click node_adminapi "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/admin.js"
click node_authmw "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/middleware/auth.js"
click node_dbpool "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/config/db.js"
click node_schema "https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/init_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_authstate,node_access,node_setupguard,node_authpages,node_landing,node_ownerlisting,node_ownerrequests,node_ownersettings,node_seekerdash,node_seekerprofile,node_ownersetup,node_seekersetup,node_admin,node_agreementmodal,node_visitor toneBlue
class node_api,node_authroutes,node_listingroutes,node_interests,node_reservations,node_agreementroutes,node_agreementgen,node_profiles,node_notifications,node_occupants,node_adminapi,node_authmw toneAmber
class node_dbpool,node_schema toneMint
```

## Components

### Web client

- [Route application](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/App.jsx): `client/src/App.jsx`
- [Auth state](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Route guards](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/components/ProtectedRoute.jsx): `client/src/components/ProtectedRoute.jsx`
- [Setup guard](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/components/SetupRoute.jsx): `client/src/components/SetupRoute.jsx`
- [Login and signup](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Marketplace landing](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/Landing.jsx): `client/src/pages/Landing.jsx`
- [Owner listings](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/owner/OwnerOverview.jsx): `client/src/pages/owner/OwnerOverview.jsx`
- [Owner requests](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/owner/OwnerRequests.jsx): `client/src/pages/owner/OwnerRequests.jsx`
- [Owner settings](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/owner/OwnerSettings.jsx): `client/src/pages/owner/OwnerSettings.jsx`
- [Seeker discovery](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/seeker/SeekerDashboard.jsx): `client/src/pages/seeker/SeekerDashboard.jsx`
- [Seeker profile](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/seeker/SeekerProfile.jsx): `client/src/pages/seeker/SeekerProfile.jsx`
- [Owner setup](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/setup/OwnerSetup.jsx): `client/src/pages/setup/OwnerSetup.jsx`
- [Seeker setup](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/setup/SeekerSetup.jsx): `client/src/pages/setup/SeekerSetup.jsx`
- [Admin console](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/pages/admin/AdminListings.jsx): `client/src/pages/admin/AdminListings.jsx`
- [Agreement interface](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/client/src/components/AgreementModal.jsx): `client/src/components/AgreementModal.jsx`

### API and domain services

- [HTTP route registry](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/index.js): `server/index.js`
- [Authentication API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/auth.js): `server/routes/auth.js`
- [Listings API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/listings.js): `server/routes/listings.js`
- [Interest workflow](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/interests.js): `server/routes/interests.js`
- [Reservations](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/reservations.js): `server/routes/reservations.js`
- [Agreement API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/agreements.js): `server/routes/agreements.js`
- [Agreement generator](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/utils/agreementGenerator.js): `server/utils/agreementGenerator.js`
- [Profile API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/profile.js): `server/routes/profile.js`
- [Notifications API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/notifications.js): `server/routes/notifications.js`
- [Occupants API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/occupants.js): `server/routes/occupants.js`
- [Admin API](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/routes/admin.js): `server/routes/admin.js`
- [Token verification](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/middleware/auth.js): `server/middleware/auth.js`

### Persistence

- [MySQL connection](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/config/db.js): `server/config/db.js`
- [Marketplace tables](https://github.com/hardikluhar/staymate-roommate-apartment-finding-web-application-public/blob/master/server/init_db.js): `server/init_db.js`

### Other components

- **Marketplace user**

## Connections

- Marketplace user → Route application: opens (evidence: `client/src/App.jsx`)
- Route application → Auth state: provides auth (evidence: `client/src/App.jsx`)
- Route application → Marketplace landing: routes to (evidence: `client/src/App.jsx`)
- Route application → Login and signup: routes to (evidence: `client/src/App.jsx`)
- Route application → Route guards: guards role routes (evidence: `client/src/App.jsx`)
- Route application → Setup guard: guards setup (evidence: `client/src/App.jsx`)
- Route application → Owner listings: routes to (evidence: `client/src/App.jsx`)
- Route application → Owner requests: routes to (evidence: `client/src/App.jsx`)
- Route application → Owner settings: routes to (evidence: `client/src/App.jsx`)
- Route application → Seeker discovery: routes to (evidence: `client/src/App.jsx`)
- Route application → Seeker profile: routes to (evidence: `client/src/App.jsx`)
- Route application → Owner setup: routes to (evidence: `client/src/App.jsx`)
- Route application → Seeker setup: routes to (evidence: `client/src/App.jsx`)
- Route application → Admin console: routes to (evidence: `client/src/App.jsx`)
- Owner requests → Agreement interface: renders (evidence: `client/src/pages/owner/OwnerRequests.jsx`)
- Seeker discovery → Agreement interface: renders (evidence: `client/src/pages/seeker/SeekerDashboard.jsx`)
- Login and signup → Auth state: uses (evidence: `client/src/pages/Login.jsx`)
- Owner listings → Listings API: requests listings
- Seeker discovery → Listings API: loads listings
- Owner requests → Interest workflow: manages interests
- Seeker discovery → Interest workflow: submits interest
- Seeker discovery → Reservations: creates reservations
- Agreement interface → Agreement API: signs agreement
- Owner settings → Profile API: updates profile
- Seeker discovery → Notifications API: loads notices
- Owner listings → Occupants API: manages occupants
- Admin console → Admin API: admin actions
- HTTP route registry → Authentication API: mounts (evidence: `server/index.js`)
- HTTP route registry → Listings API: mounts (evidence: `server/index.js`)
- HTTP route registry → Interest workflow: mounts (evidence: `server/index.js`)
- HTTP route registry → Reservations: mounts (evidence: `server/index.js`)
- HTTP route registry → Agreement API: mounts (evidence: `server/index.js`)
- HTTP route registry → Profile API: mounts (evidence: `server/index.js`)
- HTTP route registry → Notifications API: mounts (evidence: `server/index.js`)
- HTTP route registry → Occupants API: mounts (evidence: `server/index.js`)
- HTTP route registry → Admin API: mounts (evidence: `server/index.js`)
- Authentication API → MySQL connection: queries (evidence: `server/routes/auth.js`)
- Listings API → MySQL connection: queries (evidence: `server/routes/listings.js`)
- Interest workflow → MySQL connection: queries (evidence: `server/routes/interests.js`)
- Reservations → MySQL connection: queries (evidence: `server/routes/reservations.js`)
- Agreement API → MySQL connection: queries (evidence: `server/routes/agreements.js`)
- Agreement API → Agreement generator: generates HTML (evidence: `server/routes/agreements.js`)
- Agreement API → Token verification: verifies token (evidence: `server/routes/agreements.js`)
- Reservations → Token verification: verifies token (evidence: `server/routes/reservations.js`)
- MySQL connection → Marketplace tables: initializes schema (evidence: `server/init_db.js`)
