# carlian-dev/gamehub_2.0 architecture

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

- Interactive diagram: https://gitdiagram.com/carlian-dev/gamehub_2.0
- Repository: https://github.com/carlian-dev/gamehub_2.0

## Overview

GameHub 2.0 is a billiard-hall management system with a dependency-free browser frontend and a Node/Express JSON API backed by MongoDB; the archived PHP backend is not part of runtime. The main workflow is staff or customer interaction in the frontend, API request handling and role checks, domain operations, then persisted state or a response. Distinct capabilities include identity and staff administration, tables and rates, sessions and reservations, orders and payments, reports, audit, and super-admin integration controls. Some domain modules were not excerpted, so their links reflect README-documented capabilities and layering rather than inspected calls.

Main entry points: [`server/src/controllers`](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/controllers) (Request controllers), [`server/src/routes`](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/routes) (API routes), [`server/src/services/session.service.js`](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/session.service.js) (Playing sessions), [`Frontend/js/api.js`](https://github.com/carlian-dev/gamehub_2.0/blob/main/Frontend/js/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_frontend["Frontend screens"]
  node_public_ui["Public pages"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_server["Express server<br/>[server.js]"]
  node_app["HTTP app<br/>[app.js]"]
  node_bootstrap["Dependency wiring<br/>[bootstrap.js]"]
  node_routes["API routes"]
  node_auth_guard["Auth and access<br/>[auth.js]"]
  node_controllers["Request controllers"]
end

subgraph group_domain["Hall operations"]
  node_auth_service["Identity lifecycle<br/>[auth.service.js]"]
  node_staff_admin["Staff administration"]
  node_tables_rates["Tables and rates"]
  node_sessions["Playing sessions<br/>[session.service.js]"]
  node_reservations["Reservations"]
  node_orders_payments["Orders and payments<br/>[order.service.js]"]
  node_reports_audit["Reports and audit<br/>[report.service.js]"]
  node_superadmin["Integration controls"]
end

subgraph group_platform["Persistence and integrations"]
  node_models["Mongo data models"]
  node_mongodb[("MongoDB Atlas")]
  node_calendar_mail["Calendar and mail"]
end

node_staff(("Staff / customer"))

node_staff -->|"uses"| node_frontend
node_frontend -->|"requests"| node_api_client
node_public_ui -.->|"requests"| node_api_client
node_api_client -->|"calls API"| node_app
node_server -->|"wires"| node_bootstrap
node_server -->|"serves"| node_app
node_app -->|"mounts"| node_routes
node_routes -->|"dispatches"| node_controllers
node_routes -->|"guards"| node_auth_guard
node_controllers -.->|"handles identity"| node_auth_service
node_controllers -.->|"handles staff"| node_staff_admin
node_controllers -.->|"handles tables"| node_tables_rates
node_controllers -.->|"handles sessions"| node_sessions
node_controllers -.->|"handles bookings"| node_reservations
node_controllers -.->|"handles orders"| node_orders_payments
node_controllers -.->|"handles reports"| node_reports_audit
node_controllers -.->|"handles settings"| node_superadmin
node_sessions -->|"reads rates"| node_tables_rates
node_sessions -.->|"reads and writes"| node_models
node_auth_service -->|"updates users"| node_models
node_models -->|"persists state"| node_mongodb
node_reservations -.->|"optional alerts"| node_calendar_mail
node_superadmin -.->|"configures integrations"| node_calendar_mail

click node_frontend "https://github.com/carlian-dev/gamehub_2.0/tree/main/Frontend/src/function"
click node_public_ui "https://github.com/carlian-dev/gamehub_2.0/tree/main/Frontend/js"
click node_api_client "https://github.com/carlian-dev/gamehub_2.0/blob/main/Frontend/js/api.js"
click node_server "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/server.js"
click node_app "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/app.js"
click node_bootstrap "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/bootstrap.js"
click node_routes "https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/routes"
click node_auth_guard "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/middleware/auth.js"
click node_controllers "https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/controllers"
click node_auth_service "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/auth.service.js"
click node_staff_admin "https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/services"
click node_tables_rates "https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/services"
click node_sessions "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/session.service.js"
click node_reservations "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/reservation.service.js"
click node_orders_payments "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/order.service.js"
click node_reports_audit "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/report.service.js"
click node_superadmin "https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/settings.service.js"
click node_models "https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/models"

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_frontend,node_public_ui,node_api_client toneBlue
class node_server,node_app,node_bootstrap,node_routes,node_auth_guard,node_controllers toneAmber
class node_auth_service,node_staff_admin,node_tables_rates,node_sessions,node_reservations,node_orders_payments,node_reports_audit,node_superadmin toneMint
class node_models,node_mongodb,node_calendar_mail toneRose
class node_staff toneIndigo
```

## Components

### Browser experience

- [Frontend screens](https://github.com/carlian-dev/gamehub_2.0/tree/main/Frontend/src/function): `Frontend/src/function`
- [Public pages](https://github.com/carlian-dev/gamehub_2.0/tree/main/Frontend/js): `Frontend/js`
- [API client](https://github.com/carlian-dev/gamehub_2.0/blob/main/Frontend/js/api.js): `Frontend/js/api.js`

### API and access

- [Express server](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/server.js): `server/src/server.js`
- [HTTP app](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/app.js): `server/src/app.js`
- [Dependency wiring](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/bootstrap.js): `server/src/bootstrap.js`
- [API routes](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/routes): `server/src/routes`
- [Auth and access](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Request controllers](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/controllers): `server/src/controllers`

### Hall operations

- [Identity lifecycle](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/auth.service.js): `server/src/services/auth.service.js`
- [Staff administration](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/services): `server/src/services`
- [Tables and rates](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/services): `server/src/services`
- [Playing sessions](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/session.service.js): `server/src/services/session.service.js`
- [Reservations](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/reservation.service.js): `server/src/services/reservation.service.js`
- [Orders and payments](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/order.service.js): `server/src/services/order.service.js`
- [Reports and audit](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/report.service.js): `server/src/services/report.service.js`
- [Integration controls](https://github.com/carlian-dev/gamehub_2.0/blob/main/server/src/services/settings.service.js): `server/src/services/settings.service.js`

### Persistence and integrations

- [Mongo data models](https://github.com/carlian-dev/gamehub_2.0/tree/main/server/src/models): `server/src/models`
- **MongoDB Atlas**
- **Calendar and mail**

### Other components

- **Staff / customer**

## Connections

- Staff / customer → Frontend screens: uses (evidence: `README.md`)
- Frontend screens → API client: requests (evidence: `README.md`)
- Public pages → API client: requests
- API client → HTTP app: calls API (evidence: `README.md`)
- Express server → Dependency wiring: wires (evidence: `server/src/server.js`)
- Express server → HTTP app: serves (evidence: `server/src/server.js`)
- HTTP app → API routes: mounts (evidence: `server/src/app.js`)
- API routes → Request controllers: dispatches
- API routes → Auth and access: guards (evidence: `server/src/routes/auth.routes.js`)
- Request controllers → Identity lifecycle: handles identity
- Request controllers → Staff administration: handles staff
- Request controllers → Tables and rates: handles tables
- Request controllers → Playing sessions: handles sessions
- Request controllers → Reservations: handles bookings
- Request controllers → Orders and payments: handles orders
- Request controllers → Reports and audit: handles reports
- Request controllers → Integration controls: handles settings
- Playing sessions → Tables and rates: reads rates (evidence: `server/src/services/session.service.js`)
- Playing sessions → Mongo data models: reads and writes
- Identity lifecycle → Mongo data models: updates users (evidence: `server/src/services/auth.service.js`)
- Mongo data models → MongoDB Atlas: persists state (evidence: `README.md`)
- Reservations → Calendar and mail: optional alerts (evidence: `README.md`)
- Integration controls → Calendar and mail: configures integrations (evidence: `README.md`)
