# echodot07/onepms architecture

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

- Interactive diagram: https://gitdiagram.com/echodot07/onepms
- Repository: https://github.com/echodot07/onepms

## Overview

OnePMS is a hotel property-management system: staff use its React screens to manage reservations, rooms, guests, payments, operations, and reporting through a Fastify API backed by PostgreSQL. The central workflow is reservation and guest management, followed by stay/folio and payment handling, with room operations and close-day audit/reporting as connected hotel workflows. The README documents additional capabilities including device and document workflows, imports, and channel distribution. Edges are limited to relationships shown in excerpts, source-index references, or README statements; unsampled route internals are not inferred.

Main entry points: [`packages/db/src/schema`](https://github.com/echodot07/onepms/tree/main/packages/db/src/schema) (PostgreSQL schema), [`apps/api/src/app.ts`](https://github.com/echodot07/onepms/blob/main/apps/api/src/app.ts) (API application), [`apps/web/src/App.tsx`](https://github.com/echodot07/onepms/blob/main/apps/web/src/App.tsx) (PMS screens), [`apps/api/src/routes/auth.ts`](https://github.com/echodot07/onepms/blob/main/apps/api/src/routes/auth.ts) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Staff interface"]
  node_screens["PMS screens<br/>[App.tsx]"]
  node_api_client["Web API client<br/>[api.ts]"]
  node_auth_ui["Sign-in screens<br/>[Auth.tsx]"]
  node_channel_ui["Channel manager<br/>[ChannelManager.tsx]"]
end

subgraph group_api["PMS services"]
  node_api_app["API application<br/>[app.ts]"]
  node_auth_routes["Authentication routes<br/>[auth.ts]"]
  node_identity["Sessions and permissions<br/>[auth.ts]"]
  node_audit["Change history<br/>[audit.ts]"]
  node_reservations["Reservations and stays<br/>[reservations.ts]"]
  node_billing["Folios and billing<br/>[billing.ts]"]
  node_night_audit["Night audit reports<br/>[auditReports.ts]"]
  node_channels["Channel distribution<br/>[channels.ts]"]
  node_documents["Guest documents<br/>[documents.ts]"]
end

subgraph group_integrations["External integrations"]
  node_shr["SHR CRS integration"]
  node_shift4["Shift4 payments<br/>[client.ts]"]
  node_devices["Front-desk devices<br/>[devices.ts]"]
end

subgraph group_data["Hotel data"]
  node_db[("PostgreSQL schema")]
  node_reservation_schema[("Reservation records<br/>[reservations.ts]")]
  node_org_schema[("Hotel and access records<br/>[org.ts]")]
  node_finance_schema[("Finance records<br/>[finance.ts]")]
end

node_staff(("Hotel staff"))

node_staff -->|"uses"| node_screens
node_screens -->|"renders"| node_auth_ui
node_screens -->|"renders"| node_channel_ui
node_channel_ui -->|"requests data"| node_api_client
node_screens -->|"loads data"| node_api_client
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"loads auth"| node_identity
node_auth_routes -->|"authenticates"| node_identity
node_auth_routes -->|"records changes"| node_audit
node_api_app -->|"registers"| node_reservations
node_api_app -->|"registers routes"| node_channels
node_channels -->|"reads and queues"| node_db
node_channels -->|"queues updates"| node_shr
node_reservations -.->|"persists"| node_reservation_schema
node_billing -.->|"persists"| node_finance_schema
node_night_audit -.->|"posts and archives"| node_finance_schema
node_shift4 -.->|"logs transactions"| node_db
node_api_app -->|"uses database"| node_db
node_db -->|"defines"| node_reservation_schema
node_db -->|"defines"| node_org_schema
node_db -->|"defines"| node_finance_schema
node_staff -.->|"uses"| node_devices
node_staff -.->|"creates and signs"| node_documents
node_staff -.->|"reviews reports"| node_night_audit
node_shift4 -.->|"processes payments for"| node_staff

click node_screens "https://github.com/echodot07/onepms/blob/main/apps/web/src/App.tsx"
click node_api_client "https://github.com/echodot07/onepms/blob/main/apps/web/src/api.ts"
click node_auth_ui "https://github.com/echodot07/onepms/blob/main/apps/web/src/pages/Auth.tsx"
click node_channel_ui "https://github.com/echodot07/onepms/blob/main/apps/web/src/pages/ChannelManager.tsx"
click node_api_app "https://github.com/echodot07/onepms/blob/main/apps/api/src/app.ts"
click node_auth_routes "https://github.com/echodot07/onepms/blob/main/apps/api/src/routes/auth.ts"
click node_identity "https://github.com/echodot07/onepms/blob/main/apps/api/src/auth.ts"
click node_audit "https://github.com/echodot07/onepms/blob/main/apps/api/src/audit.ts"
click node_reservations "https://github.com/echodot07/onepms/blob/main/apps/api/src/routes/reservations.ts"
click node_billing "https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/billing.ts"
click node_night_audit "https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/auditReports.ts"
click node_channels "https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/channels.ts"
click node_shr "https://github.com/echodot07/onepms/tree/main/apps/api/src/integrations/shr"
click node_shift4 "https://github.com/echodot07/onepms/blob/main/apps/api/src/integrations/shift4/client.ts"
click node_devices "https://github.com/echodot07/onepms/blob/main/apps/api/src/integrations/devices.ts"
click node_documents "https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/documents.ts"
click node_db "https://github.com/echodot07/onepms/tree/main/packages/db/src/schema"
click node_reservation_schema "https://github.com/echodot07/onepms/blob/main/packages/db/src/schema/reservations.ts"
click node_org_schema "https://github.com/echodot07/onepms/blob/main/packages/db/src/schema/org.ts"
click node_finance_schema "https://github.com/echodot07/onepms/blob/main/packages/db/src/schema/finance.ts"

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_screens,node_api_client,node_auth_ui,node_channel_ui toneBlue
class node_api_app,node_auth_routes,node_identity,node_audit,node_reservations,node_billing,node_night_audit,node_channels,node_documents toneAmber
class node_shr,node_shift4,node_devices toneMint
class node_db,node_reservation_schema,node_org_schema,node_finance_schema toneRose
class node_staff toneIndigo
```

## Components

### Staff interface

- [PMS screens](https://github.com/echodot07/onepms/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Web API client](https://github.com/echodot07/onepms/blob/main/apps/web/src/api.ts): `apps/web/src/api.ts`
- [Sign-in screens](https://github.com/echodot07/onepms/blob/main/apps/web/src/pages/Auth.tsx): `apps/web/src/pages/Auth.tsx`
- [Channel manager](https://github.com/echodot07/onepms/blob/main/apps/web/src/pages/ChannelManager.tsx): `apps/web/src/pages/ChannelManager.tsx`

### PMS services

- [API application](https://github.com/echodot07/onepms/blob/main/apps/api/src/app.ts): `apps/api/src/app.ts`
- [Authentication routes](https://github.com/echodot07/onepms/blob/main/apps/api/src/routes/auth.ts): `apps/api/src/routes/auth.ts`
- [Sessions and permissions](https://github.com/echodot07/onepms/blob/main/apps/api/src/auth.ts): `apps/api/src/auth.ts`
- [Change history](https://github.com/echodot07/onepms/blob/main/apps/api/src/audit.ts): `apps/api/src/audit.ts`
- [Reservations and stays](https://github.com/echodot07/onepms/blob/main/apps/api/src/routes/reservations.ts): `apps/api/src/routes/reservations.ts`
- [Folios and billing](https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/billing.ts): `apps/api/src/domain/billing.ts`
- [Night audit reports](https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/auditReports.ts): `apps/api/src/domain/auditReports.ts`
- [Channel distribution](https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/channels.ts): `apps/api/src/domain/channels.ts`
- [Guest documents](https://github.com/echodot07/onepms/blob/main/apps/api/src/domain/documents.ts): `apps/api/src/domain/documents.ts`

### External integrations

- [SHR CRS integration](https://github.com/echodot07/onepms/tree/main/apps/api/src/integrations/shr): `apps/api/src/integrations/shr`
- [Shift4 payments](https://github.com/echodot07/onepms/blob/main/apps/api/src/integrations/shift4/client.ts): `apps/api/src/integrations/shift4/client.ts`
- [Front-desk devices](https://github.com/echodot07/onepms/blob/main/apps/api/src/integrations/devices.ts): `apps/api/src/integrations/devices.ts`

### Hotel data

- [PostgreSQL schema](https://github.com/echodot07/onepms/tree/main/packages/db/src/schema): `packages/db/src/schema`
- [Reservation records](https://github.com/echodot07/onepms/blob/main/packages/db/src/schema/reservations.ts): `packages/db/src/schema/reservations.ts`
- [Hotel and access records](https://github.com/echodot07/onepms/blob/main/packages/db/src/schema/org.ts): `packages/db/src/schema/org.ts`
- [Finance records](https://github.com/echodot07/onepms/blob/main/packages/db/src/schema/finance.ts): `packages/db/src/schema/finance.ts`

### Other components

- **Hotel staff**

## Connections

- Hotel staff → PMS screens: uses (evidence: `README.md`)
- PMS screens → Sign-in screens: renders (evidence: `apps/web/src/App.tsx`)
- PMS screens → Channel manager: renders (evidence: `apps/web/src/App.tsx`)
- Channel manager → Web API client: requests data (evidence: `apps/web/src/pages/ChannelManager.tsx`)
- PMS screens → Web API client: loads data (evidence: `apps/web/src/App.tsx`)
- API application → Authentication routes: registers (evidence: `apps/api/src/app.ts`)
- API application → Sessions and permissions: loads auth (evidence: `apps/api/src/app.ts`)
- Authentication routes → Sessions and permissions: authenticates (evidence: `apps/api/src/routes/auth.ts`)
- Authentication routes → Change history: records changes (evidence: `apps/api/src/routes/auth.ts`)
- API application → Reservations and stays: registers (evidence: `apps/api/src/app.ts`)
- API application → Channel distribution: registers routes (evidence: `apps/api/src/app.ts`)
- Channel distribution → PostgreSQL schema: reads and queues
- Channel distribution → SHR CRS integration: queues updates
- Reservations and stays → Reservation records: persists
- Folios and billing → Finance records: persists
- Night audit reports → Finance records: posts and archives
- Shift4 payments → PostgreSQL schema: logs transactions
- API application → PostgreSQL schema: uses database (evidence: `apps/api/src/app.ts`)
- PostgreSQL schema → Reservation records: defines (evidence: `packages/db/src/schema/reservations.ts`)
- PostgreSQL schema → Hotel and access records: defines (evidence: `packages/db/src/schema/org.ts`)
- PostgreSQL schema → Finance records: defines (evidence: `packages/db/src/schema/finance.ts`)
- Hotel staff → Front-desk devices: uses (evidence: `README.md`)
- Hotel staff → Guest documents: creates and signs (evidence: `README.md`)
- Hotel staff → Night audit reports: reviews reports (evidence: `README.md`)
- Shift4 payments → Hotel staff: processes payments for (evidence: `README.md`)
