# duttaabhirupdev10/camp_vista architecture

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

- Interactive diagram: https://gitdiagram.com/duttaabhirupdev10/camp_vista
- Repository: https://github.com/duttaabhirupdev10/camp_vista

## Overview

CampVista is an Express campground-booking application with customer, owner, and admin roles. Users register or log in, browse and view campgrounds, then submit booking dates and confirm a pending booking; owners manage their campgrounds and bookings, while users can leave reviews. Controllers coordinate domain services/models and EJS pages. The sampled code establishes several call paths; booking, owner, and campground persistence details are partly unsampled, so uncertain internal wiring is omitted. The README describes broader admin capabilities than the supplied tree supports.

Main entry points: [`app.js`](https://github.com/duttaabhirupdev10/camp_vista/blob/main/app.js) (Express app), [`utils/supabase.js`](https://github.com/duttaabhirupdev10/camp_vista/blob/main/utils/supabase.js) (Supabase client), [`routes/campgroundRoutes.js`](https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/campgroundRoutes.js) (Campground routes), [`controllers/bookingController.js`](https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/bookingController.js) (Booking controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry and pages"]
  node_app["Express app<br/>[app.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_camp_routes["Campground routes"]
  node_review_routes["Review routes<br/>[reviewRoutes.js]"]
  node_booking_routes["Booking routes<br/>[bookingRoutes.js]"]
  node_owner_routes["Owner routes<br/>[ownerRoutes.js]"]
  node_views["EJS views"]
end

subgraph group_identity["Identity and access"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
  node_auth_service["Auth service<br/>[authService.js]"]
  node_auth_middleware["Login middleware<br/>[auth.js]"]
  node_role_middleware["Role checks<br/>[role.js]"]
  node_owner_middleware["Ownership checks<br/>[owner.js]"]
end

subgraph group_campgrounds["Campground and reviews"]
  node_camp_controller["Campground controller"]
  node_camp_service["Campground service"]
  node_review_controller["Review controller"]
end

subgraph group_reservations["Bookings and ownership"]
  node_booking_controller["Booking controller"]
  node_owner_controller["Owner controller<br/>[ownerController.js]"]
end

subgraph group_data["Data and integrations"]
  node_camp_model["Campground model<br/>[campgroundModel.js]"]
  node_review_model["Review model<br/>[reviewModel.js]"]
  node_user_model["User model<br/>[userModel.js]"]
  node_booking_model["Booking model<br/>[bookingModel.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
end

node_visitor(("User"))
node_supabase[("Supabase services")]

node_visitor -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_authroutes
node_app -->|"mounts routes"| node_camp_routes
node_app -->|"mounts routes"| node_review_routes
node_app -->|"mounts routes"| node_booking_routes
node_app -->|"mounts routes"| node_owner_routes
node_authroutes -->|"dispatches"| node_auth_controller
node_camp_routes -->|"dispatches"| node_camp_controller
node_review_routes -->|"dispatches"| node_review_controller
node_booking_routes -->|"dispatches"| node_booking_controller
node_owner_routes -->|"dispatches"| node_owner_controller
node_camp_routes -->|"checks login"| node_auth_middleware
node_camp_routes -->|"checks role"| node_role_middleware
node_camp_routes -->|"checks ownership"| node_owner_middleware
node_review_routes -->|"checks login"| node_auth_middleware
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"uses"| node_supabase_client
node_auth_service -->|"reads and writes"| node_user_model
node_supabase_client -->|"auth and data calls"| node_supabase
node_camp_controller -->|"calls"| node_camp_service
node_camp_controller -->|"renders campground pages"| node_views
node_auth_controller -->|"renders account pages"| node_views
node_booking_controller -->|"loads campground"| node_camp_model
node_booking_controller -->|"creates and lists bookings"| node_booking_model
node_booking_controller -->|"renders booking pages"| node_views
node_app -->|"counts owner bookings"| node_booking_model
node_owner_controller -->|"renders management page"| node_views
node_review_controller -->|"creates and reads reviews"| node_review_model
node_review_controller -->|"checks duplicate reviews"| node_supabase_client
node_review_model -->|"reads and writes"| node_supabase_client
node_camp_service -->|"uses"| node_camp_model
node_camp_model -->|"uses"| node_supabase_client
node_user_model -->|"uses"| node_supabase_client
node_booking_model -->|"uses"| node_supabase_client

click node_app "https://github.com/duttaabhirupdev10/camp_vista/blob/main/app.js"
click node_authroutes "https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/authRoutes.js"
click node_camp_routes "https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/campgroundRoutes.js"
click node_review_routes "https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/reviewRoutes.js"
click node_booking_routes "https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/bookingRoutes.js"
click node_owner_routes "https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/ownerRoutes.js"
click node_views "https://github.com/duttaabhirupdev10/camp_vista/tree/main/views"
click node_auth_controller "https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/authController.js"
click node_auth_service "https://github.com/duttaabhirupdev10/camp_vista/blob/main/services/authService.js"
click node_auth_middleware "https://github.com/duttaabhirupdev10/camp_vista/blob/main/middleware/auth.js"
click node_role_middleware "https://github.com/duttaabhirupdev10/camp_vista/blob/main/middleware/role.js"
click node_owner_middleware "https://github.com/duttaabhirupdev10/camp_vista/blob/main/middleware/owner.js"
click node_camp_controller "https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/campgroundController.js"
click node_camp_service "https://github.com/duttaabhirupdev10/camp_vista/blob/main/services/campgroundService.js"
click node_review_controller "https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/reviewController.js"
click node_camp_model "https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/campgroundModel.js"
click node_review_model "https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/reviewModel.js"
click node_user_model "https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/userModel.js"
click node_booking_controller "https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/bookingController.js"
click node_owner_controller "https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/ownerController.js"
click node_booking_model "https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/bookingModel.js"
click node_supabase_client "https://github.com/duttaabhirupdev10/camp_vista/blob/main/utils/supabase.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_authroutes,node_camp_routes,node_review_routes,node_booking_routes,node_owner_routes,node_views,node_visitor toneBlue
class node_auth_controller,node_auth_service,node_auth_middleware,node_role_middleware,node_owner_middleware,node_supabase toneAmber
class node_camp_controller,node_camp_service,node_review_controller toneMint
class node_booking_controller,node_owner_controller toneRose
class node_camp_model,node_review_model,node_user_model,node_booking_model,node_supabase_client toneIndigo
```

## Components

### Web entry and pages

- [Express app](https://github.com/duttaabhirupdev10/camp_vista/blob/main/app.js): `app.js`
- [Auth routes](https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/authRoutes.js): `routes/authRoutes.js`
- [Campground routes](https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/campgroundRoutes.js): `routes/campgroundRoutes.js`
- [Review routes](https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/reviewRoutes.js): `routes/reviewRoutes.js`
- [Booking routes](https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/bookingRoutes.js): `routes/bookingRoutes.js`
- [Owner routes](https://github.com/duttaabhirupdev10/camp_vista/blob/main/routes/ownerRoutes.js): `routes/ownerRoutes.js`
- [EJS views](https://github.com/duttaabhirupdev10/camp_vista/tree/main/views): `views`

### Identity and access

- [Auth controller](https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/authController.js): `controllers/authController.js`
- [Auth service](https://github.com/duttaabhirupdev10/camp_vista/blob/main/services/authService.js): `services/authService.js`
- [Login middleware](https://github.com/duttaabhirupdev10/camp_vista/blob/main/middleware/auth.js): `middleware/auth.js`
- [Role checks](https://github.com/duttaabhirupdev10/camp_vista/blob/main/middleware/role.js): `middleware/role.js`
- [Ownership checks](https://github.com/duttaabhirupdev10/camp_vista/blob/main/middleware/owner.js): `middleware/owner.js`

### Campground and reviews

- [Campground controller](https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/campgroundController.js): `controllers/campgroundController.js`
- [Campground service](https://github.com/duttaabhirupdev10/camp_vista/blob/main/services/campgroundService.js): `services/campgroundService.js`
- [Review controller](https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/reviewController.js): `controllers/reviewController.js`

### Bookings and ownership

- [Booking controller](https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/bookingController.js): `controllers/bookingController.js`
- [Owner controller](https://github.com/duttaabhirupdev10/camp_vista/blob/main/controllers/ownerController.js): `controllers/ownerController.js`

### Data and integrations

- [Campground model](https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/campgroundModel.js): `models/campgroundModel.js`
- [Review model](https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/reviewModel.js): `models/reviewModel.js`
- [User model](https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/userModel.js): `models/userModel.js`
- [Booking model](https://github.com/duttaabhirupdev10/camp_vista/blob/main/models/bookingModel.js): `models/bookingModel.js`
- [Supabase client](https://github.com/duttaabhirupdev10/camp_vista/blob/main/utils/supabase.js): `utils/supabase.js`

### Other components

- **User**
- **Supabase services**

## Connections

- User → Express app: sends requests
- Express app → Auth routes: mounts routes
- Express app → Campground routes: mounts routes
- Express app → Review routes: mounts routes
- Express app → Booking routes: mounts routes
- Express app → Owner routes: mounts routes
- Auth routes → Auth controller: dispatches
- Campground routes → Campground controller: dispatches
- Review routes → Review controller: dispatches
- Booking routes → Booking controller: dispatches
- Owner routes → Owner controller: dispatches
- Campground routes → Login middleware: checks login
- Campground routes → Role checks: checks role
- Campground routes → Ownership checks: checks ownership
- Review routes → Login middleware: checks login
- Auth controller → Auth service: calls
- Auth service → Supabase client: uses
- Auth service → User model: reads and writes
- Supabase client → Supabase services: auth and data calls
- Campground controller → Campground service: calls
- Campground controller → EJS views: renders campground pages
- Auth controller → EJS views: renders account pages
- Booking controller → Campground model: loads campground
- Booking controller → Booking model: creates and lists bookings
- Booking controller → EJS views: renders booking pages
- Express app → Booking model: counts owner bookings
- Owner controller → EJS views: renders management page
- Review controller → Review model: creates and reads reviews
- Review controller → Supabase client: checks duplicate reviews
- Review model → Supabase client: reads and writes
- Campground service → Campground model: uses
- Campground model → Supabase client: uses
- User model → Supabase client: uses
- Booking model → Supabase client: uses
