# mehedi-hasan-raju/mhr-travel-website architecture

> Architecture diagram of the GitHub repository mehedi-hasan-raju/mhr-travel-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehedi-hasan-raju/mhr-travel-website
- Repository: https://github.com/mehedi-hasan-raju/mhr-travel-website

## Overview

MHR is a vacation-rental marketplace: visitors browse and map listings, then proceed toward booking/payment; hosts manage listings, and users can register, maintain profiles, and review stays. The Express app mounts separate listing, review, booking, host, and user routes, with MongoDB-backed models and sessions. Mapping and Cloudinary uploads are visible capabilities. Booking and host implementations, and most listing-controller behavior, were not sampled, so their internal calls are left unspecified.

Main entry points: [`app.js`](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/app.js) (Express application), [`routes/listing.js`](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/listing.js) (Listing routes), [`controllers/users.js`](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/users.js) (Account operations), [`controllers/listings.js`](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/listings.js) (Listing operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Express application<br/>[app.js]"]
  node_listing_routes["Listing routes<br/>[listing.js]"]
  node_listing_views["Listing pages"]
  node_map_ui["Listing map<br/>[map.js]"]
  node_booking_pages["Booking pages"]
  node_host_page["Host dashboard<br/>[dashboard.ejs]"]
  node_user_pages["Account pages"]
end

subgraph group_stay["Stays and bookings"]
  node_listing_controller["Listing operations<br/>[listings.js]"]
  node_listing_model[("Listing records<br/>[listing.js]")]
  node_booking_routes["Booking routes<br/>[booking.js]"]
  node_booking_model[("Booking records<br/>[booking.js]")]
  node_host_routes["Host routes<br/>[host.js]"]
end

subgraph group_identity["Accounts and reviews"]
  node_user_routes["User routes<br/>[user.js]"]
  node_user_controller["Account operations<br/>[users.js]"]
  node_user_model[("User records<br/>[user.js]")]
  node_review_routes["Review routes<br/>[review.js]"]
  node_review_controller["Review operations<br/>[reviews.js]"]
  node_review_model[("Review records<br/>[review.js]")]
end

subgraph group_integrations["External services"]
  node_mongo[("MongoDB")]
  node_cloudinary["Cloudinary media"]
  node_mapbox["Mapbox maps"]
end

node_traveler(("Traveler or host"))

node_traveler -->|"sends requests"| node_app
node_app -->|"mounts"| node_listing_routes
node_app -->|"mounts"| node_booking_routes
node_app -->|"mounts"| node_host_routes
node_app -->|"mounts"| node_user_routes
node_app -->|"mounts"| node_review_routes
node_listing_routes -->|"dispatches"| node_listing_controller
node_listing_routes -->|"loads payment listing"| node_listing_model
node_listing_routes -->|"renders payment page"| node_listing_views
node_listing_controller -->|"operates on"| node_listing_model
node_listing_controller -.->|"uploads media"| node_cloudinary
node_map_ui -->|"renders map"| node_mapbox
node_booking_routes -->|"booking operations"| node_booking_model
node_booking_routes -->|"serves booking pages"| node_booking_pages
node_host_routes -->|"serves dashboard"| node_host_page
node_user_routes -->|"dispatches"| node_user_controller
node_user_controller -->|"reads and updates"| node_user_model
node_user_controller -->|"loads trip bookings"| node_booking_model
node_user_controller -->|"renders account pages"| node_user_pages
node_review_routes -->|"dispatches"| node_review_controller
node_review_controller -->|"updates listing reviews"| node_listing_model
node_review_controller -->|"creates and deletes"| node_review_model
node_app -->|"connects and stores sessions"| node_mongo

click node_app "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/app.js"
click node_listing_routes "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/listing.js"
click node_listing_controller "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/listings.js"
click node_listing_model "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/listing.js"
click node_listing_views "https://github.com/mehedi-hasan-raju/mhr-travel-website/tree/main/views/listings"
click node_map_ui "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/public/js/map.js"
click node_booking_routes "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/booking.js"
click node_booking_model "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/booking.js"
click node_booking_pages "https://github.com/mehedi-hasan-raju/mhr-travel-website/tree/main/views/bookings"
click node_host_routes "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/host.js"
click node_host_page "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/views/host/dashboard.ejs"
click node_user_routes "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/user.js"
click node_user_controller "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/users.js"
click node_user_model "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/user.js"
click node_user_pages "https://github.com/mehedi-hasan-raju/mhr-travel-website/tree/main/views/users"
click node_review_routes "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/review.js"
click node_review_controller "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/reviews.js"
click node_review_model "https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/review.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_listing_routes,node_listing_views,node_map_ui,node_booking_pages,node_host_page,node_user_pages toneBlue
class node_listing_controller,node_listing_model,node_booking_routes,node_booking_model,node_host_routes toneAmber
class node_user_routes,node_user_controller,node_user_model,node_review_routes,node_review_controller,node_review_model toneMint
class node_mongo,node_cloudinary,node_mapbox toneRose
class node_traveler toneIndigo
```

## Components

### Web application

- [Express application](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/listing.js): `routes/listing.js`
- [Listing pages](https://github.com/mehedi-hasan-raju/mhr-travel-website/tree/main/views/listings): `views/listings`
- [Listing map](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/public/js/map.js): `public/js/map.js`
- [Booking pages](https://github.com/mehedi-hasan-raju/mhr-travel-website/tree/main/views/bookings): `views/bookings`
- [Host dashboard](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/views/host/dashboard.ejs): `views/host/dashboard.ejs`
- [Account pages](https://github.com/mehedi-hasan-raju/mhr-travel-website/tree/main/views/users): `views/users`

### Stays and bookings

- [Listing operations](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/listings.js): `controllers/listings.js`
- [Listing records](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/listing.js): `models/listing.js`
- [Booking routes](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/booking.js): `routes/booking.js`
- [Booking records](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/booking.js): `models/booking.js`
- [Host routes](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/host.js): `routes/host.js`

### Accounts and reviews

- [User routes](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/user.js): `routes/user.js`
- [Account operations](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/users.js): `controllers/users.js`
- [User records](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/user.js): `models/user.js`
- [Review routes](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/routes/review.js): `routes/review.js`
- [Review operations](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/controllers/reviews.js): `controllers/reviews.js`
- [Review records](https://github.com/mehedi-hasan-raju/mhr-travel-website/blob/main/models/review.js): `models/review.js`

### External services

- **MongoDB**
- **Cloudinary media**
- **Mapbox maps**

### Other components

- **Traveler or host**

## Connections

- Traveler or host → Express application: sends requests
- Express application → Listing routes: mounts
- Express application → Booking routes: mounts
- Express application → Host routes: mounts
- Express application → User routes: mounts
- Express application → Review routes: mounts
- Listing routes → Listing operations: dispatches
- Listing routes → Listing records: loads payment listing
- Listing routes → Listing pages: renders payment page
- Listing operations → Listing records: operates on
- Listing operations → Cloudinary media: uploads media
- Listing map → Mapbox maps: renders map
- Booking routes → Booking records: booking operations
- Booking routes → Booking pages: serves booking pages
- Host routes → Host dashboard: serves dashboard
- User routes → Account operations: dispatches
- Account operations → User records: reads and updates
- Account operations → Booking records: loads trip bookings
- Account operations → Account pages: renders account pages
- Review routes → Review operations: dispatches
- Review operations → Listing records: updates listing reviews
- Review operations → Review records: creates and deletes
- Express application → MongoDB: connects and stores sessions
