# shanmugamsanthu/airbnb-clone architecture

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

- Interactive diagram: https://gitdiagram.com/shanmugamsanthu/airbnb-clone
- Repository: https://github.com/shanmugamsanthu/airbnb-clone

## Overview

This is a full-stack Airbnb-style listing and booking application. Users browse listings, view details, authenticate, create or manage listings and reviews, and book available date ranges; customers and listing owners can review and cancel bookings. The Vue router connects the main screens, while Express routes dispatch API-style requests to controllers, which validate and operate on MongoDB models. The README documents image uploads, authorization, and cancellation rules. Some view-to-backend wiring is dynamic or not shown, so only documented frontend/API communication is included; unsampled subsystem links are omitted where their callers are not evidenced.

Main entry points: [`router.js`](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/router.js) (Screen router), [`server.js`](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/server.js) (HTTP server), [`controller/listingControl.js`](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/listingControl.js) (Listing operations), [`controller/bookingControl.js`](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/bookingControl.js) (Booking operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Vue application"]
  node_router["Screen router<br/>[router.js]"]
  node_listing_screen["Listing screens<br/>[listings.vue]"]
  node_listing_detail["Listing detail<br/>[displayById.vue]"]
  node_listing_forms["Listing forms<br/>[createForm.vue]"]
  node_edit_screen["Edit listing<br/>[editPage.vue]"]
  node_review_screen["Review form<br/>[reviewForm.vue]"]
  node_auth_screens["Account screens<br/>[loginpage.vue]"]
  node_booking_screens["Booking screens<br/>[myBookings.vue]"]
  node_manage_screen["Manage bookings<br/>[manageBookings.vue]"]
  node_client_validation["UX validation<br/>[uxValidation.js]"]
end

subgraph group_api["Express API"]
  node_api_server["HTTP server<br/>[server.js]"]
  node_listing_routes["Listing routes<br/>[listingRoutes.js]"]
  node_review_routes["Review routes<br/>[reviewRoutes.js]"]
  node_booking_routes["Booking routes<br/>[bookingRoute.js]"]
  node_user_routes["Account routes"]
  node_middleware["Auth and validation"]
end

subgraph group_domain["Listing domain"]
  node_listing_control["Listing operations<br/>[listingControl.js]"]
  node_review_control["Review operations<br/>[reviewControl.js]"]
  node_user_control["Account operations<br/>[userControl.js]"]
end

subgraph group_booking["Booking domain"]
  node_booking_control["Booking operations<br/>[bookingControl.js]"]
  node_booking_dates["Date calculations<br/>[calculateDays.js]"]
end

subgraph group_persistence["MongoDB and media"]
  node_listing_store[("Listing records<br/>[listingsSchema.js]")]
  node_review_store[("Review records")]
  node_booking_store[("Booking records<br/>[bookingSchema.js]")]
  node_account_store[("User accounts")]
  node_cloudinary["Cloudinary images<br/>[cloudinary.js]"]
end

node_visitor(("User"))

node_visitor -->|"navigates"| node_router
node_router -->|"routes to"| node_listing_screen
node_router -->|"routes to"| node_listing_detail
node_router -->|"routes to"| node_listing_forms
node_router -->|"routes to"| node_edit_screen
node_router -->|"routes to"| node_review_screen
node_router -->|"routes to"| node_auth_screens
node_router -->|"routes to"| node_booking_screens
node_router -->|"routes to"| node_manage_screen
node_listing_forms -->|"validates with"| node_client_validation
node_edit_screen -->|"validates with"| node_client_validation
node_review_screen -->|"validates with"| node_client_validation
node_auth_screens -->|"validates with"| node_client_validation
node_router -->|"fetches API"| node_api_server
node_api_server -->|"mounts"| node_listing_routes
node_api_server -->|"mounts"| node_review_routes
node_api_server -->|"mounts"| node_booking_routes
node_api_server -->|"mounts"| node_user_routes
node_listing_routes -->|"guards and validates"| node_middleware
node_review_routes -->|"guards and validates"| node_middleware
node_listing_routes -->|"dispatches to"| node_listing_control
node_review_routes -->|"dispatches to"| node_review_control
node_booking_routes -->|"dispatches to"| node_booking_control
node_user_routes -->|"dispatches to"| node_user_control
node_listing_control -->|"reads and writes"| node_listing_store
node_listing_control -->|"cleans up reviews"| node_review_store
node_listing_control -->|"manages images"| node_cloudinary
node_review_control -->|"reads and writes"| node_review_store
node_user_control -->|"reads and writes"| node_account_store
node_booking_control -->|"reads and writes"| node_booking_store
node_booking_control -->|"checks listing"| node_listing_store
node_booking_control -->|"calculates duration"| node_booking_dates

click node_router "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/router.js"
click node_listing_screen "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/listings.vue"
click node_listing_detail "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/displayById.vue"
click node_listing_forms "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/createForm.vue"
click node_edit_screen "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/editPage.vue"
click node_review_screen "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/reviewForm.vue"
click node_auth_screens "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/loginpage.vue"
click node_booking_screens "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/myBookings.vue"
click node_manage_screen "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/manageBookings.vue"
click node_client_validation "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/ClientSchema/uxValidation.js"
click node_api_server "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/server.js"
click node_listing_routes "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/listingRoutes.js"
click node_review_routes "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/reviewRoutes.js"
click node_booking_routes "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/bookingRoute.js"
click node_user_routes "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/userAccountRoute.js"
click node_middleware "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/customMiddlewares.js"
click node_listing_control "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/listingControl.js"
click node_review_control "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/reviewControl.js"
click node_user_control "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/userControl.js"
click node_booking_control "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/bookingControl.js"
click node_booking_dates "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/utils/calculateDays.js"
click node_listing_store "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/listingsSchema.js"
click node_review_store "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/listingReviewSchema.js"
click node_booking_store "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/bookingSchema.js"
click node_account_store "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/userAccountSchema.js"
click node_cloudinary "https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/cloudinary.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_router,node_listing_screen,node_listing_detail,node_listing_forms,node_edit_screen,node_review_screen,node_auth_screens,node_booking_screens,node_manage_screen,node_client_validation,node_visitor toneBlue
class node_api_server,node_listing_routes,node_review_routes,node_booking_routes,node_user_routes,node_middleware toneAmber
class node_listing_control,node_review_control,node_user_control toneMint
class node_booking_control,node_booking_dates toneRose
class node_listing_store,node_review_store,node_booking_store,node_account_store,node_cloudinary toneIndigo
```

## Components

### Vue application

- [Screen router](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/router.js): `router.js`
- [Listing screens](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/listings.vue): `views/listings.vue`
- [Listing detail](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/displayById.vue): `views/displayById.vue`
- [Listing forms](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/createForm.vue): `views/createForm.vue`
- [Edit listing](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/editPage.vue): `views/editPage.vue`
- [Review form](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/reviewForm.vue): `views/reviewForm.vue`
- [Account screens](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/loginpage.vue): `views/loginpage.vue`
- [Booking screens](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/myBookings.vue): `views/myBookings.vue`
- [Manage bookings](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/views/manageBookings.vue): `views/manageBookings.vue`
- [UX validation](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/ClientSchema/uxValidation.js): `ClientSchema/uxValidation.js`

### Express API

- [HTTP server](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/server.js): `server.js`
- [Listing routes](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/listingRoutes.js): `routes/listingRoutes.js`
- [Review routes](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/reviewRoutes.js): `routes/reviewRoutes.js`
- [Booking routes](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/bookingRoute.js): `routes/bookingRoute.js`
- [Account routes](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/routes/userAccountRoute.js): `routes/userAccountRoute.js`
- [Auth and validation](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/customMiddlewares.js): `customMiddlewares.js`

### Listing domain

- [Listing operations](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/listingControl.js): `controller/listingControl.js`
- [Review operations](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/reviewControl.js): `controller/reviewControl.js`
- [Account operations](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/userControl.js): `controller/userControl.js`

### Booking domain

- [Booking operations](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/controller/bookingControl.js): `controller/bookingControl.js`
- [Date calculations](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/utils/calculateDays.js): `utils/calculateDays.js`

### MongoDB and media

- [Listing records](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/listingsSchema.js): `config_DB/models/listingsSchema.js`
- [Review records](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/listingReviewSchema.js): `config_DB/models/listingReviewSchema.js`
- [Booking records](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/bookingSchema.js): `config_DB/models/bookingSchema.js`
- [User accounts](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/models/userAccountSchema.js): `config_DB/models/userAccountSchema.js`
- [Cloudinary images](https://github.com/shanmugamsanthu/airbnb-clone/blob/main/config_DB/cloudinary.js): `config_DB/cloudinary.js`

### Other components

- **User**

## Connections

- User → Screen router: navigates (evidence: `router.js`)
- Screen router → Listing screens: routes to (evidence: `router.js`)
- Screen router → Listing detail: routes to (evidence: `router.js`)
- Screen router → Listing forms: routes to (evidence: `router.js`)
- Screen router → Edit listing: routes to (evidence: `router.js`)
- Screen router → Review form: routes to (evidence: `router.js`)
- Screen router → Account screens: routes to (evidence: `router.js`)
- Screen router → Booking screens: routes to (evidence: `router.js`)
- Screen router → Manage bookings: routes to (evidence: `router.js`)
- Listing forms → UX validation: validates with (evidence: `views/createForm.vue`)
- Edit listing → UX validation: validates with (evidence: `views/editPage.vue`)
- Review form → UX validation: validates with (evidence: `views/reviewForm.vue`)
- Account screens → UX validation: validates with (evidence: `views/loginpage.vue`)
- Screen router → HTTP server: fetches API
- HTTP server → Listing routes: mounts (evidence: `server.js`)
- HTTP server → Review routes: mounts (evidence: `server.js`)
- HTTP server → Booking routes: mounts (evidence: `server.js`)
- HTTP server → Account routes: mounts (evidence: `server.js`)
- Listing routes → Auth and validation: guards and validates (evidence: `routes/listingRoutes.js`)
- Review routes → Auth and validation: guards and validates (evidence: `routes/reviewRoutes.js`)
- Listing routes → Listing operations: dispatches to (evidence: `routes/listingRoutes.js`)
- Review routes → Review operations: dispatches to (evidence: `routes/reviewRoutes.js`)
- Booking routes → Booking operations: dispatches to (evidence: `routes/bookingRoute.js`)
- Account routes → Account operations: dispatches to (evidence: `routes/userAccountRoute.js`)
- Listing operations → Listing records: reads and writes (evidence: `controller/listingControl.js`)
- Listing operations → Review records: cleans up reviews (evidence: `controller/listingControl.js`)
- Listing operations → Cloudinary images: manages images (evidence: `controller/listingControl.js`)
- Review operations → Review records: reads and writes (evidence: `controller/reviewControl.js`)
- Account operations → User accounts: reads and writes (evidence: `controller/userControl.js`)
- Booking operations → Booking records: reads and writes (evidence: `controller/bookingControl.js`)
- Booking operations → Listing records: checks listing (evidence: `controller/bookingControl.js`)
- Booking operations → Date calculations: calculates duration (evidence: `controller/bookingControl.js`)
