# sanjay-sahoo-0804/project architecture

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

- Interactive diagram: https://gitdiagram.com/sanjay-sahoo-0804/project
- Repository: https://github.com/sanjay-sahoo-0804/project

## Overview

Wanderlust is an Express/Mongoose vacation-rental listing app. Visitors browse listings; signed-in users can create, edit, and delete their own listings, upload images, and add or remove reviews. The sampled code shows the app mounting route modules, routes applying authentication/ownership and validation middleware before controllers, and controllers reading or writing MongoDB models and rendering EJS pages. The tree indicates signup/login support; user-route details were not sampled, so those links are limited to the app’s router mount. Image storage is configured separately.

Main entry points: [`app.js`](https://github.com/sanjay-sahoo-0804/project/blob/main/app.js) (Express app), [`routes/listing.js`](https://github.com/sanjay-sahoo-0804/project/blob/main/routes/listing.js) (Listing routes), [`controllers/reviews.js`](https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/reviews.js) (Review controller), [`controllers/listing.js`](https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/listing.js) (Listing controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and views"]
  node_app["Express app<br/>[app.js]"]
  node_shared_views["Shared page layout<br/>[boilerplate.ejs]"]
end

subgraph group_listings["Listing management"]
  node_listing_routes["Listing routes<br/>[listing.js]"]
  node_listing_controller["Listing controller<br/>[listing.js]"]
  node_listing_views["Listing pages"]
end

subgraph group_reviews["Reviews"]
  node_review_routes["Review routes<br/>[review.js]"]
  node_review_controller["Review controller<br/>[reviews.js]"]
  node_review_view["Listing detail<br/>[show.ejs]"]
end

subgraph group_identity["Accounts and sessions"]
  node_user_routes["User routes<br/>[user.js]"]
  node_user_controller["User controller<br/>[users.js]"]
  node_user_views["Account pages"]
  node_auth_middleware["Access checks<br/>[middleware.js]"]
  node_session_store["Mongo session store<br/>[app.js]"]
end

subgraph group_data["Persistence and uploads"]
  node_listing_model["Listing model<br/>[listing.js]"]
  node_review_model["Review model<br/>[review.js]"]
  node_user_model["User model<br/>[user.js]"]
  node_cloud_config["Image storage config<br/>[cloudConfig.js]"]
end

node_visitor(("Visitor"))
node_mongo[("MongoDB")]
node_cloudinary["Cloudinary"]
node_browser(("Browser"))

node_visitor -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_listing_routes
node_app -->|"mounts routes"| node_review_routes
node_app -->|"mounts routes"| node_user_routes
node_listing_routes -->|"checks access"| node_auth_middleware
node_listing_routes -->|"dispatches"| node_listing_controller
node_listing_controller -->|"reads/writes"| node_listing_model
node_listing_controller -->|"renders"| node_listing_views
node_review_routes -->|"checks access"| node_auth_middleware
node_review_routes -->|"dispatches"| node_review_controller
node_review_controller -->|"reads/writes"| node_listing_model
node_review_controller -->|"reads/writes"| node_review_model
node_review_controller -->|"redirects to"| node_review_view
node_user_routes -->|"dispatches"| node_user_controller
node_user_controller -->|"uses account model"| node_user_model
node_user_controller -->|"renders"| node_user_views
node_app -->|"configures Passport"| node_user_model
node_app -->|"configures sessions"| node_session_store
node_app -->|"connects"| node_mongo
node_session_store -->|"stores sessions"| node_mongo
node_listing_model -->|"persists listings"| node_mongo
node_review_model -->|"persists reviews"| node_mongo
node_user_model -->|"persists users"| node_mongo
node_listing_routes -->|"uses upload storage"| node_cloud_config
node_cloud_config -.->|"stores images"| node_cloudinary
node_app -->|"sets page engine"| node_shared_views
node_listing_views -->|"uses layout"| node_shared_views
node_user_views -->|"uses layout"| node_shared_views
node_browser -->|"requests pages"| node_app
node_app -->|"serves responses"| node_browser

click node_app "https://github.com/sanjay-sahoo-0804/project/blob/main/app.js"
click node_listing_routes "https://github.com/sanjay-sahoo-0804/project/blob/main/routes/listing.js"
click node_listing_controller "https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/listing.js"
click node_listing_views "https://github.com/sanjay-sahoo-0804/project/tree/main/views/listings"
click node_review_routes "https://github.com/sanjay-sahoo-0804/project/blob/main/routes/review.js"
click node_review_controller "https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/reviews.js"
click node_review_view "https://github.com/sanjay-sahoo-0804/project/blob/main/views/listings/show.ejs"
click node_user_routes "https://github.com/sanjay-sahoo-0804/project/blob/main/routes/user.js"
click node_user_controller "https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/users.js"
click node_user_views "https://github.com/sanjay-sahoo-0804/project/tree/main/views/users"
click node_auth_middleware "https://github.com/sanjay-sahoo-0804/project/blob/main/middleware.js"
click node_listing_model "https://github.com/sanjay-sahoo-0804/project/blob/main/models/listing.js"
click node_review_model "https://github.com/sanjay-sahoo-0804/project/blob/main/models/review.js"
click node_user_model "https://github.com/sanjay-sahoo-0804/project/blob/main/models/user.js"
click node_cloud_config "https://github.com/sanjay-sahoo-0804/project/blob/main/cloudConfig.js"
click node_session_store "https://github.com/sanjay-sahoo-0804/project/blob/main/app.js"
click node_shared_views "https://github.com/sanjay-sahoo-0804/project/blob/main/views/layouts/boilerplate.ejs"

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_shared_views,node_browser toneBlue
class node_listing_routes,node_listing_controller,node_listing_views,node_mongo toneAmber
class node_review_routes,node_review_controller,node_review_view toneMint
class node_user_routes,node_user_controller,node_user_views,node_auth_middleware,node_session_store toneRose
class node_listing_model,node_review_model,node_user_model,node_cloud_config,node_visitor,node_cloudinary toneIndigo
```

## Components

### Web entry and views

- [Express app](https://github.com/sanjay-sahoo-0804/project/blob/main/app.js): `app.js`
- [Shared page layout](https://github.com/sanjay-sahoo-0804/project/blob/main/views/layouts/boilerplate.ejs): `views/layouts/boilerplate.ejs`

### Listing management

- [Listing routes](https://github.com/sanjay-sahoo-0804/project/blob/main/routes/listing.js): `routes/listing.js`
- [Listing controller](https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/listing.js): `controllers/listing.js`
- [Listing pages](https://github.com/sanjay-sahoo-0804/project/tree/main/views/listings): `views/listings`

### Reviews

- [Review routes](https://github.com/sanjay-sahoo-0804/project/blob/main/routes/review.js): `routes/review.js`
- [Review controller](https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/reviews.js): `controllers/reviews.js`
- [Listing detail](https://github.com/sanjay-sahoo-0804/project/blob/main/views/listings/show.ejs): `views/listings/show.ejs`

### Accounts and sessions

- [User routes](https://github.com/sanjay-sahoo-0804/project/blob/main/routes/user.js): `routes/user.js`
- [User controller](https://github.com/sanjay-sahoo-0804/project/blob/main/controllers/users.js): `controllers/users.js`
- [Account pages](https://github.com/sanjay-sahoo-0804/project/tree/main/views/users): `views/users`
- [Access checks](https://github.com/sanjay-sahoo-0804/project/blob/main/middleware.js): `middleware.js`
- [Mongo session store](https://github.com/sanjay-sahoo-0804/project/blob/main/app.js): `app.js`

### Persistence and uploads

- [Listing model](https://github.com/sanjay-sahoo-0804/project/blob/main/models/listing.js): `models/listing.js`
- [Review model](https://github.com/sanjay-sahoo-0804/project/blob/main/models/review.js): `models/review.js`
- [User model](https://github.com/sanjay-sahoo-0804/project/blob/main/models/user.js): `models/user.js`
- [Image storage config](https://github.com/sanjay-sahoo-0804/project/blob/main/cloudConfig.js): `cloudConfig.js`

### Other components

- **Visitor**
- **MongoDB**
- **Cloudinary**
- **Browser**

## Connections

- Visitor → Express app: sends requests
- Express app → Listing routes: mounts routes
- Express app → Review routes: mounts routes
- Express app → User routes: mounts routes
- Listing routes → Access checks: checks access
- Listing routes → Listing controller: dispatches
- Listing controller → Listing model: reads/writes
- Listing controller → Listing pages: renders
- Review routes → Access checks: checks access
- Review routes → Review controller: dispatches
- Review controller → Listing model: reads/writes
- Review controller → Review model: reads/writes
- Review controller → Listing detail: redirects to
- User routes → User controller: dispatches
- User controller → User model: uses account model
- User controller → Account pages: renders
- Express app → User model: configures Passport
- Express app → Mongo session store: configures sessions
- Express app → MongoDB: connects
- Mongo session store → MongoDB: stores sessions
- Listing model → MongoDB: persists listings
- Review model → MongoDB: persists reviews
- User model → MongoDB: persists users
- Listing routes → Image storage config: uses upload storage
- Image storage config → Cloudinary: stores images
- Express app → Shared page layout: sets page engine
- Listing pages → Shared page layout: uses layout
- Account pages → Shared page layout: uses layout
- Browser → Express app: requests pages
- Express app → Browser: serves responses
