# suhas1010/stayos architecture

> Architecture diagram of the GitHub repository suhas1010/stayos, 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/suhas1010/stayos
- Repository: https://github.com/suhas1010/stayos

## Overview

StayOS is a multi-property management platform for owners, caretakers, and tenants. Users sign in, then the protected web app provides role-aware views for properties, rooms, tenants, rent, and complaints; those screens use a shared HTTP client to reach the versioned API. Express routes dispatch requests through authentication, role, and property/tenant access checks to domain controllers, which read and write MongoDB models. The README documents further authentication and operational capabilities; several corresponding frontend and backend files were not sampled, so links for those paths are omitted or marked unverified.

Main entry points: [`client/src/App.jsx`](https://github.com/suhas1010/stayos/blob/main/client/src/App.jsx) (Route shell), [`server/src/controllers/tenant.controller.js`](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/tenant.controller.js) (Tenant operations), [`server/src/app.js`](https://github.com/suhas1010/stayos/blob/main/server/src/app.js) (Express API), [`server/src/controllers/rent.controller.js`](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/rent.controller.js) (Rent operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Route shell<br/>[App.jsx]"]
  node_authui["Authentication state<br/>[AuthContext.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_propertiesui["Properties<br/>[PropertiesList.jsx]"]
  node_propertydetail["Property operations view"]
  node_roomsui["Rooms<br/>[RoomsPage.jsx]"]
  node_tenantsui["Tenants<br/>[TenantsPage.jsx]"]
  node_rentui["Rent and payments<br/>[RentPage.jsx]"]
  node_complaintsui["Complaints<br/>[ComplaintsPage.jsx]"]
  node_http["HTTP client<br/>[client.js]"]
end

subgraph group_api["API and access"]
  node_apiapp["Express API<br/>[app.js]"]
  node_authroutes["Authentication routes<br/>[auth.routes.js]"]
  node_tenantroute["Tenant routes<br/>[tenant.routes.js]"]
  node_rentroute["Rent routes<br/>[rent.routes.js]"]
  node_complaintroute["Complaint routes"]
  node_transactionroute["Transaction routes"]
  node_access["Request access checks"]
end

subgraph group_operations["Property operations"]
  node_tenantctl["Tenant operations"]
  node_rentctl["Rent operations<br/>[rent.controller.js]"]
  node_complaintctl["Complaint operations"]
  node_transactionctl["Transaction operations"]
  node_propertiesctl["Property operations"]
  node_email["Email service<br/>[email.services.js]"]
end

subgraph group_data["Persistence"]
  node_userstore[("Users<br/>[user.models.js]")]
  node_propertystore[("Properties<br/>[property.models.js]")]
  node_roomstore[("Rooms<br/>[room.models.js]")]
  node_tenantstore[("Tenant records<br/>[tenant.models.js]")]
  node_rentstore[("Rent records<br/>[rent.models.js]")]
  node_complaintstore[("Complaints")]
  node_transactionstore[("Transactions")]
end

node_users(("Owner, caretaker, tenant"))

node_users -->|"use"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_propertiesui
node_app -->|"routes to"| node_propertydetail
node_app -->|"routes to"| node_roomsui
node_app -->|"routes to"| node_tenantsui
node_app -->|"routes to"| node_rentui
node_app -->|"routes to"| node_complaintsui
node_authui -->|"uses API"| node_http
node_users -.->|"make requests"| node_http
node_http -.->|"calls API"| node_apiapp
node_apiapp -->|"mounts"| node_authroutes
node_apiapp -->|"mounts"| node_tenantroute
node_apiapp -->|"mounts"| node_rentroute
node_apiapp -->|"mounts"| node_complaintroute
node_apiapp -->|"mounts"| node_transactionroute
node_tenantroute -->|"dispatches"| node_tenantctl
node_tenantroute -->|"checks access"| node_access
node_rentroute -->|"dispatches"| node_rentctl
node_rentroute -->|"checks access"| node_access
node_complaintroute -->|"dispatches"| node_complaintctl
node_complaintroute -->|"checks access"| node_access
node_transactionroute -->|"dispatches"| node_transactionctl
node_transactionroute -->|"checks access"| node_access
node_tenantctl -->|"reads"| node_propertystore
node_tenantctl -->|"reads and updates"| node_userstore
node_tenantctl -->|"updates occupancy"| node_roomstore
node_tenantctl -->|"reads and writes"| node_tenantstore
node_tenantctl -->|"deletes records"| node_rentstore
node_tenantctl -->|"deletes records"| node_complaintstore
node_rentctl -->|"reads"| node_propertystore
node_rentctl -->|"reads"| node_tenantstore
node_rentctl -->|"reads and writes"| node_rentstore
node_complaintctl -->|"reads and writes"| node_complaintstore
node_transactionctl -->|"reads and writes"| node_transactionstore
node_propertiesctl -.->|"manages"| node_propertystore
node_authroutes -.->|"authenticates"| node_userstore
node_authui -.->|"verification flow"| node_email

click node_app "https://github.com/suhas1010/stayos/blob/main/client/src/App.jsx"
click node_authui "https://github.com/suhas1010/stayos/blob/main/client/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/suhas1010/stayos/blob/main/client/src/pages/dashboard/Dashboard.jsx"
click node_propertiesui "https://github.com/suhas1010/stayos/blob/main/client/src/pages/properties/PropertiesList.jsx"
click node_propertydetail "https://github.com/suhas1010/stayos/blob/main/client/src/pages/properties/PropertyDetails.jsx"
click node_roomsui "https://github.com/suhas1010/stayos/blob/main/client/src/pages/rooms/RoomsPage.jsx"
click node_tenantsui "https://github.com/suhas1010/stayos/blob/main/client/src/pages/tenants/TenantsPage.jsx"
click node_rentui "https://github.com/suhas1010/stayos/blob/main/client/src/pages/rent/RentPage.jsx"
click node_complaintsui "https://github.com/suhas1010/stayos/blob/main/client/src/pages/complaints/ComplaintsPage.jsx"
click node_http "https://github.com/suhas1010/stayos/blob/main/client/src/api/client.js"
click node_apiapp "https://github.com/suhas1010/stayos/blob/main/server/src/app.js"
click node_authroutes "https://github.com/suhas1010/stayos/blob/main/server/src/routes/auth.routes.js"
click node_tenantroute "https://github.com/suhas1010/stayos/blob/main/server/src/routes/tenant.routes.js"
click node_rentroute "https://github.com/suhas1010/stayos/blob/main/server/src/routes/rent.routes.js"
click node_complaintroute "https://github.com/suhas1010/stayos/blob/main/server/src/routes/complaint.routes.js"
click node_transactionroute "https://github.com/suhas1010/stayos/blob/main/server/src/routes/transaction.routes.js"
click node_access "https://github.com/suhas1010/stayos/blob/main/server/src/middlewares/ownership.middleware.js"
click node_tenantctl "https://github.com/suhas1010/stayos/blob/main/server/src/controllers/tenant.controller.js"
click node_rentctl "https://github.com/suhas1010/stayos/blob/main/server/src/controllers/rent.controller.js"
click node_complaintctl "https://github.com/suhas1010/stayos/blob/main/server/src/controllers/complaint.controller.js"
click node_transactionctl "https://github.com/suhas1010/stayos/blob/main/server/src/controllers/transaction.controller.js"
click node_propertiesctl "https://github.com/suhas1010/stayos/blob/main/server/src/controllers/property.controller.js"
click node_userstore "https://github.com/suhas1010/stayos/blob/main/server/src/models/user.models.js"
click node_propertystore "https://github.com/suhas1010/stayos/blob/main/server/src/models/property.models.js"
click node_roomstore "https://github.com/suhas1010/stayos/blob/main/server/src/models/room.models.js"
click node_tenantstore "https://github.com/suhas1010/stayos/blob/main/server/src/models/tenant.models.js"
click node_rentstore "https://github.com/suhas1010/stayos/blob/main/server/src/models/rent.models.js"
click node_complaintstore "https://github.com/suhas1010/stayos/blob/main/server/src/models/complaint.models.js"
click node_transactionstore "https://github.com/suhas1010/stayos/blob/main/server/src/models/transaction.models.js"
click node_email "https://github.com/suhas1010/stayos/blob/main/server/src/services/email.services.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_dashboard,node_propertiesui,node_propertydetail,node_roomsui,node_tenantsui,node_rentui,node_complaintsui,node_http toneBlue
class node_apiapp,node_authroutes,node_tenantroute,node_rentroute,node_complaintroute,node_transactionroute,node_access toneAmber
class node_tenantctl,node_rentctl,node_complaintctl,node_transactionctl,node_propertiesctl,node_email toneMint
class node_userstore,node_propertystore,node_roomstore,node_tenantstore,node_rentstore,node_complaintstore,node_transactionstore toneRose
class node_users toneIndigo
```

## Components

### Web application

- [Route shell](https://github.com/suhas1010/stayos/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Authentication state](https://github.com/suhas1010/stayos/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Dashboard](https://github.com/suhas1010/stayos/blob/main/client/src/pages/dashboard/Dashboard.jsx): `client/src/pages/dashboard/Dashboard.jsx`
- [Properties](https://github.com/suhas1010/stayos/blob/main/client/src/pages/properties/PropertiesList.jsx): `client/src/pages/properties/PropertiesList.jsx`
- [Property operations view](https://github.com/suhas1010/stayos/blob/main/client/src/pages/properties/PropertyDetails.jsx): `client/src/pages/properties/PropertyDetails.jsx`
- [Rooms](https://github.com/suhas1010/stayos/blob/main/client/src/pages/rooms/RoomsPage.jsx): `client/src/pages/rooms/RoomsPage.jsx`
- [Tenants](https://github.com/suhas1010/stayos/blob/main/client/src/pages/tenants/TenantsPage.jsx): `client/src/pages/tenants/TenantsPage.jsx`
- [Rent and payments](https://github.com/suhas1010/stayos/blob/main/client/src/pages/rent/RentPage.jsx): `client/src/pages/rent/RentPage.jsx`
- [Complaints](https://github.com/suhas1010/stayos/blob/main/client/src/pages/complaints/ComplaintsPage.jsx): `client/src/pages/complaints/ComplaintsPage.jsx`
- [HTTP client](https://github.com/suhas1010/stayos/blob/main/client/src/api/client.js): `client/src/api/client.js`

### API and access

- [Express API](https://github.com/suhas1010/stayos/blob/main/server/src/app.js): `server/src/app.js`
- [Authentication routes](https://github.com/suhas1010/stayos/blob/main/server/src/routes/auth.routes.js): `server/src/routes/auth.routes.js`
- [Tenant routes](https://github.com/suhas1010/stayos/blob/main/server/src/routes/tenant.routes.js): `server/src/routes/tenant.routes.js`
- [Rent routes](https://github.com/suhas1010/stayos/blob/main/server/src/routes/rent.routes.js): `server/src/routes/rent.routes.js`
- [Complaint routes](https://github.com/suhas1010/stayos/blob/main/server/src/routes/complaint.routes.js): `server/src/routes/complaint.routes.js`
- [Transaction routes](https://github.com/suhas1010/stayos/blob/main/server/src/routes/transaction.routes.js): `server/src/routes/transaction.routes.js`
- [Request access checks](https://github.com/suhas1010/stayos/blob/main/server/src/middlewares/ownership.middleware.js): `server/src/middlewares/ownership.middleware.js`

### Property operations

- [Tenant operations](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/tenant.controller.js): `server/src/controllers/tenant.controller.js`
- [Rent operations](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/rent.controller.js): `server/src/controllers/rent.controller.js`
- [Complaint operations](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/complaint.controller.js): `server/src/controllers/complaint.controller.js`
- [Transaction operations](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/transaction.controller.js): `server/src/controllers/transaction.controller.js`
- [Property operations](https://github.com/suhas1010/stayos/blob/main/server/src/controllers/property.controller.js): `server/src/controllers/property.controller.js`
- [Email service](https://github.com/suhas1010/stayos/blob/main/server/src/services/email.services.js): `server/src/services/email.services.js`

### Persistence

- [Users](https://github.com/suhas1010/stayos/blob/main/server/src/models/user.models.js): `server/src/models/user.models.js`
- [Properties](https://github.com/suhas1010/stayos/blob/main/server/src/models/property.models.js): `server/src/models/property.models.js`
- [Rooms](https://github.com/suhas1010/stayos/blob/main/server/src/models/room.models.js): `server/src/models/room.models.js`
- [Tenant records](https://github.com/suhas1010/stayos/blob/main/server/src/models/tenant.models.js): `server/src/models/tenant.models.js`
- [Rent records](https://github.com/suhas1010/stayos/blob/main/server/src/models/rent.models.js): `server/src/models/rent.models.js`
- [Complaints](https://github.com/suhas1010/stayos/blob/main/server/src/models/complaint.models.js): `server/src/models/complaint.models.js`
- [Transactions](https://github.com/suhas1010/stayos/blob/main/server/src/models/transaction.models.js): `server/src/models/transaction.models.js`

### Other components

- **Owner, caretaker, tenant**

## Connections

- Owner, caretaker, tenant → Route shell: use (evidence: `client/src/App.jsx`)
- Route shell → Authentication state: provides auth (evidence: `client/src/App.jsx`)
- Route shell → Dashboard: routes to (evidence: `client/src/App.jsx`)
- Route shell → Properties: routes to (evidence: `client/src/App.jsx`)
- Route shell → Property operations view: routes to (evidence: `client/src/App.jsx`)
- Route shell → Rooms: routes to (evidence: `client/src/App.jsx`)
- Route shell → Tenants: routes to (evidence: `client/src/App.jsx`)
- Route shell → Rent and payments: routes to (evidence: `client/src/App.jsx`)
- Route shell → Complaints: routes to (evidence: `client/src/App.jsx`)
- Authentication state → HTTP client: uses API (evidence: `client/src/context/AuthContext.jsx`)
- Owner, caretaker, tenant → HTTP client: make requests
- HTTP client → Express API: calls API
- Express API → Authentication routes: mounts (evidence: `server/src/app.js`)
- Express API → Tenant routes: mounts (evidence: `server/src/app.js`)
- Express API → Rent routes: mounts (evidence: `server/src/app.js`)
- Express API → Complaint routes: mounts (evidence: `server/src/app.js`)
- Express API → Transaction routes: mounts (evidence: `server/src/app.js`)
- Tenant routes → Tenant operations: dispatches (evidence: `server/src/routes/tenant.routes.js`)
- Tenant routes → Request access checks: checks access (evidence: `server/src/routes/tenant.routes.js`)
- Rent routes → Rent operations: dispatches (evidence: `server/src/routes/rent.routes.js`)
- Rent routes → Request access checks: checks access (evidence: `server/src/routes/rent.routes.js`)
- Complaint routes → Complaint operations: dispatches (evidence: `server/src/routes/complaint.routes.js`)
- Complaint routes → Request access checks: checks access (evidence: `server/src/routes/complaint.routes.js`)
- Transaction routes → Transaction operations: dispatches (evidence: `server/src/routes/transaction.routes.js`)
- Transaction routes → Request access checks: checks access (evidence: `server/src/routes/transaction.routes.js`)
- Tenant operations → Properties: reads (evidence: `server/src/controllers/tenant.controller.js`)
- Tenant operations → Users: reads and updates (evidence: `server/src/controllers/tenant.controller.js`)
- Tenant operations → Rooms: updates occupancy (evidence: `server/src/controllers/tenant.controller.js`)
- Tenant operations → Tenant records: reads and writes (evidence: `server/src/controllers/tenant.controller.js`)
- Tenant operations → Rent records: deletes records (evidence: `server/src/controllers/tenant.controller.js`)
- Tenant operations → Complaints: deletes records (evidence: `server/src/controllers/tenant.controller.js`)
- Rent operations → Properties: reads (evidence: `server/src/controllers/rent.controller.js`)
- Rent operations → Tenant records: reads (evidence: `server/src/controllers/rent.controller.js`)
- Rent operations → Rent records: reads and writes (evidence: `server/src/controllers/rent.controller.js`)
- Complaint operations → Complaints: reads and writes (evidence: `server/src/controllers/complaint.controller.js`)
- Transaction operations → Transactions: reads and writes (evidence: `server/src/controllers/transaction.controller.js`)
- Property operations → Properties: manages
- Authentication routes → Users: authenticates
- Authentication state → Email service: verification flow
