# aaryan-sharmaa/wanderlust architecture

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

- Interactive diagram: https://gitdiagram.com/aaryan-sharmaa/wanderlust
- Repository: https://github.com/aaryan-sharmaa/wanderlust

## Overview

Wanderlust is an Express/MongoDB travel-listing web app. Visitors browse listing pages; signed-in users can create and manage listings, upload listing images, and post or delete reviews. Listing creation geocodes its location for the detail-page map. The graph follows the visible app/router/controller/model flow and documented capabilities; user-route internals and some integrations are represented at their supported directory or configuration path because their implementations were not sampled.

Main entry points: [`app.js`](https://github.com/aaryan-sharmaa/wanderlust/blob/main/app.js) (Express app), [`routes/listing.js`](https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/listing.js) (Listing routes), [`controllers/listings.js`](https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/listings.js) (Listing controller), [`routes/review.js`](https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/review.js) (Review routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and views"]
  node_app["Express app<br/>[app.js]"]
  node_browser_scripts["Browser behavior<br/>[script.js]"]
  node_error_page["Error page<br/>[error.ejs]"]
end

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

subgraph group_community["Accounts and reviews"]
  node_review_routes["Review routes<br/>[review.js]"]
  node_review_controller["Review controller<br/>[reviews.js]"]
  node_user_routes["Account routes<br/>[user.js]"]
  node_user_controller["Account controller<br/>[users.js]"]
  node_user_views["Account pages"]
  node_middleware["Auth and validation<br/>[middleware.js]"]
end

subgraph group_integrations["External services"]
  node_cloud_config["Image upload config<br/>[cloudConfig.js]"]
  node_cloudinary[("Cloudinary")]
  node_mapbox_geocoding["Mapbox geocoding"]
  node_map_client["Map display<br/>[map.js]"]
  node_mapbox_maps["Mapbox maps"]
end

subgraph group_persistence["Data models"]
  node_listing_model["Listing model<br/>[listing.js]"]
  node_review_model["Review model<br/>[reviews.js]"]
  node_user_model["User model<br/>[user.js]"]
  node_mongo[("MongoDB")]
  node_session_store["Session store<br/>[app.js]"]
end

node_visitor(("Visitor"))

node_visitor -->|"sends requests"| node_app
node_app -->|"dispatches listings"| node_listing_routes
node_app -->|"dispatches reviews"| node_review_routes
node_app -->|"dispatches accounts"| node_user_routes
node_app -->|"stores sessions"| node_session_store
node_session_store -->|"persists sessions"| node_mongo
node_app -->|"configures auth"| node_user_model
node_listing_routes -->|"checks access"| node_middleware
node_listing_routes -->|"dispatches actions"| node_listing_controller
node_listing_controller -->|"reads and writes"| node_listing_model
node_listing_controller -->|"renders pages"| node_listing_views
node_listing_controller -->|"geocodes location"| node_mapbox_geocoding
node_listing_routes -->|"uploads image"| node_cloud_config
node_cloud_config -.->|"stores image"| node_cloudinary
node_review_routes -->|"checks access"| node_middleware
node_review_routes -->|"dispatches actions"| node_review_controller
node_review_controller -->|"updates listing"| node_listing_model
node_review_controller -->|"creates or deletes"| node_review_model
node_user_routes -->|"checks access"| node_middleware
node_user_routes -->|"dispatches actions"| node_user_controller
node_user_controller -->|"authenticates users"| node_user_model
node_user_controller -->|"renders pages"| node_user_views
node_listing_model -->|"stores listings"| node_mongo
node_review_model -->|"stores reviews"| node_mongo
node_user_model -->|"stores users"| node_mongo
node_app -->|"renders errors"| node_error_page
node_map_client -.->|"renders map"| node_mapbox_maps
node_browser_scripts -->|"validates forms"| node_visitor

click node_app "https://github.com/aaryan-sharmaa/wanderlust/blob/main/app.js"
click node_listing_routes "https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/listing.js"
click node_listing_controller "https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/listings.js"
click node_listing_views "https://github.com/aaryan-sharmaa/wanderlust/tree/main/views/listings"
click node_review_routes "https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/review.js"
click node_review_controller "https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/reviews.js"
click node_user_routes "https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/user.js"
click node_user_controller "https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/users.js"
click node_user_views "https://github.com/aaryan-sharmaa/wanderlust/tree/main/views/users"
click node_middleware "https://github.com/aaryan-sharmaa/wanderlust/blob/main/middleware.js"
click node_listing_model "https://github.com/aaryan-sharmaa/wanderlust/blob/main/models/listing.js"
click node_review_model "https://github.com/aaryan-sharmaa/wanderlust/blob/main/models/reviews.js"
click node_user_model "https://github.com/aaryan-sharmaa/wanderlust/blob/main/models/user.js"
click node_session_store "https://github.com/aaryan-sharmaa/wanderlust/blob/main/app.js"
click node_cloud_config "https://github.com/aaryan-sharmaa/wanderlust/blob/main/cloudConfig.js"
click node_map_client "https://github.com/aaryan-sharmaa/wanderlust/blob/main/public/js/map.js"
click node_browser_scripts "https://github.com/aaryan-sharmaa/wanderlust/blob/main/public/js/script.js"
click node_error_page "https://github.com/aaryan-sharmaa/wanderlust/blob/main/views/error.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_browser_scripts,node_error_page toneBlue
class node_listing_routes,node_listing_controller,node_listing_views toneAmber
class node_review_routes,node_review_controller,node_user_routes,node_user_controller,node_user_views,node_middleware toneMint
class node_cloud_config,node_cloudinary,node_mapbox_geocoding,node_map_client,node_mapbox_maps toneRose
class node_listing_model,node_review_model,node_user_model,node_mongo,node_session_store,node_visitor toneIndigo
```

## Components

### Web entry and views

- [Express app](https://github.com/aaryan-sharmaa/wanderlust/blob/main/app.js): `app.js`
- [Browser behavior](https://github.com/aaryan-sharmaa/wanderlust/blob/main/public/js/script.js): `public/js/script.js`
- [Error page](https://github.com/aaryan-sharmaa/wanderlust/blob/main/views/error.ejs): `views/error.ejs`

### Listing discovery

- [Listing routes](https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/listing.js): `routes/listing.js`
- [Listing controller](https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/listings.js): `controllers/listings.js`
- [Listing pages](https://github.com/aaryan-sharmaa/wanderlust/tree/main/views/listings): `views/listings`

### Accounts and reviews

- [Review routes](https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/review.js): `routes/review.js`
- [Review controller](https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/reviews.js): `controllers/reviews.js`
- [Account routes](https://github.com/aaryan-sharmaa/wanderlust/blob/main/routes/user.js): `routes/user.js`
- [Account controller](https://github.com/aaryan-sharmaa/wanderlust/blob/main/controllers/users.js): `controllers/users.js`
- [Account pages](https://github.com/aaryan-sharmaa/wanderlust/tree/main/views/users): `views/users`
- [Auth and validation](https://github.com/aaryan-sharmaa/wanderlust/blob/main/middleware.js): `middleware.js`

### External services

- [Image upload config](https://github.com/aaryan-sharmaa/wanderlust/blob/main/cloudConfig.js): `cloudConfig.js`
- **Cloudinary**
- **Mapbox geocoding**
- [Map display](https://github.com/aaryan-sharmaa/wanderlust/blob/main/public/js/map.js): `public/js/map.js`
- **Mapbox maps**

### Data models

- [Listing model](https://github.com/aaryan-sharmaa/wanderlust/blob/main/models/listing.js): `models/listing.js`
- [Review model](https://github.com/aaryan-sharmaa/wanderlust/blob/main/models/reviews.js): `models/reviews.js`
- [User model](https://github.com/aaryan-sharmaa/wanderlust/blob/main/models/user.js): `models/user.js`
- **MongoDB**
- [Session store](https://github.com/aaryan-sharmaa/wanderlust/blob/main/app.js): `app.js`

### Other components

- **Visitor**

## Connections

- Visitor → Express app: sends requests
- Express app → Listing routes: dispatches listings
- Express app → Review routes: dispatches reviews
- Express app → Account routes: dispatches accounts
- Express app → Session store: stores sessions
- Session store → MongoDB: persists sessions
- Express app → User model: configures auth
- Listing routes → Auth and validation: checks access
- Listing routes → Listing controller: dispatches actions
- Listing controller → Listing model: reads and writes
- Listing controller → Listing pages: renders pages
- Listing controller → Mapbox geocoding: geocodes location
- Listing routes → Image upload config: uploads image
- Image upload config → Cloudinary: stores image
- Review routes → Auth and validation: checks access
- Review routes → Review controller: dispatches actions
- Review controller → Listing model: updates listing
- Review controller → Review model: creates or deletes
- Account routes → Auth and validation: checks access
- Account routes → Account controller: dispatches actions
- Account controller → User model: authenticates users
- Account controller → Account pages: renders pages
- Listing model → MongoDB: stores listings
- Review model → MongoDB: stores reviews
- User model → MongoDB: stores users
- Express app → Error page: renders errors
- Map display → Mapbox maps: renders map
- Browser behavior → Visitor: validates forms
