# nehakri2005/rentify architecture

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

- Interactive diagram: https://gitdiagram.com/nehakri2005/rentify
- Repository: https://github.com/nehakri2005/rentify

## Overview

Rentify is an Express property-rental application. Renters browse, search, filter, and view listings; owners manage listings and images; signed-in users can add reviews. The main request path is app setup → routed middleware → controllers → Mongo-backed models, with EJS views and static assets serving the interface. Authentication and listing/review authorization are distinct supporting stages. The README also describes map-based location viewing. Some controller and integration details are unsampled, so uncertain links are omitted or marked unverified.

Main entry points: [`app.js`](https://github.com/nehakri2005/rentify/blob/main/app.js) (Express app), [`middleware.js`](https://github.com/nehakri2005/rentify/blob/main/middleware.js) (Access and validation), [`routes/listing.js`](https://github.com/nehakri2005/rentify/blob/main/routes/listing.js) (Listing routes), [`models/listing.js`](https://github.com/nehakri2005/rentify/blob/main/models/listing.js) (Listing model)

## 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_views["EJS pages"]
  node_map["Map display<br/>[map.js]"]
  node_static_assets["Static assets"]
end

subgraph group_identity["Identity and access"]
  node_user_routes["User routes<br/>[user.js]"]
  node_user_controller["Account actions<br/>[user.js]"]
  node_access_checks["Access and validation<br/>[middleware.js]"]
  node_user_model["User model<br/>[user.js]"]
end

subgraph group_property["Property and reviews"]
  node_listing_controller["Listing actions<br/>[listing.js]"]
  node_review_controller["Review actions<br/>[review.js]"]
  node_listing_model["Listing model<br/>[listing.js]"]
  node_review_model["Review model<br/>[review.js]"]
end

subgraph group_data["Persistence and media"]
  node_mongo[("MongoDB")]
  node_image_storage["Image storage config<br/>[cloudConfig.js]"]
end

node_visitor(("Renter or owner"))

node_visitor -->|"sends requests"| node_app
node_app -->|"routes requests"| node_listing_routes
node_app -->|"routes requests"| node_review_routes
node_app -->|"routes requests"| node_user_routes
node_app -->|"connects to"| node_mongo
node_app -->|"configures auth"| node_user_model
node_app -->|"serves files"| node_static_assets
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 -->|"applies checks"| node_access_checks
node_review_routes -->|"applies checks"| node_access_checks
node_user_routes -->|"applies redirect"| node_access_checks
node_listing_controller -->|"uses model"| node_listing_model
node_review_controller -->|"updates listings"| node_listing_model
node_review_controller -->|"creates or deletes"| node_review_model
node_access_checks -->|"checks ownership"| node_listing_model
node_access_checks -->|"checks authorship"| node_review_model
node_listing_model -->|"cleans related reviews"| node_review_model
node_listing_routes -->|"configures uploads"| node_image_storage
node_app -.->|"renders pages"| node_views
node_map -.->|"shows locations"| node_visitor

click node_app "https://github.com/nehakri2005/rentify/blob/main/app.js"
click node_listing_routes "https://github.com/nehakri2005/rentify/blob/main/routes/listing.js"
click node_review_routes "https://github.com/nehakri2005/rentify/blob/main/routes/review.js"
click node_user_routes "https://github.com/nehakri2005/rentify/blob/main/routes/user.js"
click node_listing_controller "https://github.com/nehakri2005/rentify/blob/main/controllers/listing.js"
click node_review_controller "https://github.com/nehakri2005/rentify/blob/main/controllers/review.js"
click node_user_controller "https://github.com/nehakri2005/rentify/blob/main/controllers/user.js"
click node_access_checks "https://github.com/nehakri2005/rentify/blob/main/middleware.js"
click node_listing_model "https://github.com/nehakri2005/rentify/blob/main/models/listing.js"
click node_review_model "https://github.com/nehakri2005/rentify/blob/main/models/review.js"
click node_user_model "https://github.com/nehakri2005/rentify/blob/main/models/user.js"
click node_image_storage "https://github.com/nehakri2005/rentify/blob/main/cloudConfig.js"
click node_views "https://github.com/nehakri2005/rentify/tree/main/views"
click node_map "https://github.com/nehakri2005/rentify/blob/main/public/js/map.js"
click node_static_assets "https://github.com/nehakri2005/rentify/tree/main/public"

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_views,node_map,node_static_assets toneBlue
class node_user_routes,node_user_controller,node_access_checks,node_user_model toneAmber
class node_listing_controller,node_review_controller,node_listing_model,node_review_model toneMint
class node_mongo,node_image_storage toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [Express app](https://github.com/nehakri2005/rentify/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/nehakri2005/rentify/blob/main/routes/listing.js): `routes/listing.js`
- [Review routes](https://github.com/nehakri2005/rentify/blob/main/routes/review.js): `routes/review.js`
- [EJS pages](https://github.com/nehakri2005/rentify/tree/main/views): `views`
- [Map display](https://github.com/nehakri2005/rentify/blob/main/public/js/map.js): `public/js/map.js`
- [Static assets](https://github.com/nehakri2005/rentify/tree/main/public): `public`

### Identity and access

- [User routes](https://github.com/nehakri2005/rentify/blob/main/routes/user.js): `routes/user.js`
- [Account actions](https://github.com/nehakri2005/rentify/blob/main/controllers/user.js): `controllers/user.js`
- [Access and validation](https://github.com/nehakri2005/rentify/blob/main/middleware.js): `middleware.js`
- [User model](https://github.com/nehakri2005/rentify/blob/main/models/user.js): `models/user.js`

### Property and reviews

- [Listing actions](https://github.com/nehakri2005/rentify/blob/main/controllers/listing.js): `controllers/listing.js`
- [Review actions](https://github.com/nehakri2005/rentify/blob/main/controllers/review.js): `controllers/review.js`
- [Listing model](https://github.com/nehakri2005/rentify/blob/main/models/listing.js): `models/listing.js`
- [Review model](https://github.com/nehakri2005/rentify/blob/main/models/review.js): `models/review.js`

### Persistence and media

- **MongoDB**
- [Image storage config](https://github.com/nehakri2005/rentify/blob/main/cloudConfig.js): `cloudConfig.js`

### Other components

- **Renter or owner**

## Connections

- Renter or owner → Express app: sends requests
- Express app → Listing routes: routes requests (evidence: `app.js`)
- Express app → Review routes: routes requests (evidence: `app.js`)
- Express app → User routes: routes requests (evidence: `app.js`)
- Express app → MongoDB: connects to (evidence: `app.js`)
- Express app → User model: configures auth (evidence: `app.js`)
- Express app → Static assets: serves files (evidence: `app.js`)
- Listing routes → Listing actions: dispatches to (evidence: `routes/listing.js`)
- Review routes → Review actions: dispatches to (evidence: `routes/review.js`)
- User routes → Account actions: dispatches to (evidence: `routes/user.js`)
- Listing routes → Access and validation: applies checks (evidence: `routes/listing.js`)
- Review routes → Access and validation: applies checks (evidence: `routes/review.js`)
- User routes → Access and validation: applies redirect (evidence: `routes/user.js`)
- Listing actions → Listing model: uses model (evidence: `controllers/listing.js`)
- Review actions → Listing model: updates listings (evidence: `controllers/review.js`)
- Review actions → Review model: creates or deletes (evidence: `controllers/review.js`)
- Access and validation → Listing model: checks ownership (evidence: `middleware.js`)
- Access and validation → Review model: checks authorship (evidence: `middleware.js`)
- Listing model → Review model: cleans related reviews (evidence: `models/listing.js`)
- Listing routes → Image storage config: configures uploads (evidence: `routes/listing.js`)
- Express app → EJS pages: renders pages
- Map display → Renter or owner: shows locations (evidence: `README.md`)
