# vivek-63/mern-project architecture

> Architecture diagram of the GitHub repository vivek-63/mern-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vivek-63/mern-project
- Repository: https://github.com/vivek-63/mern-project

## Overview

Voyago is an Express/Mongoose accommodation-booking platform. Guests browse and search listings, inspect location and booking details, then use account and booking features; hosts manage listings and booking requests, while admins manage platform activity. The graph includes documented reviews, dashboards, maps, nearby places, and image storage. Several controllers and route files were not sampled, so their relationships are shown only where the README documents the capability; those links are dashed and marked unverified.

Main entry points: [`app.js`](https://github.com/vivek-63/mern-project/blob/main/app.js) (Express application), [`controllers/listing.js`](https://github.com/vivek-63/mern-project/blob/main/controllers/listing.js) (Listing workflows), [`controllers/profile.js`](https://github.com/vivek-63/mern-project/blob/main/controllers/profile.js) (Customer profile), [`controllers/review.js`](https://github.com/vivek-63/mern-project/blob/main/controllers/review.js) (Review workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Web runtime"]
  node_server["Express application<br/>[app.js]"]
  node_listing_routes["Listing routes<br/>[listing.js]"]
  node_review_routes["Review routes<br/>[review.js]"]
  node_user_routes["User routes<br/>[user.js]"]
  node_validation["Request validation<br/>[validate.js]"]
  node_rate_limit["Rate limiting<br/>[rateLimiter.js]"]
  node_logger["Application logging<br/>[logger.js]"]
  node_error_handler["Error responses<br/>[errorHandler.js]"]
end

subgraph group_discovery["Listings and discovery"]
  node_listing_controller["Listing workflows<br/>[listing.js]"]
  node_listing_views["Listing pages"]
  node_geo["Geocoding<br/>[geoCoder.js]"]
  node_nearby["Nearby places<br/>[nearbyPlaces.js]"]
  node_map_ui["Interactive maps<br/>[map.js]"]
  node_review_controller["Review workflows<br/>[review.js]"]
  node_review_views["Review display<br/>[show.ejs]"]
end

subgraph group_booking["Bookings"]
  node_booking_routes["Booking routes<br/>[bookings.js]"]
  node_booking_controller["Booking workflows<br/>[bookings.js]"]
  node_booking_views["Booking pages"]
end

subgraph group_accounts["Accounts and operations"]
  node_host_routes["Host routes<br/>[host.js]"]
  node_host_controller["Host workflows<br/>[host.js]"]
  node_admin_routes["Admin routes<br/>[admin.js]"]
  node_admin_controller["Admin workflows<br/>[admin.js]"]
  node_profile_controller["Customer profile<br/>[profile.js]"]
  node_user_controller["Authentication<br/>[user.js]"]
  node_dashboards["Role dashboards"]
  node_auth_middleware["Access checks<br/>[auth.js]"]
  node_session["Session and login<br/>[isLoggedin.js]"]
end

subgraph group_data["Data and integrations"]
  node_listing_model[("Listing records<br/>[listings.js]")]
  node_booking_model[("Booking records<br/>[booking.js]")]
  node_review_model[("Review records<br/>[reviews.js]")]
  node_user_model[("User records<br/>[user.js]")]
  node_cloudinary["Image storage"]
  node_geoapify["Geoapify services"]
end

node_guest(("Guest / host / admin"))

node_guest -->|"uses"| node_server
node_server -->|"mounts"| node_listing_routes
node_server -->|"mounts"| node_review_routes
node_server -->|"mounts"| node_user_routes
node_server -->|"mounts"| node_booking_routes
node_server -->|"mounts"| node_host_routes
node_server -->|"mounts"| node_admin_routes
node_listing_routes -->|"dispatches"| node_listing_controller
node_review_routes -->|"dispatches"| node_review_controller
node_user_routes -->|"dispatches"| node_user_controller
node_user_routes -->|"dispatches"| node_profile_controller
node_listing_controller -->|"queries"| node_listing_model
node_listing_controller -->|"checks dates"| node_booking_model
node_listing_controller -->|"geocodes"| node_geo
node_listing_controller -->|"fetches places"| node_nearby
node_listing_controller -->|"renders"| node_listing_views
node_nearby -.->|"queries"| node_geoapify
node_map_ui -.->|"maps location"| node_geoapify
node_review_controller -->|"updates listing"| node_listing_model
node_review_controller -->|"saves review"| node_review_model
node_review_controller -->|"redirects to"| node_review_views
node_booking_routes -.->|"dispatches"| node_booking_controller
node_booking_controller -.->|"manages bookings"| node_booking_model
node_booking_controller -.->|"serves booking UI"| node_booking_views
node_host_routes -.->|"dispatches"| node_host_controller
node_host_controller -.->|"serves host dashboard"| node_dashboards
node_admin_routes -.->|"dispatches"| node_admin_controller
node_admin_controller -.->|"serves admin dashboard"| node_dashboards
node_profile_controller -.->|"serves customer dashboard"| node_dashboards
node_profile_controller -->|"reads"| node_listing_model
node_profile_controller -->|"reads"| node_user_model
node_profile_controller -->|"reads"| node_review_model
node_profile_controller -->|"reads"| node_booking_model
node_server -->|"authenticates users"| node_user_model
node_listing_controller -.->|"stores images"| node_cloudinary
node_listing_routes -->|"validates input"| node_validation
node_review_routes -->|"validates input"| node_validation
node_listing_routes -->|"checks ownership"| node_auth_middleware
node_review_routes -->|"checks authorship"| node_auth_middleware
node_user_routes -->|"checks login"| node_session
node_server -->|"configures limiter"| node_rate_limit
node_server -->|"handles errors"| node_error_handler
node_error_handler -->|"logs errors"| node_logger
node_listing_controller -->|"logs actions"| node_logger
node_review_controller -->|"logs actions"| node_logger
node_listing_model -->|"references reviews"| node_review_model

click node_server "https://github.com/vivek-63/mern-project/blob/main/app.js"
click node_listing_routes "https://github.com/vivek-63/mern-project/blob/main/routes/listing.js"
click node_review_routes "https://github.com/vivek-63/mern-project/blob/main/routes/review.js"
click node_user_routes "https://github.com/vivek-63/mern-project/blob/main/routes/user.js"
click node_listing_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/listing.js"
click node_listing_views "https://github.com/vivek-63/mern-project/tree/main/views/listings"
click node_geo "https://github.com/vivek-63/mern-project/blob/main/services/geoCoder.js"
click node_nearby "https://github.com/vivek-63/mern-project/blob/main/services/nearbyPlaces.js"
click node_map_ui "https://github.com/vivek-63/mern-project/blob/main/public/js/map.js"
click node_review_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/review.js"
click node_review_views "https://github.com/vivek-63/mern-project/blob/main/views/listings/show.ejs"
click node_booking_routes "https://github.com/vivek-63/mern-project/blob/main/routes/bookings.js"
click node_booking_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/bookings.js"
click node_booking_views "https://github.com/vivek-63/mern-project/tree/main/views/booking"
click node_host_routes "https://github.com/vivek-63/mern-project/blob/main/routes/host.js"
click node_host_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/host.js"
click node_admin_routes "https://github.com/vivek-63/mern-project/blob/main/routes/admin.js"
click node_admin_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/admin.js"
click node_profile_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/profile.js"
click node_user_controller "https://github.com/vivek-63/mern-project/blob/main/controllers/user.js"
click node_dashboards "https://github.com/vivek-63/mern-project/tree/main/views/dashboards"
click node_auth_middleware "https://github.com/vivek-63/mern-project/blob/main/middlewares/auth.js"
click node_session "https://github.com/vivek-63/mern-project/blob/main/middlewares/isLoggedin.js"
click node_listing_model "https://github.com/vivek-63/mern-project/blob/main/models/listings.js"
click node_booking_model "https://github.com/vivek-63/mern-project/blob/main/models/booking.js"
click node_review_model "https://github.com/vivek-63/mern-project/blob/main/models/reviews.js"
click node_user_model "https://github.com/vivek-63/mern-project/blob/main/models/user.js"
click node_validation "https://github.com/vivek-63/mern-project/blob/main/middlewares/validate.js"
click node_rate_limit "https://github.com/vivek-63/mern-project/blob/main/middlewares/rateLimiter.js"
click node_logger "https://github.com/vivek-63/mern-project/blob/main/utils/logger.js"
click node_error_handler "https://github.com/vivek-63/mern-project/blob/main/middlewares/errorHandler.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_server,node_listing_routes,node_review_routes,node_user_routes,node_validation,node_rate_limit,node_logger,node_error_handler toneBlue
class node_listing_controller,node_listing_views,node_geo,node_nearby,node_map_ui,node_review_controller,node_review_views toneAmber
class node_booking_routes,node_booking_controller,node_booking_views toneMint
class node_host_routes,node_host_controller,node_admin_routes,node_admin_controller,node_profile_controller,node_user_controller,node_dashboards,node_auth_middleware,node_session toneRose
class node_listing_model,node_booking_model,node_review_model,node_user_model,node_cloudinary,node_geoapify,node_guest toneIndigo
```

## Components

### Web runtime

- [Express application](https://github.com/vivek-63/mern-project/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/vivek-63/mern-project/blob/main/routes/listing.js): `routes/listing.js`
- [Review routes](https://github.com/vivek-63/mern-project/blob/main/routes/review.js): `routes/review.js`
- [User routes](https://github.com/vivek-63/mern-project/blob/main/routes/user.js): `routes/user.js`
- [Request validation](https://github.com/vivek-63/mern-project/blob/main/middlewares/validate.js): `middlewares/validate.js`
- [Rate limiting](https://github.com/vivek-63/mern-project/blob/main/middlewares/rateLimiter.js): `middlewares/rateLimiter.js`
- [Application logging](https://github.com/vivek-63/mern-project/blob/main/utils/logger.js): `utils/logger.js`
- [Error responses](https://github.com/vivek-63/mern-project/blob/main/middlewares/errorHandler.js): `middlewares/errorHandler.js`

### Listings and discovery

- [Listing workflows](https://github.com/vivek-63/mern-project/blob/main/controllers/listing.js): `controllers/listing.js`
- [Listing pages](https://github.com/vivek-63/mern-project/tree/main/views/listings): `views/listings`
- [Geocoding](https://github.com/vivek-63/mern-project/blob/main/services/geoCoder.js): `services/geoCoder.js`
- [Nearby places](https://github.com/vivek-63/mern-project/blob/main/services/nearbyPlaces.js): `services/nearbyPlaces.js`
- [Interactive maps](https://github.com/vivek-63/mern-project/blob/main/public/js/map.js): `public/js/map.js`
- [Review workflows](https://github.com/vivek-63/mern-project/blob/main/controllers/review.js): `controllers/review.js`
- [Review display](https://github.com/vivek-63/mern-project/blob/main/views/listings/show.ejs): `views/listings/show.ejs`

### Bookings

- [Booking routes](https://github.com/vivek-63/mern-project/blob/main/routes/bookings.js): `routes/bookings.js`
- [Booking workflows](https://github.com/vivek-63/mern-project/blob/main/controllers/bookings.js): `controllers/bookings.js`
- [Booking pages](https://github.com/vivek-63/mern-project/tree/main/views/booking): `views/booking`

### Accounts and operations

- [Host routes](https://github.com/vivek-63/mern-project/blob/main/routes/host.js): `routes/host.js`
- [Host workflows](https://github.com/vivek-63/mern-project/blob/main/controllers/host.js): `controllers/host.js`
- [Admin routes](https://github.com/vivek-63/mern-project/blob/main/routes/admin.js): `routes/admin.js`
- [Admin workflows](https://github.com/vivek-63/mern-project/blob/main/controllers/admin.js): `controllers/admin.js`
- [Customer profile](https://github.com/vivek-63/mern-project/blob/main/controllers/profile.js): `controllers/profile.js`
- [Authentication](https://github.com/vivek-63/mern-project/blob/main/controllers/user.js): `controllers/user.js`
- [Role dashboards](https://github.com/vivek-63/mern-project/tree/main/views/dashboards): `views/dashboards`
- [Access checks](https://github.com/vivek-63/mern-project/blob/main/middlewares/auth.js): `middlewares/auth.js`
- [Session and login](https://github.com/vivek-63/mern-project/blob/main/middlewares/isLoggedin.js): `middlewares/isLoggedin.js`

### Data and integrations

- [Listing records](https://github.com/vivek-63/mern-project/blob/main/models/listings.js): `models/listings.js`
- [Booking records](https://github.com/vivek-63/mern-project/blob/main/models/booking.js): `models/booking.js`
- [Review records](https://github.com/vivek-63/mern-project/blob/main/models/reviews.js): `models/reviews.js`
- [User records](https://github.com/vivek-63/mern-project/blob/main/models/user.js): `models/user.js`
- **Image storage**
- **Geoapify services**

### Other components

- **Guest / host / admin**

## Connections

- Guest / host / admin → Express application: uses (evidence: `README.md`)
- Express application → Listing routes: mounts (evidence: `app.js`)
- Express application → Review routes: mounts (evidence: `app.js`)
- Express application → User routes: mounts (evidence: `app.js`)
- Express application → Booking routes: mounts (evidence: `app.js`)
- Express application → Host routes: mounts (evidence: `app.js`)
- Express application → Admin routes: mounts (evidence: `app.js`)
- Listing routes → Listing workflows: dispatches (evidence: `routes/listing.js`)
- Review routes → Review workflows: dispatches (evidence: `routes/review.js`)
- User routes → Authentication: dispatches (evidence: `routes/user.js`)
- User routes → Customer profile: dispatches (evidence: `routes/user.js`)
- Listing workflows → Listing records: queries (evidence: `controllers/listing.js`)
- Listing workflows → Booking records: checks dates (evidence: `controllers/listing.js`)
- Listing workflows → Geocoding: geocodes (evidence: `controllers/listing.js`)
- Listing workflows → Nearby places: fetches places (evidence: `controllers/listing.js`)
- Listing workflows → Listing pages: renders (evidence: `controllers/listing.js`)
- Nearby places → Geoapify services: queries
- Interactive maps → Geoapify services: maps location
- Review workflows → Listing records: updates listing (evidence: `controllers/review.js`)
- Review workflows → Review records: saves review (evidence: `controllers/review.js`)
- Review workflows → Review display: redirects to (evidence: `controllers/review.js`)
- Booking routes → Booking workflows: dispatches
- Booking workflows → Booking records: manages bookings
- Booking workflows → Booking pages: serves booking UI
- Host routes → Host workflows: dispatches
- Host workflows → Role dashboards: serves host dashboard
- Admin routes → Admin workflows: dispatches
- Admin workflows → Role dashboards: serves admin dashboard
- Customer profile → Role dashboards: serves customer dashboard
- Customer profile → Listing records: reads (evidence: `controllers/profile.js`)
- Customer profile → User records: reads (evidence: `controllers/profile.js`)
- Customer profile → Review records: reads (evidence: `controllers/profile.js`)
- Customer profile → Booking records: reads (evidence: `controllers/profile.js`)
- Express application → User records: authenticates users (evidence: `app.js`)
- Listing workflows → Image storage: stores images
- Listing routes → Request validation: validates input (evidence: `routes/listing.js`)
- Review routes → Request validation: validates input (evidence: `routes/review.js`)
- Listing routes → Access checks: checks ownership (evidence: `routes/listing.js`)
- Review routes → Access checks: checks authorship (evidence: `routes/review.js`)
- User routes → Session and login: checks login (evidence: `routes/user.js`)
- Express application → Rate limiting: configures limiter (evidence: `app.js`)
- Express application → Error responses: handles errors (evidence: `app.js`)
- Error responses → Application logging: logs errors (evidence: `middlewares/errorHandler.js`)
- Listing workflows → Application logging: logs actions (evidence: `controllers/listing.js`)
- Review workflows → Application logging: logs actions (evidence: `controllers/review.js`)
- Listing records → Review records: references reviews (evidence: `models/listings.js`)
