How manuel-bautista-ramirez/project-residency-hotel-club works
1. Overall shape
- This is a Node.js, server-rendered hotel club management system.
- The backend is organized around feature modules under src/modules, with a central app bootstrap in index.js and shared routing from src/router/routerGlobal.js.
- The app appears to use Express-style controllers, routers, middleware, MySQL persistence, and Handlebars views.
2. Primary business domains
- The core subsystems are:
- Login / access control
- Admin
- Rooms: reservations, rent, pricing, reports, PDFs, QR
- Membership: family memberships, renewals, QR scanning, reports
- Entries: daily entries for sports/amenities
- Store: inventory and sales
- Each domain has its own controllers, models, routes, and HBS views, which makes the architecture modular and diagram-friendly.
3. Request flow
- Incoming HTTP requests are routed through the global router into module-specific routers.
- Controllers coordinate the workflow, call models/services, then render Handlebars views or return API responses.
- Validation middleware is inserted before controllers in several modules, especially login, admin, and rooms-related operations.
4. Authentication and authorization boundary
- src/modules/login owns login, password reset, and session/auth behavior.
- Its model (userModel.js) reads/writes user data in MySQL, while the controller handles the authentication lifecycle.
- Shared validation middleware lives under src/middlewares/validation, including access denial and user-active checks, indicating a centralized authorization gate used across modules.
5. Rooms subsystem
- The rooms module is one of the most complex parts of the repo.
- It includes reservation, rent, calendar, price management, conversion from reservation to rent, and reporting.
- It also has PDF-related controllers/routes and utility layers for PDF generation, QR generation, report PDFs, and directory validation.
- The presence of a bundled FullCalendar library in public/js/ModuleRooms/js/lib/fullcalendar@6.1.8 suggests a calendar-centric UI for reservations.
6. Membership subsystem
- Membership management is split into create, edit, delete, list, manage, renewal, and reports flows.
- It includes services for client and membership logic, which suggests a separation between domain orchestration and persistence.
- Utilities include QR generation and number-to-words conversion, implying printable receipts or membership documents.
- There is also a scan-QR view and client-side QR scanning support, making this subsystem a hybrid of admin workflows and check-in style operations.
7. Entries subsystem
- The entries module handles daily access records, likely for sports areas or amenities referenced in the README.
- It has a dedicated controller, model, routes, and report utilities.
- The module also contains directory validation utilities, which likely support generated artifacts such as exported reports.
8. Store subsystem
- The store module manages products, sales, sale details, inventory reports, and sales reports.
- It is structured similarly to the other modules: controller, model, routes, and document/report helpers.
- PDF generators and report generators indicate that sales and inventory outputs can be exported as documents.
9. Shared services and infrastructure
- src/services contains cross-cutting services for connectivity, email, job queues, and WhatsApp.
- These are not tied to a single domain and likely act as infrastructure adapters for notifications, background processing, and external communication.
- src/utils/directoryManager.js and the various validadorDirectorios.js files show that generated files are stored and validated consistently across modules.
10. Data layer
- MySQL is the main persistence layer, configured from src/config/configuration.js and src/dataBase/connectionDataBase.js.
- src/dataBase/database.sql provides the schema and seed data, including default users and room records.
- Each module has its own model layer, which suggests direct SQL-driven data access rather than a heavy ORM.
11. Server-side rendering and shared UI
- Views are Handlebars templates under src/views and each module’s views directory.
- Shared layout, navbar, footer, loading overlay, and reusable buttons live in src/views/layouts and src/views/partials.
- This indicates an SSR application where most business pages are rendered server-side, with partial client-side enhancements.
12. Client-side validation and interactive behavior
- public/js contains feature-specific browser scripts for form validation, live validation, and UI fixes.
- Modules are mirrored on the client side: login, rooms, membership, entries, store.
- This layer supports richer interaction but does not appear to be the primary source of business logic; the server remains authoritative.
13. Document generation and file outputs
- PDFs and QR outputs are a first-class part of the architecture, especially in rooms and membership.
- Puppeteer/Chrome is required for PDF generation, so rendering is not purely in-browser—it relies on a server-side headless browser workflow.
- The README notes generated artifacts are stored under public/uploads/rooms/, making file storage part of the application boundary.
14. Operational and support tooling
- script/dbBackupScheduler.js suggests scheduled database backup automation.
- nodemon.json and package scripts indicate local development support.
- Tailwind config and PostCSS show that frontend styling is built as part of the toolchain, but the app itself remains backend-led and template-driven.
15. Architecture summary for a diagram
- A useful diagram would show:
- Browser/client UI on the left
- Express-style router/controller layer in the middle
- Module-specific models/services beneath that
- MySQL plus file/PDF/QR storage on the right
- Shared services for email, WhatsApp, queueing, and connectivity as cross-cutting infrastructure
- The biggest architectural boundary is between feature modules and shared infrastructure, with the rooms and membership modules carrying the most document-generation and operational complexity.
Main entry points: routerGlobal.js Global Router · rooms Rooms · dataBase MySQL Data · membership Membership
Components 15
Client/UI
Browser-facing views and scripts
- Views · Shared layouts, partials, and module templates
src/views - Client Scripts · Feature validation and interactive UI behavior
public/js
Server Core
App bootstrap, routing, and shared middleware
- Bootstrap · Starts the server and wires configuration
index.js - Global Router · Dispatches requests into feature routers
src/router/routerGlobal.js - Shared Guards · Access control and user-state validation
src/middlewares/validation
Feature Modules
Business domains implemented as modules
- Login · Authentication, reset flow, and session access
src/modules/login - Admin · Administration dashboard and management actions
src/modules/admin - Rooms · Reservations, rent, pricing, reports, PDFs, and QR
src/modules/rooms - Membership · Create, renew, manage, scan QR, and report memberships
src/modules/membership - Entries · Daily entries and entry reports
src/modules/entries - Store · Products, sales, inventory, and sales reporting
src/modules/store
Infrastructure
Persistence, external services, and generated artifacts
- MySQL Data · Connection, schema, and seed data
src/dataBase - Shared Services · Connectivity, email, queues, and WhatsApp
src/services - Files & PDFs · Generated PDFs, QR codes, and directory management
src/utils - Backup Job · Database backup scheduler
script/dbBackupScheduler.js
Connections 33
- Bootstrap → Global Router: mounts · Bootstrap hands off request handling to the router
- Bootstrap → Shared Guards: uses · Application-wide request checks and access gates
- Global Router → Login: routes to · Authentication routes are delegated to the login module
- Global Router → Admin: routes to · Admin routes are delegated to the admin module
- Global Router → Rooms: routes to · Room booking and reporting routes are delegated
- Global Router → Membership: routes to · Membership workflows are delegated
- Global Router → Entries: routes to · Entry management routes are delegated
- Global Router → Store: routes to · Store routes are delegated
- Login → Shared Guards: guards · Login flow uses validation and active-user checks
- Admin → Shared Guards: guards · Admin actions are protected by shared checks
- Rooms → Shared Guards: guards · Rooms operations apply validation before controllers
- Login → MySQL Data: reads/writes · User records and authentication state are stored in MySQL
- Admin → MySQL Data: reads/writes · Admin data is persisted through the database layer
- Rooms → MySQL Data: reads/writes · Reservations, rents, prices, and PDFs are backed by MySQL
- Membership → MySQL Data: reads/writes · Membership and client data are persisted in MySQL
- Entries → MySQL Data: reads/writes · Daily entry records are stored in MySQL
- Store → MySQL Data: reads/writes · Products, sales, and inventory data are stored in MySQL
- Login → Views: renders · Login pages are server-rendered with Handlebars
- Rooms → Views: renders · Room workflows render calendars, forms, and reports
- Membership → Views: renders · Membership workflows render forms, lists, and scans
- Entries → Views: renders · Entry pages and reports are rendered server-side
- Store → Views: renders · Store dashboards and reports are rendered server-side
- Client Scripts → Login: enhances · Client-side validation supports login screens
- Client Scripts → Rooms: enhances · Client scripts support reservation, rent, pricing, and reports flows
- Client Scripts → Membership: enhances · Browser scripts support membership CRUD, renewal, and QR scanning
- Shared Services → Rooms: supports · Rooms can notify or process background work through shared services
- Shared Services → Membership: supports · Membership flows can use shared notification and queue adapters
- Shared Services → Store: supports · Store flows can use shared notification and queue adapters
- Rooms → Files & PDFs: exports · PDF, QR, and report artifacts are generated and stored
- Membership → Files & PDFs: exports · Membership QR and printable artifacts are generated
- Entries → Files & PDFs: exports · Entry reports can produce exported files
- Store → Files & PDFs: exports · Sales and inventory reports can produce exported files
- Backup Job → MySQL Data: backs up · Scheduled backup job targets the database