# infovarunapower-dev/stayxpulse architecture

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

- Interactive diagram: https://gitdiagram.com/infovarunapower-dev/stayxpulse
- Repository: https://github.com/infovarunapower-dev/stayxpulse

## Overview

StayXPulse is a hotel operations platform: hotel staff manage rooms, menus, service requests, orders, and subscriptions, while guests use QR landing pages to access hotel services. The backend also supports account access, payments, analytics, and superadmin oversight. The graph shows documented routing and module references; several page-to-API and external-service connections are omitted because their wiring was not shown in the excerpts or README.

Main entry points: [`frontend/src/App.jsx`](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/context/AuthContext.jsx`](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/context/AuthContext.jsx) (Session context), [`backend/utils/supabase.js`](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/supabase.js) (Supabase store), [`backend/middleware/auth.js`](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/middleware/auth.js) (Auth middleware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_guest["Guest QR page<br/>[GuestLanding.jsx]"]
  node_authpages["Login and registration<br/>[RegisterPage.jsx]"]
  node_app["App routing<br/>[App.jsx]"]
  node_authctx["Session context<br/>[AuthContext.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_pushmanager["Push manager<br/>[PushManager.jsx]"]
  node_pushbridge["Push bridge<br/>[pushBridge.js]"]
  node_webpush["Web push<br/>[webPush.js]"]
end

subgraph group_hotel["Hotel operations"]
  node_hotelpages["Hotel management"]
  node_orderalerts["Order alerts"]
  node_hotelroutes["Hotel API<br/>[hotel.js]"]
  node_analytics["Analytics API<br/>[analytics.js]"]
end

subgraph group_platform["Platform services"]
  node_authroutes["Authentication API<br/>[auth.js]"]
  node_authmw["Auth middleware<br/>[auth.js]"]
  node_payments["Payments API<br/>[payment.js]"]
  node_invoice["Invoice generation<br/>[invoice.js]"]
  node_easebuzz["Easebuzz integration<br/>[easebuzz.js]"]
end

subgraph group_admin["Administration"]
  node_superadmin["Superadmin API<br/>[superadmin.js]"]
  node_adminpages["Superadmin console"]
  node_emailroutes["Email settings API<br/>[email.js]"]
end

subgraph group_infra["Persistence and messaging"]
  node_database[("Supabase store<br/>[supabase.js]")]
  node_pushservice["Push service<br/>[push.js]"]
  node_emailservice["Email delivery<br/>[email.js]"]
end

node_guestactor(("Hotel guest"))
node_staffactor(("Hotel staff"))

node_guestactor -.->|"opens QR page"| node_guest
node_staffactor -.->|"uses app"| node_app
node_app -->|"provides session"| node_authctx
node_app -->|"routes to"| node_guest
node_app -->|"routes to"| node_hotelpages
node_app -->|"routes to"| node_adminpages
node_app -->|"routes to"| node_authpages
node_authctx -->|"requests"| node_api
node_authpages -->|"uses session"| node_authctx
node_api -.->|"calls API"| node_authroutes
node_pushmanager -->|"reads user"| node_authctx
node_pushmanager -->|"registers"| node_pushbridge
node_pushmanager -->|"registers"| node_webpush
node_authctx -->|"unregisters"| node_pushbridge
node_authctx -->|"unregisters"| node_webpush
node_orderalerts -->|"polls orders"| node_api
node_hotelroutes -->|"protects routes"| node_authmw
node_hotelroutes -->|"reads and writes"| node_database
node_authroutes -->|"reads and writes"| node_database
node_authmw -->|"loads user and hotel"| node_database
node_payments -->|"protects routes"| node_authmw
node_payments -->|"reads and writes"| node_database
node_payments -->|"generates invoices"| node_invoice
node_payments -->|"uses gateway"| node_easebuzz
node_superadmin -->|"protects routes"| node_authmw
node_superadmin -->|"reads and writes"| node_database
node_superadmin -->|"generates PDFs"| node_invoice
node_emailroutes -->|"protects routes"| node_authmw
node_emailroutes -->|"uses email utilities"| node_emailservice
node_pushservice -->|"stores push data"| node_database

click node_guest "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/pages/guest/GuestLanding.jsx"
click node_authpages "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/pages/auth/RegisterPage.jsx"
click node_app "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/App.jsx"
click node_authctx "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/context/AuthContext.jsx"
click node_api "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/utils/api.js"
click node_pushmanager "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/components/PushManager.jsx"
click node_pushbridge "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/utils/pushBridge.js"
click node_webpush "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/utils/webPush.js"
click node_hotelpages "https://github.com/infovarunapower-dev/stayxpulse/tree/main/frontend/src/pages/hotel"
click node_orderalerts "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/hooks/useNewOrderAlert.js"
click node_hotelroutes "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/hotel.js"
click node_analytics "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/analytics.js"
click node_authroutes "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/auth.js"
click node_authmw "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/middleware/auth.js"
click node_payments "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/payment.js"
click node_invoice "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/invoice.js"
click node_easebuzz "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/easebuzz.js"
click node_superadmin "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/superadmin.js"
click node_adminpages "https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/pages/superadmin/SuperAdminPages.jsx"
click node_emailroutes "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/email.js"
click node_database "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/supabase.js"
click node_pushservice "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/push.js"
click node_emailservice "https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/email.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_guest,node_authpages,node_app,node_authctx,node_api,node_pushmanager,node_pushbridge,node_webpush toneBlue
class node_hotelpages,node_orderalerts,node_hotelroutes,node_analytics toneAmber
class node_authroutes,node_authmw,node_payments,node_invoice,node_easebuzz toneMint
class node_superadmin,node_adminpages,node_emailroutes toneRose
class node_database,node_pushservice,node_emailservice,node_guestactor,node_staffactor toneIndigo
```

## Components

### Web client

- [Guest QR page](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/pages/guest/GuestLanding.jsx): `frontend/src/pages/guest/GuestLanding.jsx`
- [Login and registration](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/pages/auth/RegisterPage.jsx): `frontend/src/pages/auth/RegisterPage.jsx`
- [App routing](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session context](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/utils/api.js): `frontend/src/utils/api.js`
- [Push manager](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/components/PushManager.jsx): `frontend/src/components/PushManager.jsx`
- [Push bridge](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/utils/pushBridge.js): `frontend/src/utils/pushBridge.js`
- [Web push](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/utils/webPush.js): `frontend/src/utils/webPush.js`

### Hotel operations

- [Hotel management](https://github.com/infovarunapower-dev/stayxpulse/tree/main/frontend/src/pages/hotel): `frontend/src/pages/hotel`
- [Order alerts](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/hooks/useNewOrderAlert.js): `frontend/src/hooks/useNewOrderAlert.js`
- [Hotel API](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/hotel.js): `backend/routes/hotel.js`
- [Analytics API](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/analytics.js): `backend/routes/analytics.js`

### Platform services

- [Authentication API](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Auth middleware](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Payments API](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/payment.js): `backend/routes/payment.js`
- [Invoice generation](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/invoice.js): `backend/utils/invoice.js`
- [Easebuzz integration](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/easebuzz.js): `backend/utils/easebuzz.js`

### Administration

- [Superadmin API](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/superadmin.js): `backend/routes/superadmin.js`
- [Superadmin console](https://github.com/infovarunapower-dev/stayxpulse/blob/main/frontend/src/pages/superadmin/SuperAdminPages.jsx): `frontend/src/pages/superadmin/SuperAdminPages.jsx`
- [Email settings API](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/routes/email.js): `backend/routes/email.js`

### Persistence and messaging

- [Supabase store](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/supabase.js): `backend/utils/supabase.js`
- [Push service](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/push.js): `backend/utils/push.js`
- [Email delivery](https://github.com/infovarunapower-dev/stayxpulse/blob/main/backend/utils/email.js): `backend/utils/email.js`

### Other components

- **Hotel guest**
- **Hotel staff**

## Connections

- Hotel guest → Guest QR page: opens QR page
- Hotel staff → App routing: uses app
- App routing → Session context: provides session (evidence: `frontend/src/App.jsx`)
- App routing → Guest QR page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Hotel management: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Superadmin console: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Login and registration: routes to (evidence: `frontend/src/App.jsx`)
- Session context → API client: requests (evidence: `frontend/src/context/AuthContext.jsx`)
- Login and registration → Session context: uses session (evidence: `frontend/src/pages/auth/RegisterPage.jsx`)
- API client → Authentication API: calls API
- Push manager → Session context: reads user (evidence: `frontend/src/components/PushManager.jsx`)
- Push manager → Push bridge: registers (evidence: `frontend/src/components/PushManager.jsx`)
- Push manager → Web push: registers (evidence: `frontend/src/components/PushManager.jsx`)
- Session context → Push bridge: unregisters (evidence: `frontend/src/context/AuthContext.jsx`)
- Session context → Web push: unregisters (evidence: `frontend/src/context/AuthContext.jsx`)
- Order alerts → API client: polls orders (evidence: `frontend/src/hooks/useNewOrderAlert.js`)
- Hotel API → Auth middleware: protects routes (evidence: `backend/routes/hotel.js`)
- Hotel API → Supabase store: reads and writes (evidence: `backend/routes/hotel.js`)
- Authentication API → Supabase store: reads and writes (evidence: `backend/routes/auth.js`)
- Auth middleware → Supabase store: loads user and hotel (evidence: `backend/middleware/auth.js`)
- Payments API → Auth middleware: protects routes (evidence: `backend/routes/payment.js`)
- Payments API → Supabase store: reads and writes (evidence: `backend/routes/payment.js`)
- Payments API → Invoice generation: generates invoices (evidence: `backend/routes/payment.js`)
- Payments API → Easebuzz integration: uses gateway (evidence: `backend/routes/payment.js`)
- Superadmin API → Auth middleware: protects routes (evidence: `backend/routes/superadmin.js`)
- Superadmin API → Supabase store: reads and writes (evidence: `backend/routes/superadmin.js`)
- Superadmin API → Invoice generation: generates PDFs (evidence: `backend/routes/superadmin.js`)
- Email settings API → Auth middleware: protects routes (evidence: `backend/routes/email.js`)
- Email settings API → Email delivery: uses email utilities (evidence: `backend/routes/email.js`)
- Push service → Supabase store: stores push data (evidence: `backend/utils/push.js`)
