# adityasupekar07/lodgify architecture

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

- Interactive diagram: https://gitdiagram.com/adityasupekar07/lodgify
- Repository: https://github.com/adityasupekar07/lodgify

## Overview

This is a listings marketplace with account authentication, listing and review workflows, image uploads, and server-rendered pages. Users browse listings or submit listing and review changes; Express routes apply validation and authorization before controllers update MongoDB-backed models and render results. The source also includes data initialization and a separate classroom server. The classroom implementation and several integrations were not excerpted, so their internal relationships are omitted where the evidence does not establish them.

Main entry points: [`app.js`](https://github.com/adityasupekar07/lodgify/blob/main/app.js) (Express app), [`routes/listing.js`](https://github.com/adityasupekar07/lodgify/blob/main/routes/listing.js) (Listing routes), [`routes/review.js`](https://github.com/adityasupekar07/lodgify/blob/main/routes/review.js) (Review routes), [`models/listing.js`](https://github.com/adityasupekar07/lodgify/blob/main/models/listing.js) (Listing records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  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["Account routes<br/>[user.js]"]
  node_templates["Page templates"]
  node_classroom_server["Classroom server<br/>[server.js]"]
  node_classroom_page["Classroom page<br/>[page.ejs]"]
end

subgraph group_domain["Marketplace workflows"]
  node_listing_controller["Listing workflow<br/>[listings.js]"]
  node_review_controller["Review workflow<br/>[reviews.js]"]
  node_user_controller["Account workflow<br/>[users.js]"]
  node_access_middleware["Access checks<br/>[middleware.js]"]
end

subgraph group_data["Persistence and validation"]
  node_listing_model["Listing records<br/>[listing.js]"]
  node_review_model["Review records<br/>[review.js]"]
  node_user_model["User records<br/>[user.js]"]
  node_validation["Input schemas<br/>[schema.js]"]
  node_seed["Sample data<br/>[data.js]"]
  node_initializer["Data initializer<br/>[index.js]"]
end

subgraph group_integrations["Authentication and media"]
  node_passport["Passport local auth"]
  node_cloud_config["Upload storage config<br/>[cloudeconfig.js]"]
end

node_visitor(("Visitor"))
node_mongodb[("MongoDB")]

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 -->|"dispatches to"| node_listing_controller
node_review_routes -->|"dispatches to"| node_review_controller
node_user_routes -->|"dispatches to"| node_user_controller
node_listing_routes -->|"checks access"| node_access_middleware
node_review_routes -->|"checks access"| node_access_middleware
node_user_routes -->|"checks access"| node_access_middleware
node_listing_routes -->|"validates input"| node_validation
node_review_routes -->|"validates input"| node_validation
node_listing_controller -->|"reads and writes"| node_listing_model
node_review_controller -->|"reads and writes"| node_listing_model
node_review_controller -->|"reads and writes"| node_review_model
node_user_controller -->|"uses accounts"| node_user_model
node_listing_controller -->|"renders pages"| node_templates
node_app -->|"configures sessions"| node_passport
node_app -->|"configures authentication"| node_user_model
node_listing_routes -->|"configures uploads"| node_cloud_config
node_initializer -->|"loads seed data"| node_seed
node_initializer -->|"creates records"| node_listing_model
node_listing_model -.->|"persists records"| node_mongodb
node_review_model -.->|"persists records"| node_mongodb
node_user_model -.->|"persists accounts"| node_mongodb

click node_app "https://github.com/adityasupekar07/lodgify/blob/main/app.js"
click node_listing_routes "https://github.com/adityasupekar07/lodgify/blob/main/routes/listing.js"
click node_review_routes "https://github.com/adityasupekar07/lodgify/blob/main/routes/review.js"
click node_user_routes "https://github.com/adityasupekar07/lodgify/blob/main/routes/user.js"
click node_templates "https://github.com/adityasupekar07/lodgify/tree/main/views"
click node_listing_controller "https://github.com/adityasupekar07/lodgify/blob/main/controller/listings.js"
click node_review_controller "https://github.com/adityasupekar07/lodgify/blob/main/controller/reviews.js"
click node_user_controller "https://github.com/adityasupekar07/lodgify/blob/main/controller/users.js"
click node_access_middleware "https://github.com/adityasupekar07/lodgify/blob/main/middleware.js"
click node_listing_model "https://github.com/adityasupekar07/lodgify/blob/main/models/listing.js"
click node_review_model "https://github.com/adityasupekar07/lodgify/blob/main/models/review.js"
click node_user_model "https://github.com/adityasupekar07/lodgify/blob/main/models/user.js"
click node_validation "https://github.com/adityasupekar07/lodgify/blob/main/schema.js"
click node_seed "https://github.com/adityasupekar07/lodgify/blob/main/init/data.js"
click node_initializer "https://github.com/adityasupekar07/lodgify/blob/main/init/index.js"
click node_cloud_config "https://github.com/adityasupekar07/lodgify/blob/main/cloudeconfig.js"
click node_classroom_server "https://github.com/adityasupekar07/lodgify/blob/main/classroom/server.js"
click node_classroom_page "https://github.com/adityasupekar07/lodgify/blob/main/classroom/views/page.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_templates,node_classroom_server,node_classroom_page toneBlue
class node_listing_controller,node_review_controller,node_user_controller,node_access_middleware,node_mongodb toneAmber
class node_listing_model,node_review_model,node_user_model,node_validation,node_seed,node_initializer toneMint
class node_passport,node_cloud_config toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [Express app](https://github.com/adityasupekar07/lodgify/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/adityasupekar07/lodgify/blob/main/routes/listing.js): `routes/listing.js`
- [Review routes](https://github.com/adityasupekar07/lodgify/blob/main/routes/review.js): `routes/review.js`
- [Account routes](https://github.com/adityasupekar07/lodgify/blob/main/routes/user.js): `routes/user.js`
- [Page templates](https://github.com/adityasupekar07/lodgify/tree/main/views): `views`
- [Classroom server](https://github.com/adityasupekar07/lodgify/blob/main/classroom/server.js): `classroom/server.js`
- [Classroom page](https://github.com/adityasupekar07/lodgify/blob/main/classroom/views/page.ejs): `classroom/views/page.ejs`

### Marketplace workflows

- [Listing workflow](https://github.com/adityasupekar07/lodgify/blob/main/controller/listings.js): `controller/listings.js`
- [Review workflow](https://github.com/adityasupekar07/lodgify/blob/main/controller/reviews.js): `controller/reviews.js`
- [Account workflow](https://github.com/adityasupekar07/lodgify/blob/main/controller/users.js): `controller/users.js`
- [Access checks](https://github.com/adityasupekar07/lodgify/blob/main/middleware.js): `middleware.js`

### Persistence and validation

- [Listing records](https://github.com/adityasupekar07/lodgify/blob/main/models/listing.js): `models/listing.js`
- [Review records](https://github.com/adityasupekar07/lodgify/blob/main/models/review.js): `models/review.js`
- [User records](https://github.com/adityasupekar07/lodgify/blob/main/models/user.js): `models/user.js`
- [Input schemas](https://github.com/adityasupekar07/lodgify/blob/main/schema.js): `schema.js`
- [Sample data](https://github.com/adityasupekar07/lodgify/blob/main/init/data.js): `init/data.js`
- [Data initializer](https://github.com/adityasupekar07/lodgify/blob/main/init/index.js): `init/index.js`

### Authentication and media

- **Passport local auth**
- [Upload storage config](https://github.com/adityasupekar07/lodgify/blob/main/cloudeconfig.js): `cloudeconfig.js`

### Other components

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

## 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`)
- Listing routes → Listing workflow: dispatches to (evidence: `routes/listing.js`)
- Review routes → Review workflow: dispatches to (evidence: `routes/review.js`)
- Account routes → Account workflow: dispatches to (evidence: `routes/user.js`)
- Listing routes → Access checks: checks access (evidence: `routes/listing.js`)
- Review routes → Access checks: checks access (evidence: `routes/review.js`)
- Account routes → Access checks: checks access (evidence: `routes/user.js`)
- Listing routes → Input schemas: validates input (evidence: `routes/listing.js`)
- Review routes → Input schemas: validates input (evidence: `routes/review.js`)
- Listing workflow → Listing records: reads and writes (evidence: `controller/listings.js`)
- Review workflow → Listing records: reads and writes (evidence: `controller/reviews.js`)
- Review workflow → Review records: reads and writes (evidence: `controller/reviews.js`)
- Account workflow → User records: uses accounts (evidence: `controller/users.js`)
- Listing workflow → Page templates: renders pages (evidence: `controller/listings.js`)
- Express app → Passport local auth: configures sessions (evidence: `app.js`)
- Express app → User records: configures authentication (evidence: `app.js`)
- Listing routes → Upload storage config: configures uploads (evidence: `routes/listing.js`)
- Data initializer → Sample data: loads seed data (evidence: `init/index.js`)
- Data initializer → Listing records: creates records (evidence: `init/index.js`)
- Listing records → MongoDB: persists records
- Review records → MongoDB: persists records
- User records → MongoDB: persists accounts
