# tanvir-100/rental-platform architecture

> Architecture diagram of the GitHub repository tanvir-100/rental-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanvir-100/rental-platform
- Repository: https://github.com/tanvir-100/rental-platform

## Overview

Keyhold connects tenants and property owners through account/property setup, maintenance tracking, and amenity booking. Dashboards use REST data and receive targeted live maintenance updates; booking availability is checked in the interface and enforced atomically by the backend. The graph reflects documented behavior plus sampled entry points; detailed wiring inside unsampled route handlers is intentionally limited to what the README establishes.

Main entry points: [`backend/server.js`](https://github.com/tanvir-100/rental-platform/blob/main/backend/server.js) (Express and Socket server), [`frontend/src/App.jsx`](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/App.jsx) (Role dashboards), [`frontend/src/api/axios.js`](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/api/axios.js) (Authenticated API client), [`frontend/src/pages/TenantDashboard.jsx`](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/pages/TenantDashboard.jsx) (Tenant dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Role dashboards<br/>[App.jsx]"]
  node_authui["Login and registration<br/>[AuthContext.jsx]"]
  node_tenantdash["Tenant dashboard"]
  node_ownerdash["Owner dashboard<br/>[OwnerDashboard.jsx]"]
  node_maintui["Maintenance forms and lists"]
  node_bookingui["Amenity slot booking"]
  node_api_client["Authenticated API client<br/>[axios.js]"]
  node_socket_client["Socket connection<br/>[SocketContext.jsx]"]
end

subgraph group_api["API and access"]
  node_server["Express and Socket server<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_authmw["JWT and role checks<br/>[auth.js]"]
end

subgraph group_domain["Rental operations"]
  node_propertyroutes["Property routes<br/>[properties.js]"]
  node_maintenance["Maintenance requests<br/>[maintenance.js]"]
  node_amenities["Amenity management<br/>[amenities.js]"]
  node_bookings["Booking and conflict checks<br/>[bookings.js]"]
  node_users["Tenant management<br/>[users.js]"]
end

subgraph group_state["Persistence and realtime"]
  node_user_model[("User records<br/>[User.js]")]
  node_property_model[("Property records<br/>[Property.js]")]
  node_maintenance_model[("Maintenance records")]
  node_amenity_model[("Amenity records<br/>[Amenity.js]")]
  node_booking_model[("Booking records<br/>[AmenityBooking.js]")]
end

node_tenant(("Tenant"))
node_owner(("Property owner"))
node_mongo[("MongoDB")]
node_socketio["Socket.io transport"]

node_tenant -->|"uses"| node_app
node_owner -->|"uses"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_tenantdash
node_app -->|"routes to"| node_ownerdash
node_authui -->|"sends credentials"| node_api_client
node_tenantdash -->|"requests data"| node_api_client
node_ownerdash -->|"requests data"| node_api_client
node_tenantdash -->|"renders"| node_maintui
node_tenantdash -->|"renders"| node_bookingui
node_bookingui -->|"loads and books"| node_api_client
node_maintui -->|"submits requests"| node_api_client
node_app -->|"provides"| node_socket_client
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_propertyroutes
node_server -->|"mounts"| node_maintenance
node_server -->|"mounts"| node_amenities
node_server -->|"mounts"| node_bookings
node_server -->|"mounts"| node_users
node_api_client -->|"HTTP requests"| node_server
node_socket_client -->|"connects"| node_server
node_server -->|"uses"| node_authmw
node_authroutes -->|"reads and creates"| node_user_model
node_authroutes -->|"creates or reads"| node_property_model
node_authmw -->|"loads user"| node_user_model
node_propertyroutes -->|"reads and writes"| node_property_model
node_maintenance -->|"reads and writes"| node_maintenance_model
node_amenities -->|"reads and writes"| node_amenity_model
node_bookings -->|"checks and creates"| node_booking_model
node_bookings -->|"checks amenity"| node_amenity_model
node_users -->|"manages tenants"| node_user_model
node_user_model -->|"persists"| node_mongo
node_property_model -->|"persists"| node_mongo
node_maintenance_model -->|"persists"| node_mongo
node_amenity_model -->|"persists"| node_mongo
node_booking_model -->|"persists"| node_mongo
node_maintenance -->|"emits updates"| node_socketio
node_socket_client -->|"joins rooms"| node_socketio
node_socketio -->|"delivers live events"| node_tenantdash
node_socketio -->|"delivers live events"| node_ownerdash

click node_app "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/context/AuthContext.jsx"
click node_tenantdash "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/pages/TenantDashboard.jsx"
click node_ownerdash "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/pages/OwnerDashboard.jsx"
click node_maintui "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/components/MaintenanceForm.jsx"
click node_bookingui "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/components/AmenityBookingPanel.jsx"
click node_api_client "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/api/axios.js"
click node_socket_client "https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/context/SocketContext.jsx"
click node_server "https://github.com/tanvir-100/rental-platform/blob/main/backend/server.js"
click node_authroutes "https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/auth.js"
click node_authmw "https://github.com/tanvir-100/rental-platform/blob/main/backend/middleware/auth.js"
click node_propertyroutes "https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/properties.js"
click node_maintenance "https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/maintenance.js"
click node_amenities "https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/amenities.js"
click node_bookings "https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/bookings.js"
click node_users "https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/users.js"
click node_user_model "https://github.com/tanvir-100/rental-platform/blob/main/backend/models/User.js"
click node_property_model "https://github.com/tanvir-100/rental-platform/blob/main/backend/models/Property.js"
click node_maintenance_model "https://github.com/tanvir-100/rental-platform/blob/main/backend/models/MaintenanceRequest.js"
click node_amenity_model "https://github.com/tanvir-100/rental-platform/blob/main/backend/models/Amenity.js"
click node_booking_model "https://github.com/tanvir-100/rental-platform/blob/main/backend/models/AmenityBooking.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_tenantdash,node_ownerdash,node_maintui,node_bookingui,node_api_client,node_socket_client toneBlue
class node_server,node_authroutes,node_authmw,node_mongo toneAmber
class node_propertyroutes,node_maintenance,node_amenities,node_bookings,node_users toneMint
class node_user_model,node_property_model,node_maintenance_model,node_amenity_model,node_booking_model toneRose
class node_tenant,node_owner,node_socketio toneIndigo
```

## Components

### Web client

- [Role dashboards](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and registration](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Tenant dashboard](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/pages/TenantDashboard.jsx): `frontend/src/pages/TenantDashboard.jsx`
- [Owner dashboard](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/pages/OwnerDashboard.jsx): `frontend/src/pages/OwnerDashboard.jsx`
- [Maintenance forms and lists](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/components/MaintenanceForm.jsx): `frontend/src/components/MaintenanceForm.jsx`
- [Amenity slot booking](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/components/AmenityBookingPanel.jsx): `frontend/src/components/AmenityBookingPanel.jsx`
- [Authenticated API client](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`
- [Socket connection](https://github.com/tanvir-100/rental-platform/blob/main/frontend/src/context/SocketContext.jsx): `frontend/src/context/SocketContext.jsx`

### API and access

- [Express and Socket server](https://github.com/tanvir-100/rental-platform/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [JWT and role checks](https://github.com/tanvir-100/rental-platform/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Rental operations

- [Property routes](https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/properties.js): `backend/routes/properties.js`
- [Maintenance requests](https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/maintenance.js): `backend/routes/maintenance.js`
- [Amenity management](https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/amenities.js): `backend/routes/amenities.js`
- [Booking and conflict checks](https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/bookings.js): `backend/routes/bookings.js`
- [Tenant management](https://github.com/tanvir-100/rental-platform/blob/main/backend/routes/users.js): `backend/routes/users.js`

### Persistence and realtime

- [User records](https://github.com/tanvir-100/rental-platform/blob/main/backend/models/User.js): `backend/models/User.js`
- [Property records](https://github.com/tanvir-100/rental-platform/blob/main/backend/models/Property.js): `backend/models/Property.js`
- [Maintenance records](https://github.com/tanvir-100/rental-platform/blob/main/backend/models/MaintenanceRequest.js): `backend/models/MaintenanceRequest.js`
- [Amenity records](https://github.com/tanvir-100/rental-platform/blob/main/backend/models/Amenity.js): `backend/models/Amenity.js`
- [Booking records](https://github.com/tanvir-100/rental-platform/blob/main/backend/models/AmenityBooking.js): `backend/models/AmenityBooking.js`

### Other components

- **Tenant**
- **Property owner**
- **MongoDB**
- **Socket.io transport**

## Connections

- Tenant → Role dashboards: uses
- Property owner → Role dashboards: uses
- Role dashboards → Login and registration: routes to
- Role dashboards → Tenant dashboard: routes to
- Role dashboards → Owner dashboard: routes to
- Login and registration → Authenticated API client: sends credentials
- Tenant dashboard → Authenticated API client: requests data
- Owner dashboard → Authenticated API client: requests data
- Tenant dashboard → Maintenance forms and lists: renders
- Tenant dashboard → Amenity slot booking: renders
- Amenity slot booking → Authenticated API client: loads and books
- Maintenance forms and lists → Authenticated API client: submits requests
- Role dashboards → Socket connection: provides
- Express and Socket server → Authentication routes: mounts
- Express and Socket server → Property routes: mounts
- Express and Socket server → Maintenance requests: mounts
- Express and Socket server → Amenity management: mounts
- Express and Socket server → Booking and conflict checks: mounts
- Express and Socket server → Tenant management: mounts
- Authenticated API client → Express and Socket server: HTTP requests
- Socket connection → Express and Socket server: connects
- Express and Socket server → JWT and role checks: uses
- Authentication routes → User records: reads and creates
- Authentication routes → Property records: creates or reads
- JWT and role checks → User records: loads user
- Property routes → Property records: reads and writes
- Maintenance requests → Maintenance records: reads and writes
- Amenity management → Amenity records: reads and writes
- Booking and conflict checks → Booking records: checks and creates
- Booking and conflict checks → Amenity records: checks amenity
- Tenant management → User records: manages tenants
- User records → MongoDB: persists
- Property records → MongoDB: persists
- Maintenance records → MongoDB: persists
- Amenity records → MongoDB: persists
- Booking records → MongoDB: persists
- Maintenance requests → Socket.io transport: emits updates
- Socket connection → Socket.io transport: joins rooms
- Socket.io transport → Tenant dashboard: delivers live events
- Socket.io transport → Owner dashboard: delivers live events
