# ramcharan79-web/wanderlust-fullstack architecture

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

- Interactive diagram: https://gitdiagram.com/ramcharan79-web/wanderlust-fullstack
- Repository: https://github.com/ramcharan79-web/wanderlust-fullstack

## Overview

WanderLust is a server-rendered property-listing application. Visitors browse listing collections and details; signed-in users can create, edit, and delete listings, while users can register, log in, and add or remove reviews. Express dispatches requests to route modules, which apply validation and access checks, read or write Mongoose models, then render EJS pages or redirect with feedback. The README also documents seed-data initialization. The principal runtime files are excerpted; template and browser behavior is represented at subsystem level from the tree and README.

Main entry points: [`app.js`](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/app.js) (Express application), [`routes/user.js`](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/user.js) (Account routes), [`routes/listing.js`](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/listing.js) (Listing routes), [`routes/review.js`](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/review.js) (Review routes)

## 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_review_routes["Review routes<br/>[review.js]"]
  node_user_routes["Account routes<br/>[user.js]"]
end

subgraph group_domain["Listing and review domain"]
  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_seed_runner["Seed initializer<br/>[index.js]"]
  node_seed_data["Sample listings<br/>[data.js]"]
end

subgraph group_identity["Identity and validation"]
  node_middleware["Access and validation<br/>[middleware.js]"]
  node_schema["Joi schemas<br/>[schema.js]"]
end

subgraph group_presentation["Rendered interface"]
  node_views["EJS templates"]
  node_browser_js["Browser behavior<br/>[script.js]"]
  node_styles["Stylesheet<br/>[style.css]"]
end

node_visitor(("Visitor"))
node_mongo[("MongoDB")]
node_passport["Passport local auth"]

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_app -->|"connects database"| node_mongo
node_app -->|"configures sessions"| node_user_model
node_listing_routes -->|"queries listings"| node_listing_model
node_listing_routes -->|"applies guards"| node_middleware
node_review_routes -->|"loads listing"| node_listing_model
node_review_routes -->|"writes reviews"| node_review_model
node_review_routes -->|"applies guards"| node_middleware
node_user_routes -->|"registers users"| node_user_model
node_user_routes -->|"saves redirect"| node_middleware
node_user_routes -->|"authenticates locally"| node_passport
node_middleware -->|"validates input"| node_schema
node_listing_model -->|"deletes related reviews"| node_review_model
node_seed_runner -->|"loads sample data"| node_seed_data
node_seed_runner -->|"inserts listings"| node_listing_model
node_listing_routes -->|"renders pages"| node_views
node_user_routes -->|"renders auth pages"| node_views
node_app -->|"configures rendering"| node_views
node_app -->|"serves static assets"| node_browser_js
node_app -->|"serves static assets"| node_styles

click node_app "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/app.js"
click node_listing_routes "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/listing.js"
click node_review_routes "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/review.js"
click node_user_routes "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/user.js"
click node_listing_model "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/models/listing.js"
click node_review_model "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/models/review.js"
click node_user_model "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/models/user.js"
click node_middleware "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/middleware.js"
click node_schema "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/schema.js"
click node_seed_runner "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/init/index.js"
click node_seed_data "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/init/data.js"
click node_views "https://github.com/ramcharan79-web/wanderlust-fullstack/tree/main/views"
click node_browser_js "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/public/js/script.js"
click node_styles "https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/public/css/style.css"

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_review_routes,node_user_routes toneBlue
class node_listing_model,node_review_model,node_user_model,node_seed_runner,node_seed_data,node_mongo toneAmber
class node_middleware,node_schema toneMint
class node_views,node_browser_js,node_styles toneRose
class node_visitor,node_passport toneIndigo
```

## Components

### Web application

- [Express application](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/listing.js): `routes/listing.js`
- [Review routes](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/review.js): `routes/review.js`
- [Account routes](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/routes/user.js): `routes/user.js`

### Listing and review domain

- [Listing model](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/models/listing.js): `models/listing.js`
- [Review model](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/models/review.js): `models/review.js`
- [User model](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/models/user.js): `models/user.js`
- [Seed initializer](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/init/index.js): `init/index.js`
- [Sample listings](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/init/data.js): `init/data.js`

### Identity and validation

- [Access and validation](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/middleware.js): `middleware.js`
- [Joi schemas](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/schema.js): `schema.js`

### Rendered interface

- [EJS templates](https://github.com/ramcharan79-web/wanderlust-fullstack/tree/main/views): `views`
- [Browser behavior](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/public/js/script.js): `public/js/script.js`
- [Stylesheet](https://github.com/ramcharan79-web/wanderlust-fullstack/blob/main/public/css/style.css): `public/css/style.css`

### Other components

- **Visitor**
- **MongoDB**
- **Passport local auth**

## Connections

- Visitor → Express application: sends requests (evidence: `README.md`)
- Express application → Listing routes: mounts routes (evidence: `app.js`)
- Express application → Review routes: mounts routes (evidence: `app.js`)
- Express application → Account routes: mounts routes (evidence: `app.js`)
- Express application → MongoDB: connects database (evidence: `app.js`)
- Express application → User model: configures sessions (evidence: `app.js`)
- Listing routes → Listing model: queries listings (evidence: `routes/listing.js`)
- Listing routes → Access and validation: applies guards (evidence: `routes/listing.js`)
- Review routes → Listing model: loads listing (evidence: `routes/review.js`)
- Review routes → Review model: writes reviews (evidence: `routes/review.js`)
- Review routes → Access and validation: applies guards (evidence: `routes/review.js`)
- Account routes → User model: registers users (evidence: `routes/user.js`)
- Account routes → Access and validation: saves redirect (evidence: `routes/user.js`)
- Account routes → Passport local auth: authenticates locally (evidence: `routes/user.js`)
- Access and validation → Joi schemas: validates input (evidence: `middleware.js`)
- Listing model → Review model: deletes related reviews (evidence: `models/listing.js`)
- Seed initializer → Sample listings: loads sample data (evidence: `init/index.js`)
- Seed initializer → Listing model: inserts listings (evidence: `init/index.js`)
- Listing routes → EJS templates: renders pages (evidence: `routes/listing.js`)
- Account routes → EJS templates: renders auth pages (evidence: `routes/user.js`)
- Express application → EJS templates: configures rendering (evidence: `app.js`)
- Express application → Browser behavior: serves static assets (evidence: `app.js`)
- Express application → Stylesheet: serves static assets (evidence: `app.js`)
