# arshh0-0/roamly architecture

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

- Interactive diagram: https://gitdiagram.com/arshh0-0/roamly
- Repository: https://github.com/arshh0-0/roamly

## Overview

Roamly is a lodging-listing web application. Visitors browse and filter listings; registered users can create, edit, and delete listings, upload images, and add or remove reviews. Express routes dispatch requests to controllers, which use Mongoose models for listings, reviews, and users; listing creation and updates also geocode locations. The README provides only a demo link and account, so capabilities beyond the shown code are not inferred. Relationships are limited to those visible in excerpts or the source index.

Main entry points: [`app.js`](https://github.com/arshh0-0/roamly/blob/main/app.js) (Express app), [`middleware.js`](https://github.com/arshh0-0/roamly/blob/main/middleware.js) (Auth and validation), [`routes/listing.js`](https://github.com/arshh0-0/roamly/blob/main/routes/listing.js) (Listing routes), [`controllers/listings.js`](https://github.com/arshh0-0/roamly/blob/main/controllers/listings.js) (Listing controller)

## 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]"]
end

subgraph group_listings["Listing management"]
  node_listing_controller["Listing controller<br/>[listings.js]"]
  node_listing_model["Listing model<br/>[listing.js]"]
  node_listing_views["Listing pages"]
  node_map_client["Map client<br/>[map.js]"]
end

subgraph group_reviews["Reviews"]
  node_review_controller["Review controller<br/>[reviews.js]"]
  node_review_model["Review model<br/>[review.js]"]
end

subgraph group_identity["Accounts and validation"]
  node_user_controller["User controller<br/>[users.js]"]
  node_user_model["User model<br/>[user.js]"]
  node_middleware["Auth and validation<br/>[middleware.js]"]
  node_validation_schema["Validation schemas<br/>[schema.js]"]
end

subgraph group_integrations["Data and media"]
  node_cloud_config["Image storage config<br/>[cloudConfig.js]"]
  node_mongo[("MongoDB")]
  node_geocoder["Mapbox geocoding"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests"| node_app
node_app -->|"mounts"| node_listing_routes
node_app -->|"mounts"| node_review_routes
node_app -->|"mounts"| node_user_routes
node_app -->|"connects"| node_mongo
node_listing_routes -->|"dispatches"| node_listing_controller
node_listing_routes -->|"checks"| node_middleware
node_listing_routes -->|"configures upload"| node_cloud_config
node_listing_controller -->|"queries and saves"| node_listing_model
node_listing_controller -->|"geocodes location"| node_geocoder
node_listing_controller -->|"renders"| node_listing_views
node_review_routes -->|"dispatches"| node_review_controller
node_review_routes -->|"checks"| node_middleware
node_review_controller -->|"updates listing"| node_listing_model
node_review_controller -->|"creates and deletes"| node_review_model
node_listing_model -->|"deletes associated reviews"| node_review_model
node_user_routes -->|"dispatches"| node_user_controller
node_user_routes -->|"saves redirect"| node_middleware
node_user_controller -->|"uses account model"| node_user_model
node_app -->|"configures Passport"| node_user_model
node_middleware -->|"checks ownership"| node_listing_model
node_middleware -->|"checks authorship"| node_review_model
node_middleware -->|"validates input"| node_validation_schema

click node_app "https://github.com/arshh0-0/roamly/blob/main/app.js"
click node_listing_routes "https://github.com/arshh0-0/roamly/blob/main/routes/listing.js"
click node_review_routes "https://github.com/arshh0-0/roamly/blob/main/routes/review.js"
click node_user_routes "https://github.com/arshh0-0/roamly/blob/main/routes/user.js"
click node_listing_controller "https://github.com/arshh0-0/roamly/blob/main/controllers/listings.js"
click node_listing_model "https://github.com/arshh0-0/roamly/blob/main/models/listing.js"
click node_listing_views "https://github.com/arshh0-0/roamly/tree/main/views/listings"
click node_map_client "https://github.com/arshh0-0/roamly/blob/main/public/js/map.js"
click node_review_controller "https://github.com/arshh0-0/roamly/blob/main/controllers/reviews.js"
click node_review_model "https://github.com/arshh0-0/roamly/blob/main/models/review.js"
click node_user_controller "https://github.com/arshh0-0/roamly/blob/main/controllers/users.js"
click node_user_model "https://github.com/arshh0-0/roamly/blob/main/models/user.js"
click node_middleware "https://github.com/arshh0-0/roamly/blob/main/middleware.js"
click node_validation_schema "https://github.com/arshh0-0/roamly/blob/main/schema.js"
click node_cloud_config "https://github.com/arshh0-0/roamly/blob/main/cloudConfig.js"

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_controller,node_listing_model,node_listing_views,node_map_client toneAmber
class node_review_controller,node_review_model toneMint
class node_user_controller,node_user_model,node_middleware,node_validation_schema toneRose
class node_cloud_config,node_mongo,node_geocoder,node_visitor toneIndigo
```

## Components

### Web application

- [Express app](https://github.com/arshh0-0/roamly/blob/main/app.js): `app.js`
- [Listing routes](https://github.com/arshh0-0/roamly/blob/main/routes/listing.js): `routes/listing.js`
- [Review routes](https://github.com/arshh0-0/roamly/blob/main/routes/review.js): `routes/review.js`
- [Account routes](https://github.com/arshh0-0/roamly/blob/main/routes/user.js): `routes/user.js`

### Listing management

- [Listing controller](https://github.com/arshh0-0/roamly/blob/main/controllers/listings.js): `controllers/listings.js`
- [Listing model](https://github.com/arshh0-0/roamly/blob/main/models/listing.js): `models/listing.js`
- [Listing pages](https://github.com/arshh0-0/roamly/tree/main/views/listings): `views/listings`
- [Map client](https://github.com/arshh0-0/roamly/blob/main/public/js/map.js): `public/js/map.js`

### Reviews

- [Review controller](https://github.com/arshh0-0/roamly/blob/main/controllers/reviews.js): `controllers/reviews.js`
- [Review model](https://github.com/arshh0-0/roamly/blob/main/models/review.js): `models/review.js`

### Accounts and validation

- [User controller](https://github.com/arshh0-0/roamly/blob/main/controllers/users.js): `controllers/users.js`
- [User model](https://github.com/arshh0-0/roamly/blob/main/models/user.js): `models/user.js`
- [Auth and validation](https://github.com/arshh0-0/roamly/blob/main/middleware.js): `middleware.js`
- [Validation schemas](https://github.com/arshh0-0/roamly/blob/main/schema.js): `schema.js`

### Data and media

- [Image storage config](https://github.com/arshh0-0/roamly/blob/main/cloudConfig.js): `cloudConfig.js`
- **MongoDB**
- **Mapbox geocoding**

### Other components

- **Visitor**

## Connections

- Visitor → Express app: requests (evidence: `app.js`)
- Express app → Listing routes: mounts (evidence: `app.js`)
- Express app → Review routes: mounts (evidence: `app.js`)
- Express app → Account routes: mounts (evidence: `app.js`)
- Express app → MongoDB: connects (evidence: `app.js`)
- Listing routes → Listing controller: dispatches (evidence: `routes/listing.js`)
- Listing routes → Auth and validation: checks (evidence: `routes/listing.js`)
- Listing routes → Image storage config: configures upload (evidence: `routes/listing.js`)
- Listing controller → Listing model: queries and saves (evidence: `controllers/listings.js`)
- Listing controller → Mapbox geocoding: geocodes location (evidence: `controllers/listings.js`)
- Listing controller → Listing pages: renders (evidence: `controllers/listings.js`)
- Review routes → Review controller: dispatches (evidence: `routes/review.js`)
- Review routes → Auth and validation: checks (evidence: `routes/review.js`)
- Review controller → Listing model: updates listing (evidence: `controllers/reviews.js`)
- Review controller → Review model: creates and deletes (evidence: `controllers/reviews.js`)
- Listing model → Review model: deletes associated reviews (evidence: `models/listing.js`)
- Account routes → User controller: dispatches (evidence: `routes/user.js`)
- Account routes → Auth and validation: saves redirect (evidence: `routes/user.js`)
- User controller → User model: uses account model (evidence: `controllers/users.js`)
- Express app → User model: configures Passport (evidence: `app.js`)
- Auth and validation → Listing model: checks ownership (evidence: `middleware.js`)
- Auth and validation → Review model: checks authorship (evidence: `middleware.js`)
- Auth and validation → Validation schemas: validates input (evidence: `middleware.js`)
