# sharvesh3ker/hotel-web-app architecture

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

- Interactive diagram: https://gitdiagram.com/sharvesh3ker/hotel-web-app
- Repository: https://github.com/sharvesh3ker/hotel-web-app

## Overview

StayFinder is a hotel discovery and host-listing CRUD application. Guests browse, search and filter listings, paginate results, and open hotel details; hosts can sign in and create, edit, or delete listings, including image uploads. The frontend fetches hotel data from the backend, which the README describes as using PostgreSQL and native SQL. The README also documents demo listings when the backend is unavailable. Backend internals were not excerpted, so database and authentication relationships below rely on README statements rather than inspected server implementation.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/App.jsx) (Route application), [`backend/src/server.js`](https://github.com/sharvesh3ker/hotel-web-app/blob/main/backend/src/server.js) (Hotel and session API), [`frontend/src/pages/HotelList.jsx`](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelList.jsx) (Hotel catalog), [`frontend/src/store/hotelsSlice.js`](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/store/hotelsSlice.js) (Hotel state and API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Hotel discovery"]
  node_catalog["Hotel catalog<br/>[HotelList.jsx]"]
  node_cards["Hotel cards<br/>[HotelCard.jsx]"]
  node_pagination["Pagination<br/>[Pagination.jsx]"]
  node_details["Hotel details<br/>[HotelDetail.jsx]"]
  node_map["OpenStreetMap"]
end

subgraph group_frontend["Frontend experience"]
  node_app["Route application<br/>[App.jsx]"]
  node_header["Site navigation<br/>[Header.jsx]"]
  node_auth["Auth context<br/>[AuthContext.jsx]"]
  node_form["Listing editor<br/>[HotelForm.jsx]"]
  node_state["Hotel state and API<br/>[hotelsSlice.js]"]
  node_store["Redux store<br/>[store.js]"]
end

subgraph group_backend["Listing services"]
  node_api["Hotel and session API<br/>[server.js]"]
  node_uploads["Image uploads"]
end

subgraph group_persistence["Persistence and media"]
  node_database[("Hotel database<br/>[schema.sql]")]
end

node_guest(("Guest"))
node_host(("Host"))

node_guest -->|"browses"| node_app
node_host -->|"manages listings"| node_app
node_app -->|"renders"| node_header
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_form
node_catalog -->|"dispatches fetch"| node_state
node_catalog -->|"renders"| node_cards
node_catalog -->|"renders"| node_pagination
node_details -->|"loads hotel"| node_state
node_details -->|"embeds map"| node_map
node_form -->|"uses API helpers"| node_state
node_cards -->|"updates listing"| node_api
node_catalog -->|"deletes listing"| node_api
node_state -->|"fetches listings"| node_api
node_store -->|"registers reducer"| node_state
node_app -->|"wrapped by"| node_auth
node_api -->|"CRUD via SQL"| node_database
node_api -.->|"stores uploads"| node_uploads
node_host -.->|"signs in"| node_api
node_guest -.->|"views location"| node_map

click node_app "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/App.jsx"
click node_header "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/components/Header.jsx"
click node_auth "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/auth/AuthContext.jsx"
click node_catalog "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelList.jsx"
click node_cards "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/components/HotelCard.jsx"
click node_pagination "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/components/Pagination.jsx"
click node_details "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelDetail.jsx"
click node_form "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelForm.jsx"
click node_state "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/store/hotelsSlice.js"
click node_store "https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/store/store.js"
click node_api "https://github.com/sharvesh3ker/hotel-web-app/blob/main/backend/src/server.js"
click node_uploads "https://github.com/sharvesh3ker/hotel-web-app/tree/main/backend/src/uploads"
click node_database "https://github.com/sharvesh3ker/hotel-web-app/blob/main/backend/schema.sql"

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_catalog,node_cards,node_pagination,node_details,node_map toneBlue
class node_app,node_header,node_auth,node_form,node_state,node_store toneAmber
class node_api,node_uploads toneMint
class node_database toneRose
class node_guest,node_host toneIndigo
```

## Components

### Hotel discovery

- [Hotel catalog](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelList.jsx): `frontend/src/pages/HotelList.jsx`
- [Hotel cards](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/components/HotelCard.jsx): `frontend/src/components/HotelCard.jsx`
- [Pagination](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/components/Pagination.jsx): `frontend/src/components/Pagination.jsx`
- [Hotel details](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelDetail.jsx): `frontend/src/pages/HotelDetail.jsx`
- **OpenStreetMap**

### Frontend experience

- [Route application](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Site navigation](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/components/Header.jsx): `frontend/src/components/Header.jsx`
- [Auth context](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/auth/AuthContext.jsx): `frontend/src/auth/AuthContext.jsx`
- [Listing editor](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/pages/HotelForm.jsx): `frontend/src/pages/HotelForm.jsx`
- [Hotel state and API](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/store/hotelsSlice.js): `frontend/src/store/hotelsSlice.js`
- [Redux store](https://github.com/sharvesh3ker/hotel-web-app/blob/main/frontend/src/store/store.js): `frontend/src/store/store.js`

### Listing services

- [Hotel and session API](https://github.com/sharvesh3ker/hotel-web-app/blob/main/backend/src/server.js): `backend/src/server.js`
- [Image uploads](https://github.com/sharvesh3ker/hotel-web-app/tree/main/backend/src/uploads): `backend/src/uploads`

### Persistence and media

- [Hotel database](https://github.com/sharvesh3ker/hotel-web-app/blob/main/backend/schema.sql): `backend/schema.sql`

### Other components

- **Guest**
- **Host**

## Connections

- Guest → Route application: browses (evidence: `README.md`)
- Host → Route application: manages listings (evidence: `README.md`)
- Route application → Site navigation: renders (evidence: `frontend/src/App.jsx`)
- Route application → Hotel catalog: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Hotel details: routes to (evidence: `frontend/src/App.jsx`)
- Route application → Listing editor: routes to (evidence: `frontend/src/App.jsx`)
- Hotel catalog → Hotel state and API: dispatches fetch (evidence: `frontend/src/pages/HotelList.jsx`)
- Hotel catalog → Hotel cards: renders (evidence: `frontend/src/pages/HotelList.jsx`)
- Hotel catalog → Pagination: renders (evidence: `frontend/src/pages/HotelList.jsx`)
- Hotel details → Hotel state and API: loads hotel (evidence: `frontend/src/pages/HotelDetail.jsx`)
- Hotel details → OpenStreetMap: embeds map (evidence: `frontend/src/pages/HotelDetail.jsx`)
- Listing editor → Hotel state and API: uses API helpers (evidence: `frontend/src/pages/HotelForm.jsx`)
- Hotel cards → Hotel and session API: updates listing (evidence: `frontend/src/components/HotelCard.jsx`)
- Hotel catalog → Hotel and session API: deletes listing (evidence: `frontend/src/pages/HotelList.jsx`)
- Hotel state and API → Hotel and session API: fetches listings (evidence: `frontend/src/store/hotelsSlice.js`)
- Redux store → Hotel state and API: registers reducer (evidence: `frontend/src/store/store.js`)
- Route application → Auth context: wrapped by (evidence: `frontend/src/main.jsx`)
- Hotel and session API → Hotel database: CRUD via SQL (evidence: `README.md`)
- Hotel and session API → Image uploads: stores uploads
- Host → Hotel and session API: signs in (evidence: `README.md`)
- Guest → OpenStreetMap: views location
