# kvreddy9120/3-tier-full-stack-yelp-camp architecture

> Architecture diagram of the GitHub repository kvreddy9120/3-tier-full-stack-yelp-camp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kvreddy9120/3-tier-full-stack-yelp-camp
- Repository: https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp

## Overview

Yelp Camp is an Express web application for browsing, creating, editing, and reviewing campgrounds, with user accounts, image uploads, and location maps. The main request flow runs from a visitor through the app’s mounted routes and authorization/validation middleware to controllers, which read or update MongoDB-backed models and render pages or redirect. Campground images use Cloudinary; Mapbox powers the documented map capability. The excerpts support the main route, controller, and model relationships; map-to-page wiring is not shown, so it is left unclaimed.

Main entry points: [`app.js`](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/app.js) (Express app), [`middleware.js`](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/middleware.js) (Access and validation), [`models/campground.js`](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/campground.js) (Campground model), [`controllers/campgrounds.js`](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/campgrounds.js) (Campground operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and pages"]
  node_app["Express app<br/>[app.js]"]
  node_campground_routes["Campground routes<br/>[campgrounds.js]"]
  node_review_routes["Review routes<br/>[reviews.js]"]
  node_campground_views["Campground pages"]
  node_home_view["Home page<br/>[home.ejs]"]
end

subgraph group_domain["Campground and reviews"]
  node_campground_controller["Campground operations<br/>[campgrounds.js]"]
  node_review_controller["Review operations<br/>[reviews.js]"]
  node_campground_model["Campground model<br/>[campground.js]"]
  node_review_model["Review model<br/>[review.js]"]
  node_validation_schemas["Input schemas<br/>[schemas.js]"]
end

subgraph group_identity["Accounts and access"]
  node_user_routes["User routes<br/>[users.js]"]
  node_user_views["Account pages"]
  node_access_middleware["Access and validation<br/>[middleware.js]"]
  node_user_controller["Account operations<br/>[users.js]"]
  node_user_model["User model<br/>[user.js]"]
end

subgraph group_services["Persistence and integrations"]
  node_mongo[("MongoDB")]
  node_cloudinary_adapter["Image storage adapter<br/>[index.js]"]
  node_cloudinary_service["Cloudinary"]
end

subgraph group_browser["Browser maps"]
  node_map_cluster["Cluster map<br/>[clusterMap.js]"]
  node_map_detail["Campground map<br/>[showPageMap.js]"]
  node_mapbox["Mapbox"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests pages"| node_app
node_app -->|"mounts routes"| node_campground_routes
node_app -->|"mounts routes"| node_review_routes
node_app -->|"mounts routes"| node_user_routes
node_app -->|"connects to"| node_mongo
node_campground_routes -->|"checks access"| node_access_middleware
node_review_routes -->|"checks access"| node_access_middleware
node_campground_routes -->|"dispatches to"| node_campground_controller
node_review_routes -->|"dispatches to"| node_review_controller
node_user_routes -->|"dispatches to"| node_user_controller
node_access_middleware -->|"validates input"| node_validation_schemas
node_access_middleware -->|"loads campground"| node_campground_model
node_access_middleware -->|"loads review"| node_review_model
node_campground_controller -->|"reads and writes"| node_campground_model
node_campground_controller -->|"renders pages"| node_campground_views
node_campground_controller -->|"manages images"| node_cloudinary_adapter
node_review_controller -->|"updates campground"| node_campground_model
node_review_controller -->|"saves review"| node_review_model
node_user_controller -->|"manages accounts"| node_user_model
node_user_controller -->|"renders pages"| node_user_views
node_app -->|"renders home"| node_home_view
node_campground_model -->|"deletes related reviews"| node_review_model
node_campground_model -->|"deletes stored images"| node_cloudinary_adapter
node_cloudinary_adapter -->|"uploads and deletes"| node_cloudinary_service
node_app -->|"serves static assets"| node_map_cluster
node_app -->|"serves static assets"| node_map_detail
node_map_cluster -.->|"uses maps"| node_mapbox
node_map_detail -.->|"uses maps"| node_mapbox

click node_app "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/app.js"
click node_campground_routes "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/routes/campgrounds.js"
click node_review_routes "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/routes/reviews.js"
click node_user_routes "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/routes/users.js"
click node_campground_views "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/tree/main/views/campgrounds"
click node_user_views "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/tree/main/views/users"
click node_home_view "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/views/home.ejs"
click node_access_middleware "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/middleware.js"
click node_campground_controller "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/campgrounds.js"
click node_review_controller "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/reviews.js"
click node_user_controller "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/users.js"
click node_campground_model "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/campground.js"
click node_review_model "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/review.js"
click node_user_model "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/user.js"
click node_validation_schemas "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/schemas.js"
click node_cloudinary_adapter "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/cloudinary/index.js"
click node_map_cluster "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/public/javascripts/clusterMap.js"
click node_map_detail "https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/public/javascripts/showPageMap.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_campground_routes,node_review_routes,node_campground_views,node_home_view toneBlue
class node_campground_controller,node_review_controller,node_campground_model,node_review_model,node_validation_schemas toneAmber
class node_user_routes,node_user_views,node_access_middleware,node_user_controller,node_user_model toneMint
class node_mongo,node_cloudinary_adapter,node_cloudinary_service toneRose
class node_map_cluster,node_map_detail,node_mapbox,node_visitor toneIndigo
```

## Components

### Web entry and pages

- [Express app](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/app.js): `app.js`
- [Campground routes](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/routes/campgrounds.js): `routes/campgrounds.js`
- [Review routes](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/routes/reviews.js): `routes/reviews.js`
- [Campground pages](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/tree/main/views/campgrounds): `views/campgrounds`
- [Home page](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/views/home.ejs): `views/home.ejs`

### Campground and reviews

- [Campground operations](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/campgrounds.js): `controllers/campgrounds.js`
- [Review operations](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/reviews.js): `controllers/reviews.js`
- [Campground model](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/campground.js): `models/campground.js`
- [Review model](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/review.js): `models/review.js`
- [Input schemas](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/schemas.js): `schemas.js`

### Accounts and access

- [User routes](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/routes/users.js): `routes/users.js`
- [Account pages](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/tree/main/views/users): `views/users`
- [Access and validation](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/middleware.js): `middleware.js`
- [Account operations](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/controllers/users.js): `controllers/users.js`
- [User model](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/models/user.js): `models/user.js`

### Persistence and integrations

- **MongoDB**
- [Image storage adapter](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/cloudinary/index.js): `cloudinary/index.js`
- **Cloudinary**

### Browser maps

- [Cluster map](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/public/javascripts/clusterMap.js): `public/javascripts/clusterMap.js`
- [Campground map](https://github.com/kvreddy9120/3-tier-full-stack-yelp-camp/blob/main/public/javascripts/showPageMap.js): `public/javascripts/showPageMap.js`
- **Mapbox**

### Other components

- **Visitor**

## Connections

- Visitor → Express app: requests pages (evidence: `app.js`)
- Express app → Campground routes: mounts routes (evidence: `app.js`)
- Express app → Review routes: mounts routes (evidence: `app.js`)
- Express app → User routes: mounts routes (evidence: `app.js`)
- Express app → MongoDB: connects to (evidence: `app.js`)
- Campground routes → Access and validation: checks access (evidence: `routes/campgrounds.js`)
- Review routes → Access and validation: checks access (evidence: `routes/reviews.js`)
- Campground routes → Campground operations: dispatches to (evidence: `routes/campgrounds.js`)
- Review routes → Review operations: dispatches to (evidence: `routes/reviews.js`)
- User routes → Account operations: dispatches to (evidence: `routes/users.js`)
- Access and validation → Input schemas: validates input (evidence: `middleware.js`)
- Access and validation → Campground model: loads campground (evidence: `middleware.js`)
- Access and validation → Review model: loads review (evidence: `middleware.js`)
- Campground operations → Campground model: reads and writes (evidence: `controllers/campgrounds.js`)
- Campground operations → Campground pages: renders pages (evidence: `controllers/campgrounds.js`)
- Campground operations → Image storage adapter: manages images (evidence: `controllers/campgrounds.js`)
- Review operations → Campground model: updates campground (evidence: `controllers/reviews.js`)
- Review operations → Review model: saves review (evidence: `controllers/reviews.js`)
- Account operations → User model: manages accounts (evidence: `controllers/users.js`)
- Account operations → Account pages: renders pages (evidence: `controllers/users.js`)
- Express app → Home page: renders home (evidence: `app.js`)
- Campground model → Review model: deletes related reviews (evidence: `models/campground.js`)
- Campground model → Image storage adapter: deletes stored images (evidence: `models/campground.js`)
- Image storage adapter → Cloudinary: uploads and deletes (evidence: `cloudinary/index.js`)
- Express app → Cluster map: serves static assets (evidence: `app.js`)
- Express app → Campground map: serves static assets (evidence: `app.js`)
- Cluster map → Mapbox: uses maps
- Campground map → Mapbox: uses maps
