# aryallaxman99/communalstay architecture

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

- Interactive diagram: https://gitdiagram.com/aryallaxman99/communalstay
- Repository: https://github.com/aryallaxman99/communalstay

## Overview

CommunalStay is a React-and-Express marketplace for finding and listing stays, managing accounts, and making reservations. The main journey is browsing or searching stays, viewing a listing, booking it, and later reviewing or cancelling reservations; hosts can also manage listings and see booking requests. Separate account flows cover registration, login, profile updates, and OTP-based password recovery. README capabilities also include map-based location, nearby and flexible-place discovery, profile photos, and scrolling. The graph follows documented routes and sampled calls; several client features are documented but their implementation links are not shown.

Main entry points: [`client/src/Requests.js`](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Requests.js) (API requests), [`client/src/Containers/Layout/Layout.js`](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Layout/Layout.js) (Navigation and routes), [`server/index.js`](https://github.com/aryallaxman99/communalstay/blob/main/server/index.js) (Express API), [`server/controllers/reserveController.js`](https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/reserveController.js) (Reservation services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["React app<br/>[App.js]"]
  node_layout["Navigation and routes<br/>[Layout.js]"]
  node_stay_browse["Stay discovery<br/>[Places.jsx]"]
  node_stay_search["Stay search"]
  node_stay_detail["Stay details<br/>[PlacePage.jsx]"]
  node_stay_form["Host listing form<br/>[PlacesForm.jsx]"]
  node_booking_ui["Booking UI<br/>[BookingPage.jsx]"]
  node_map_discovery["Map discovery"]
  node_host_tools["Host dashboard<br/>[Dashboard.jsx]"]
  node_reservation_ui["Reservation management<br/>[ReservedPlaces.jsx]"]
  node_profile_ui["Profile and photos<br/>[Profile.jsx]"]
  node_api_requests["API requests<br/>[Requests.js]"]
end

subgraph group_server["API workflows"]
  node_api_server["Express API<br/>[index.js]"]
  node_places_routes["Stay routes<br/>[places.js]"]
  node_places_logic["Stay services"]
  node_reserve_routes["Reservation routes<br/>[reserve.js]"]
  node_reserve_logic["Reservation services"]
  node_upload_routes["Photo upload routes<br/>[uploadPhoto.js]"]
  node_upload_logic["Photo upload handler"]
end

subgraph group_data["Persistence"]
  node_user_model[("User records<br/>[UserModel.js]")]
  node_place_model[("Stay records<br/>[PlaceModel.js]")]
  node_reserve_model[("Reservation records<br/>[ReserveModel.js]")]
  node_otp_model[("OTP records<br/>[OtpModel.js]")]
end

subgraph group_auth["Identity and recovery"]
  node_auth_routes["Auth routes<br/>[auth.js]"]
  node_auth_logic["Account services<br/>[authController.js]"]
  node_otp_logic["OTP recovery<br/>[otpController.js]"]
  node_otp_delivery["SMS delivery<br/>[sendOTP.js]"]
  node_token_helper["Token handling<br/>[jwtHelper.js]"]
end

node_visitor(("Visitor"))
node_sms["Aakash SMS"]
node_maps_external["Google Maps"]

node_visitor -->|"opens"| node_app
node_app -->|"renders"| node_layout
node_layout -->|"routes to"| node_stay_browse
node_layout -->|"routes to"| node_stay_search
node_layout -->|"routes to"| node_stay_detail
node_layout -->|"routes to"| node_stay_form
node_layout -->|"routes to"| node_booking_ui
node_stay_browse -.->|"requests data"| node_api_requests
node_stay_search -.->|"requests search"| node_api_requests
node_stay_detail -.->|"requests details"| node_api_requests
node_booking_ui -.->|"submits booking"| node_api_requests
node_stay_form -.->|"submits listing"| node_api_requests
node_map_discovery -->|"requests stays"| node_api_requests
node_map_discovery -.->|"plots locations"| node_maps_external
node_api_requests -->|"calls API"| node_api_server
node_api_server -->|"mounts /auth"| node_auth_routes
node_api_server -->|"mounts /places"| node_places_routes
node_api_server -->|"mounts /reservation"| node_reserve_routes
node_api_server -->|"mounts /uploads"| node_upload_routes
node_auth_routes -->|"dispatches"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_user_model
node_auth_logic -->|"signs tokens"| node_token_helper
node_otp_logic -->|"sends codes"| node_otp_delivery
node_otp_logic -->|"updates accounts"| node_user_model
node_otp_delivery -->|"stores codes"| node_otp_model
node_otp_delivery -->|"sends SMS"| node_sms
node_places_routes -->|"dispatches"| node_places_logic
node_places_logic -->|"reads and writes"| node_place_model
node_reserve_routes -->|"dispatches"| node_reserve_logic
node_reserve_logic -->|"reads and writes"| node_reserve_model
node_reserve_logic -->|"checks capacity"| node_place_model
node_reserve_logic -->|"loads guest"| node_user_model
node_upload_routes -->|"dispatches"| node_upload_logic
node_host_tools -.->|"manages stays"| node_api_requests
node_reservation_ui -.->|"manages bookings"| node_api_requests
node_profile_ui -->|"updates profile"| node_api_requests

click node_app "https://github.com/aryallaxman99/communalstay/blob/main/client/src/App.js"
click node_layout "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Layout/Layout.js"
click node_stay_browse "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/Places.jsx"
click node_stay_search "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/SearchResultPage.jsx"
click node_stay_detail "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/PlacePage.jsx"
click node_stay_form "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/PlacesForm.jsx"
click node_booking_ui "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/BookingPage.jsx"
click node_map_discovery "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Components/maps/PlaceAddressPlot.js"
click node_host_tools "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Admin/Dashboard.jsx"
click node_reservation_ui "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Pages/ReservedPlaces.jsx"
click node_profile_ui "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/User/Profile.jsx"
click node_api_requests "https://github.com/aryallaxman99/communalstay/blob/main/client/src/Requests.js"
click node_api_server "https://github.com/aryallaxman99/communalstay/blob/main/server/index.js"
click node_auth_routes "https://github.com/aryallaxman99/communalstay/blob/main/server/routes/auth.js"
click node_auth_logic "https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/authController.js"
click node_otp_logic "https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/otpController.js"
click node_otp_delivery "https://github.com/aryallaxman99/communalstay/blob/main/server/services/sendOTP.js"
click node_places_routes "https://github.com/aryallaxman99/communalstay/blob/main/server/routes/places.js"
click node_places_logic "https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/placesController.js"
click node_reserve_routes "https://github.com/aryallaxman99/communalstay/blob/main/server/routes/reserve.js"
click node_reserve_logic "https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/reserveController.js"
click node_upload_routes "https://github.com/aryallaxman99/communalstay/blob/main/server/routes/uploadPhoto.js"
click node_upload_logic "https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/uploadPhotoController.js"
click node_user_model "https://github.com/aryallaxman99/communalstay/blob/main/server/models/UserModel.js"
click node_place_model "https://github.com/aryallaxman99/communalstay/blob/main/server/models/PlaceModel.js"
click node_reserve_model "https://github.com/aryallaxman99/communalstay/blob/main/server/models/ReserveModel.js"
click node_otp_model "https://github.com/aryallaxman99/communalstay/blob/main/server/models/OtpModel.js"
click node_token_helper "https://github.com/aryallaxman99/communalstay/blob/main/server/helpers/jwtHelper.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_layout,node_stay_browse,node_stay_search,node_stay_detail,node_stay_form,node_booking_ui,node_map_discovery,node_host_tools,node_reservation_ui,node_profile_ui,node_api_requests toneBlue
class node_api_server,node_places_routes,node_places_logic,node_reserve_routes,node_reserve_logic,node_upload_routes,node_upload_logic toneAmber
class node_user_model,node_place_model,node_reserve_model,node_otp_model toneMint
class node_auth_routes,node_auth_logic,node_otp_logic,node_otp_delivery,node_token_helper toneRose
class node_visitor,node_sms,node_maps_external toneIndigo
```

## Components

### Client experience

- [React app](https://github.com/aryallaxman99/communalstay/blob/main/client/src/App.js): `client/src/App.js`
- [Navigation and routes](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Layout/Layout.js): `client/src/Containers/Layout/Layout.js`
- [Stay discovery](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/Places.jsx): `client/src/Containers/Places/Places.jsx`
- [Stay search](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/SearchResultPage.jsx): `client/src/Containers/Places/SearchResultPage.jsx`
- [Stay details](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/PlacePage.jsx): `client/src/Containers/Places/PlacePage.jsx`
- [Host listing form](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/PlacesForm.jsx): `client/src/Containers/Places/PlacesForm.jsx`
- [Booking UI](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Places/BookingPage.jsx): `client/src/Containers/Places/BookingPage.jsx`
- [Map discovery](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Components/maps/PlaceAddressPlot.js): `client/src/Components/maps/PlaceAddressPlot.js`
- [Host dashboard](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Admin/Dashboard.jsx): `client/src/Containers/Admin/Dashboard.jsx`
- [Reservation management](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/Pages/ReservedPlaces.jsx): `client/src/Containers/Pages/ReservedPlaces.jsx`
- [Profile and photos](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Containers/User/Profile.jsx): `client/src/Containers/User/Profile.jsx`
- [API requests](https://github.com/aryallaxman99/communalstay/blob/main/client/src/Requests.js): `client/src/Requests.js`

### API workflows

- [Express API](https://github.com/aryallaxman99/communalstay/blob/main/server/index.js): `server/index.js`
- [Stay routes](https://github.com/aryallaxman99/communalstay/blob/main/server/routes/places.js): `server/routes/places.js`
- [Stay services](https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/placesController.js): `server/controllers/placesController.js`
- [Reservation routes](https://github.com/aryallaxman99/communalstay/blob/main/server/routes/reserve.js): `server/routes/reserve.js`
- [Reservation services](https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/reserveController.js): `server/controllers/reserveController.js`
- [Photo upload routes](https://github.com/aryallaxman99/communalstay/blob/main/server/routes/uploadPhoto.js): `server/routes/uploadPhoto.js`
- [Photo upload handler](https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/uploadPhotoController.js): `server/controllers/uploadPhotoController.js`

### Persistence

- [User records](https://github.com/aryallaxman99/communalstay/blob/main/server/models/UserModel.js): `server/models/UserModel.js`
- [Stay records](https://github.com/aryallaxman99/communalstay/blob/main/server/models/PlaceModel.js): `server/models/PlaceModel.js`
- [Reservation records](https://github.com/aryallaxman99/communalstay/blob/main/server/models/ReserveModel.js): `server/models/ReserveModel.js`
- [OTP records](https://github.com/aryallaxman99/communalstay/blob/main/server/models/OtpModel.js): `server/models/OtpModel.js`

### Identity and recovery

- [Auth routes](https://github.com/aryallaxman99/communalstay/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Account services](https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [OTP recovery](https://github.com/aryallaxman99/communalstay/blob/main/server/controllers/otpController.js): `server/controllers/otpController.js`
- [SMS delivery](https://github.com/aryallaxman99/communalstay/blob/main/server/services/sendOTP.js): `server/services/sendOTP.js`
- [Token handling](https://github.com/aryallaxman99/communalstay/blob/main/server/helpers/jwtHelper.js): `server/helpers/jwtHelper.js`

### Other components

- **Visitor**
- **Aakash SMS**
- **Google Maps**

## Connections

- Visitor → React app: opens (evidence: `client/src/App.js`)
- React app → Navigation and routes: renders (evidence: `client/src/App.js`)
- Navigation and routes → Stay discovery: routes to (evidence: `client/src/Containers/Layout/Layout.js`)
- Navigation and routes → Stay search: routes to (evidence: `client/src/Containers/Layout/Layout.js`)
- Navigation and routes → Stay details: routes to (evidence: `client/src/Containers/Layout/Layout.js`)
- Navigation and routes → Host listing form: routes to (evidence: `client/src/Containers/Layout/Layout.js`)
- Navigation and routes → Booking UI: routes to (evidence: `client/src/Containers/Layout/Layout.js`)
- Stay discovery → API requests: requests data
- Stay search → API requests: requests search
- Stay details → API requests: requests details
- Booking UI → API requests: submits booking
- Host listing form → API requests: submits listing
- Map discovery → API requests: requests stays (evidence: `client/src/Components/maps/PlaceAddressPlot.js`)
- Map discovery → Google Maps: plots locations
- API requests → Express API: calls API (evidence: `client/src/Requests.js`)
- Express API → Auth routes: mounts /auth (evidence: `server/index.js`)
- Express API → Stay routes: mounts /places (evidence: `server/index.js`)
- Express API → Reservation routes: mounts /reservation (evidence: `server/index.js`)
- Express API → Photo upload routes: mounts /uploads (evidence: `server/index.js`)
- Auth routes → Account services: dispatches (evidence: `server/routes/auth.js`)
- Account services → User records: reads and writes (evidence: `server/controllers/authController.js`)
- Account services → Token handling: signs tokens (evidence: `server/controllers/authController.js`)
- OTP recovery → SMS delivery: sends codes (evidence: `server/controllers/otpController.js`)
- OTP recovery → User records: updates accounts (evidence: `server/controllers/otpController.js`)
- SMS delivery → OTP records: stores codes (evidence: `server/services/sendOTP.js`)
- SMS delivery → Aakash SMS: sends SMS (evidence: `server/services/sendOTP.js`)
- Stay routes → Stay services: dispatches (evidence: `server/routes/places.js`)
- Stay services → Stay records: reads and writes (evidence: `server/controllers/placesController.js`)
- Reservation routes → Reservation services: dispatches (evidence: `server/routes/reserve.js`)
- Reservation services → Reservation records: reads and writes (evidence: `server/controllers/reserveController.js`)
- Reservation services → Stay records: checks capacity (evidence: `server/controllers/reserveController.js`)
- Reservation services → User records: loads guest (evidence: `server/controllers/reserveController.js`)
- Photo upload routes → Photo upload handler: dispatches (evidence: `server/routes/uploadPhoto.js`)
- Host dashboard → API requests: manages stays
- Reservation management → API requests: manages bookings
- Profile and photos → API requests: updates profile (evidence: `client/src/Containers/User/Profile.jsx`)
