# kkumarkaushal95-arch/full-stack-project architecture

> Architecture diagram of the GitHub repository kkumarkaushal95-arch/full-stack-project, 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/kkumarkaushal95-arch/full-stack-project
- Repository: https://github.com/kkumarkaushal95-arch/full-stack-project

## Overview

Wanderlust is an Express-based lodging-listing web app. Visitors browse listings; signed-in users can create, edit, and delete their own listings, upload listing images, and add or remove reviews. The runtime routes requests through authentication and validation middleware to controllers, which read and write MongoDB models and render EJS pages. User registration and login are present in the tree, but their controller and route wiring were not sampled; those details are represented only at the documented module level.

Main entry points: [`app.js`](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/app.js) (Express app), [`routes/listing.js`](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/listing.js) (Listing routes), [`middleware.js`](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/middleware.js) (Auth and validation), [`models/listing.js`](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/listing.js) (Listing model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web runtime"]
  node_app["Express app<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_middleware["Auth and validation<br/>[middleware.js]"]
  node_shared_views["Shared layout<br/>[boilerplate.ejs]"]
  node_error_view["Error page<br/>[error.ejs]"]
end

subgraph group_listing["Listings"]
  node_listing_controller["Listing actions<br/>[listings.js]"]
  node_listing_views["Listing pages"]
  node_upload["Image upload<br/>[cloudConfig.js]"]
end

subgraph group_community["Users and reviews"]
  node_review_controller["Review actions<br/>[reviews.js]"]
  node_user_controller["User actions<br/>[users.js]"]
  node_user_views["Account pages"]
end

subgraph group_data["Persistence and media"]
  node_review_model["Review model<br/>[review.js]"]
  node_listing_model["Listing model<br/>[listing.js]"]
  node_user_model["User model<br/>[user.js]"]
end

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

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_middleware
node_listing_routes -->|"dispatches actions"| node_listing_controller
node_review_routes -->|"checks access"| node_middleware
node_review_routes -->|"dispatches actions"| node_review_controller
node_user_routes -->|"dispatches actions"| node_user_controller
node_listing_routes -->|"processes images"| node_upload
node_upload -->|"stores images"| node_cloudinary
node_listing_controller -->|"reads and writes"| node_listing_model
node_review_controller -->|"updates references"| node_listing_model
node_review_controller -->|"creates and deletes"| node_review_model
node_middleware -->|"checks ownership"| node_listing_model
node_middleware -->|"checks authorship"| node_review_model
node_app -->|"configures sessions"| node_user_model
node_listing_model -->|"persists listings"| node_mongo
node_review_model -->|"persists reviews"| node_mongo
node_user_model -->|"persists users"| node_mongo
node_listing_controller -->|"renders pages"| node_listing_views
node_user_controller -->|"renders pages"| node_user_views
node_app -->|"renders errors"| node_error_view
node_listing_views -->|"uses layout"| node_shared_views
node_user_views -->|"uses layout"| node_shared_views

click node_app "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/app.js"
click node_listing_routes "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/listing.js"
click node_review_routes "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/review.js"
click node_user_routes "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/user.js"
click node_middleware "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/middleware.js"
click node_listing_controller "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/controllers/listings.js"
click node_listing_views "https://github.com/kkumarkaushal95-arch/full-stack-project/tree/main/views/listings"
click node_review_controller "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/controllers/reviews.js"
click node_user_controller "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/controllers/users.js"
click node_user_views "https://github.com/kkumarkaushal95-arch/full-stack-project/tree/main/views/users"
click node_review_model "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/review.js"
click node_listing_model "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/listing.js"
click node_user_model "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/user.js"
click node_upload "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/cloudConfig.js"
click node_shared_views "https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/views/layouts/boilerplate.ejs"
click node_error_view "https://github.com/kkumarkaushal95-arch/full-stack-project/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_listing_routes,node_review_routes,node_user_routes,node_middleware,node_shared_views,node_error_view toneBlue
class node_listing_controller,node_listing_views,node_upload,node_mongo,node_cloudinary toneAmber
class node_review_controller,node_user_controller,node_user_views toneMint
class node_review_model,node_listing_model,node_user_model toneRose
class node_visitor toneIndigo
```

## Components

### Web runtime

- [Express app](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/listing.js): `routes/listing.js`
- [Review routes](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/review.js): `routes/review.js`
- [User routes](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/routes/user.js): `routes/user.js`
- [Auth and validation](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/middleware.js): `middleware.js`
- [Shared layout](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/views/layouts/boilerplate.ejs): `views/layouts/boilerplate.ejs`
- [Error page](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/views/error.ejs): `views/error.ejs`

### Listings

- [Listing actions](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/controllers/listings.js): `controllers/listings.js`
- [Listing pages](https://github.com/kkumarkaushal95-arch/full-stack-project/tree/main/views/listings): `views/listings`
- [Image upload](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/cloudConfig.js): `cloudConfig.js`

### Users and reviews

- [Review actions](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/controllers/reviews.js): `controllers/reviews.js`
- [User actions](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/controllers/users.js): `controllers/users.js`
- [Account pages](https://github.com/kkumarkaushal95-arch/full-stack-project/tree/main/views/users): `views/users`

### Persistence and media

- [Review model](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/review.js): `models/review.js`
- [Listing model](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/listing.js): `models/listing.js`
- [User model](https://github.com/kkumarkaushal95-arch/full-stack-project/blob/main/models/user.js): `models/user.js`

### Other components

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

## 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 → Auth and validation: checks access
- Listing routes → Listing actions: dispatches actions
- Review routes → Auth and validation: checks access
- Review routes → Review actions: dispatches actions
- User routes → User actions: dispatches actions
- Listing routes → Image upload: processes images
- Image upload → Cloudinary: stores images
- Listing actions → Listing model: reads and writes
- Review actions → Listing model: updates references
- Review actions → Review model: creates and deletes
- Auth and validation → Listing model: checks ownership
- Auth and validation → Review model: checks authorship
- Express app → User model: configures sessions
- Listing model → MongoDB: persists listings
- Review model → MongoDB: persists reviews
- User model → MongoDB: persists users
- Listing actions → Listing pages: renders pages
- User actions → Account pages: renders pages
- Express app → Error page: renders errors
- Listing pages → Shared layout: uses layout
- Account pages → Shared layout: uses layout
