# harshvardhansalve/major-project architecture

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

- Interactive diagram: https://gitdiagram.com/harshvardhansalve/major-project
- Repository: https://github.com/harshvardhansalve/major-project

## Overview

This is a server-rendered lodging-listing marketplace: visitors browse listings, while authenticated users can create and manage listings, leave reviews, and register or log in. Express routes apply validation and authorization before handing work to controllers; Mongoose models persist users, listings, and reviews. The sampled code also shows image uploads configured for Cloudinary, map-related browser code, sessions, and Redis-backed rate limits. Relationships below follow shown calls and wiring; map behavior and unsampled controller details are represented cautiously.

Main entry points: [`app.js`](https://github.com/harshvardhansalve/major-project/blob/main/app.js) (Express app), [`routes/listing.js`](https://github.com/harshvardhansalve/major-project/blob/main/routes/listing.js) (Listing routes), [`routes/review.js`](https://github.com/harshvardhansalve/major-project/blob/main/routes/review.js) (Review routes), [`routes/user.js`](https://github.com/harshvardhansalve/major-project/blob/main/routes/user.js) (Account routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and views"]
  node_app["Express app<br/>[app.js]"]
  node_access_middleware["Access checks<br/>[middleware.js]"]
  node_auth_sessions["Sessions and auth<br/>[app.js]"]
  node_home_view["Home page<br/>[home.ejs]"]
  node_shared_views["Shared layout<br/>[boilerplate.ejs]"]
end

subgraph group_market["Listing marketplace"]
  node_listing_routes["Listing routes<br/>[listing.js]"]
  node_listing_controller["Listing operations<br/>[listings.js]"]
  node_listing_model[("Listing records<br/>[listing.js]")]
  node_listing_views["Listing pages"]
  node_listing_validation["Listing validation<br/>[schema.js]"]
  node_map_script["Listing map<br/>[map.js]"]
  node_map_view["Listing detail page<br/>[show.ejs]"]
end

subgraph group_identity["Accounts and reviews"]
  node_review_routes["Review routes<br/>[review.js]"]
  node_review_controller["Review operations<br/>[reviews.js]"]
  node_review_model[("Review records<br/>[reviews.js]")]
  node_review_validation["Review validation<br/>[schema.js]"]
  node_user_routes["Account routes<br/>[user.js]"]
  node_user_controller["Account operations<br/>[users.js]"]
  node_user_model[("User records<br/>[user.js]")]
  node_user_views["Account pages"]
end

subgraph group_platform["Persistence and integrations"]
  node_cloud_upload["Image upload storage<br/>[cloudConfig.js]"]
  node_cloud_service(("Cloud image service"))
  node_mongo[("MongoDB")]
  node_redis[("Redis")]
end

node_visitor(("Visitor"))

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 -->|"renders home"| node_home_view
node_app -->|"configures"| node_auth_sessions
node_app -->|"authenticates users"| node_user_model
node_listing_routes -->|"dispatches"| node_listing_controller
node_listing_routes -->|"validates listings"| node_listing_validation
node_listing_routes -->|"checks access"| node_access_middleware
node_listing_routes -->|"uploads images"| node_cloud_upload
node_listing_controller -->|"reads and writes"| node_listing_model
node_listing_controller -.->|"renders pages"| node_listing_views
node_review_routes -->|"dispatches"| node_review_controller
node_review_routes -->|"validates reviews"| node_review_validation
node_review_routes -->|"checks authorship"| node_access_middleware
node_review_controller -->|"loads listing"| node_listing_model
node_review_controller -->|"creates and deletes"| node_review_model
node_user_routes -->|"dispatches"| node_user_controller
node_user_routes -->|"authenticates"| node_user_model
node_user_controller -.->|"manages accounts"| node_user_model
node_user_controller -.->|"renders pages"| node_user_views
node_listing_model -->|"references reviews"| node_review_model
node_listing_model -.->|"persists records"| node_mongo
node_review_model -.->|"persists records"| node_mongo
node_user_model -.->|"persists accounts"| node_mongo
node_cloud_upload -.->|"stores uploads"| node_cloud_service
node_app -->|"rate limits via"| node_redis
node_user_routes -->|"rate limits via"| node_redis
node_listing_views -.->|"uses layout"| node_shared_views
node_map_view -.->|"loads map code"| node_map_script

click node_app "https://github.com/harshvardhansalve/major-project/blob/main/app.js"
click node_listing_routes "https://github.com/harshvardhansalve/major-project/blob/main/routes/listing.js"
click node_listing_controller "https://github.com/harshvardhansalve/major-project/blob/main/contollers/listings.js"
click node_listing_model "https://github.com/harshvardhansalve/major-project/blob/main/models/listing.js"
click node_listing_views "https://github.com/harshvardhansalve/major-project/tree/main/views/listings"
click node_listing_validation "https://github.com/harshvardhansalve/major-project/blob/main/schema.js"
click node_review_routes "https://github.com/harshvardhansalve/major-project/blob/main/routes/review.js"
click node_review_controller "https://github.com/harshvardhansalve/major-project/blob/main/contollers/reviews.js"
click node_review_model "https://github.com/harshvardhansalve/major-project/blob/main/models/reviews.js"
click node_review_validation "https://github.com/harshvardhansalve/major-project/blob/main/schema.js"
click node_user_routes "https://github.com/harshvardhansalve/major-project/blob/main/routes/user.js"
click node_user_controller "https://github.com/harshvardhansalve/major-project/blob/main/contollers/users.js"
click node_user_model "https://github.com/harshvardhansalve/major-project/blob/main/models/user.js"
click node_user_views "https://github.com/harshvardhansalve/major-project/tree/main/views/users"
click node_access_middleware "https://github.com/harshvardhansalve/major-project/blob/main/middleware.js"
click node_auth_sessions "https://github.com/harshvardhansalve/major-project/blob/main/app.js"
click node_home_view "https://github.com/harshvardhansalve/major-project/blob/main/views/home.ejs"
click node_shared_views "https://github.com/harshvardhansalve/major-project/blob/main/views/layouts/boilerplate.ejs"
click node_cloud_upload "https://github.com/harshvardhansalve/major-project/blob/main/cloudConfig.js"
click node_map_script "https://github.com/harshvardhansalve/major-project/blob/main/public/js/map.js"
click node_map_view "https://github.com/harshvardhansalve/major-project/blob/main/views/listings/show.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_access_middleware,node_auth_sessions,node_home_view,node_shared_views toneBlue
class node_listing_routes,node_listing_controller,node_listing_model,node_listing_views,node_listing_validation,node_map_script,node_map_view toneAmber
class node_review_routes,node_review_controller,node_review_model,node_review_validation,node_user_routes,node_user_controller,node_user_model,node_user_views toneMint
class node_cloud_upload,node_cloud_service,node_mongo,node_redis toneRose
class node_visitor toneIndigo
```

## Components

### Web entry and views

- [Express app](https://github.com/harshvardhansalve/major-project/blob/main/app.js): `app.js`
- [Access checks](https://github.com/harshvardhansalve/major-project/blob/main/middleware.js): `middleware.js`
- [Sessions and auth](https://github.com/harshvardhansalve/major-project/blob/main/app.js): `app.js`
- [Home page](https://github.com/harshvardhansalve/major-project/blob/main/views/home.ejs): `views/home.ejs`
- [Shared layout](https://github.com/harshvardhansalve/major-project/blob/main/views/layouts/boilerplate.ejs): `views/layouts/boilerplate.ejs`

### Listing marketplace

- [Listing routes](https://github.com/harshvardhansalve/major-project/blob/main/routes/listing.js): `routes/listing.js`
- [Listing operations](https://github.com/harshvardhansalve/major-project/blob/main/contollers/listings.js): `contollers/listings.js`
- [Listing records](https://github.com/harshvardhansalve/major-project/blob/main/models/listing.js): `models/listing.js`
- [Listing pages](https://github.com/harshvardhansalve/major-project/tree/main/views/listings): `views/listings`
- [Listing validation](https://github.com/harshvardhansalve/major-project/blob/main/schema.js): `schema.js`
- [Listing map](https://github.com/harshvardhansalve/major-project/blob/main/public/js/map.js): `public/js/map.js`
- [Listing detail page](https://github.com/harshvardhansalve/major-project/blob/main/views/listings/show.ejs): `views/listings/show.ejs`

### Accounts and reviews

- [Review routes](https://github.com/harshvardhansalve/major-project/blob/main/routes/review.js): `routes/review.js`
- [Review operations](https://github.com/harshvardhansalve/major-project/blob/main/contollers/reviews.js): `contollers/reviews.js`
- [Review records](https://github.com/harshvardhansalve/major-project/blob/main/models/reviews.js): `models/reviews.js`
- [Review validation](https://github.com/harshvardhansalve/major-project/blob/main/schema.js): `schema.js`
- [Account routes](https://github.com/harshvardhansalve/major-project/blob/main/routes/user.js): `routes/user.js`
- [Account operations](https://github.com/harshvardhansalve/major-project/blob/main/contollers/users.js): `contollers/users.js`
- [User records](https://github.com/harshvardhansalve/major-project/blob/main/models/user.js): `models/user.js`
- [Account pages](https://github.com/harshvardhansalve/major-project/tree/main/views/users): `views/users`

### Persistence and integrations

- [Image upload storage](https://github.com/harshvardhansalve/major-project/blob/main/cloudConfig.js): `cloudConfig.js`
- **Cloud image service**
- **MongoDB**
- **Redis**

### Other components

- **Visitor**

## Connections

- Visitor → Express app: sends requests (evidence: `app.js`)
- Express app → Listing routes: mounts routes (evidence: `app.js`)
- Express app → Review routes: mounts routes (evidence: `app.js`)
- Express app → Account routes: mounts routes (evidence: `app.js`)
- Express app → Home page: renders home (evidence: `app.js`)
- Express app → Sessions and auth: configures (evidence: `app.js`)
- Express app → User records: authenticates users (evidence: `app.js`)
- Listing routes → Listing operations: dispatches (evidence: `routes/listing.js`)
- Listing routes → Listing validation: validates listings (evidence: `routes/listing.js`)
- Listing routes → Access checks: checks access (evidence: `routes/listing.js`)
- Listing routes → Image upload storage: uploads images (evidence: `routes/listing.js`)
- Listing operations → Listing records: reads and writes (evidence: `contollers/listings.js`)
- Listing operations → Listing pages: renders pages
- Review routes → Review operations: dispatches (evidence: `routes/review.js`)
- Review routes → Review validation: validates reviews (evidence: `routes/review.js`)
- Review routes → Access checks: checks authorship (evidence: `routes/review.js`)
- Review operations → Listing records: loads listing (evidence: `contollers/reviews.js`)
- Review operations → Review records: creates and deletes (evidence: `contollers/reviews.js`)
- Account routes → Account operations: dispatches (evidence: `routes/user.js`)
- Account routes → User records: authenticates (evidence: `routes/user.js`)
- Account operations → User records: manages accounts (evidence: `contollers/users.js`)
- Account operations → Account pages: renders pages
- Listing records → Review records: references reviews (evidence: `models/listing.js`)
- Listing records → MongoDB: persists records
- Review records → MongoDB: persists records
- User records → MongoDB: persists accounts
- Image upload storage → Cloud image service: stores uploads
- Express app → Redis: rate limits via (evidence: `app.js`)
- Account routes → Redis: rate limits via (evidence: `routes/user.js`)
- Listing pages → Shared layout: uses layout
- Listing detail page → Listing map: loads map code
