A comprehensive hotel management system built with Node.js, TypeScript, Express, React, and MySQL. This system provides complete functionality for managing hotel operations including bookings, rooms, branches, staff, services, payments, and reporting.
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Documentation
- Database Schema
- Deployment
- Contributing
- License
- JWT-based authentication with access and refresh tokens
- Role-based access control (Admin, Manager, Receptionist, Housekeeping, Guest)
- Secure password hashing with bcrypt
- Session management with automatic token refresh
- Multi-branch hotel support
- Branch-specific operations and reporting
- Branch details with contact information and photos
- Room type categorization with pricing
- Room status tracking (available, occupied, maintenance, cleaning)
- Floor-wise room organization
- Real-time availability checking
- Complete booking workflow (pending β confirmed β checked-in β checked-out)
- Booking modification and cancellation
- Guest information management
- Date validation and double-booking prevention
- Check-in/check-out processing
- Service catalogue with branch-specific pricing
- Service addition to bookings
- Service usage tracking
- Photo uploads for services
- Flexible payment handling (full/partial payments)
- Multiple payment methods (cash, credit card, debit card, bank transfer)
- Payment transaction history
- Automatic bill calculation with taxes and discounts
- Outstanding balance tracking
- Staff management (managers, receptionists, housekeepers)
- Guest registration and profiles
- User status control (active/inactive)
- Salary and employment tracking for staff
- Room occupancy reports
- Revenue analysis (daily, monthly)
- Service usage statistics
- Guest billing summaries
- Top services by branch
- Guest inquiry system
- Message status tracking (pending/read)
- Inquiry type categorization
- Input validation and sanitization
- SQL injection prevention (parameterized queries)
- XSS protection
- CORS configuration
- Secure session management
- Runtime: Node.js v18+
- Language: TypeScript 5.9.2
- Framework: Express 5.1.0
- Database: MySQL 8.0 / MariaDB 10.11
- Authentication: JWT (jsonwebtoken)
- Password Hashing: bcryptjs
- Logging: Winston 3.18.3
- File Upload: Multer
- Database Migrations: db-migrate
- Package Manager: pnpm
- Framework: React 18.3.1
- Routing: React Router DOM
- HTTP Client: Axios
- Icons: Lucide React
- Styling: CSS3
- Package Manager: npm
- RDBMS: MySQL 8.0+ / MariaDB 10.11+
- Connection Pooling: mysql2
- Triggers & Stored Procedures: Advanced SQL features
- Transactions: ACID compliance
SkyNest_Hotels/
βββ backend/ # Backend application
β βββ src/
β β βββ config/ # Configuration files
β β β βββ db.ts # Database connection
β β βββ controllers/ # Route controllers
β β βββ middleware/ # Express middleware
β β βββ routes/ # API routes
β β βββ types/ # TypeScript type definitions
β β βββ utils/ # Utility functions & logger
β β βββ index.ts # Application entry point
β βββ migrations/ # Database migration files
β βββ logs/ # Application logs
β βββ config/ # Environment configurations
β β βββ .env.development # Development environment
β β βββ .env.test # Test environment
β βββ database.json # Migration configuration
β βββ package.json
β βββ tsconfig.json
β βββ README.md
β
βββ frontend/ # Frontend application
β βββ public/ # Static assets
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API service layer
β β βββ styles/ # CSS stylesheets
β β βββ utils/ # Utility functions & logger
β β βββ config/ # Configuration
β β βββ App.js # Main app component
β β βββ index.js # React entry point
β βββ package.json
β βββ README.md
β
βββ docs/ # Documentation
β βββ DEPLOYMENT_CHECKLIST.md
β βββ MIGRATION_FIXES.md
β βββ BOOKING_MANAGEMENT_*.md
β
βββ README.md # This file
Before you begin, ensure you have the following installed:
- Node.js v18.0.0 or higher
- npm v9.0.0 or higher
- pnpm v8.0.0 or higher (for backend)
- MySQL 8.0+ or MariaDB 10.11+
- Git
git clone https://github.com/adLahiru/SkyNest_Hotels.git
cd SkyNest_Hotelscd backend
# Install dependencies
pnpm install
# Copy environment file
cp config/.env.development config/.env
# Update database credentials in config/.env
# Then run migrations
pnpm migrate:dev
# Build TypeScript
pnpm buildcd frontend
# Install dependencies
npm install
# Create environment file
cat > .env << EOF
REACT_APP_API_URL=http://localhost:8084/api
REACT_APP_ENV=development
EOF
# Build production version (optional)
npm run build# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=SkyNest_Hotels
# Server Configuration
PORT=8084
NODE_ENV=development
# JWT Configuration
JWT_SECRET=your-super-secure-jwt-secret-min-32-characters
JWT_REFRESH_SECRET=your-super-secure-refresh-secret-min-32-characters
JWT_EXPIRES_IN=1h
JWT_REFRESH_EXPIRES_IN=7d
# CORS Configuration
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001REACT_APP_API_URL=http://localhost:8084/api
REACT_APP_ENV=developmentBackend:
cd backend
pnpm dev
# Server runs on http://localhost:8084Frontend:
cd frontend
npm start
# Application runs on http://localhost:3000Backend:
cd backend
pnpm build
pnpm startFrontend:
cd frontend
npm run build
# Serve the build folder with a static serverhttp://localhost:8084/api
POST /api/auth/login- User loginPOST /api/auth/refresh- Refresh access tokenPOST /api/auth/logout- User logoutPOST /api/auth/register- Guest registration
GET /api/users- Get all users (Admin)GET /api/users/:id- Get user by IDPOST /api/users- Create user (Admin)PUT /api/users/:id- Update userDELETE /api/users/:id- Delete user (Admin)GET /api/users/profile- Get current user profilePUT /api/users/profile- Update profile
GET /api/branches- Get all branchesGET /api/branches/:id- Get branch by IDPOST /api/branches- Create branch (Admin)PUT /api/branches/:id- Update branch (Admin)DELETE /api/branches/:id- Delete branch (Admin)
GET /api/room-types- Get all room typesGET /api/room-types/:id- Get room type by IDPOST /api/room-types- Create room type (Admin/Manager)PUT /api/room-types/:id- Update room typeDELETE /api/room-types/:id- Delete room type
GET /api/rooms- Get all roomsGET /api/rooms/:id- Get room by IDPOST /api/rooms- Create room (Admin/Manager)PUT /api/rooms/:id- Update roomDELETE /api/rooms/:id- Delete roomPATCH /api/rooms/:id/status- Update room status
GET /api/bookings- Get all bookingsGET /api/bookings/:id- Get booking by IDPOST /api/bookings- Create bookingPUT /api/bookings/:id- Update bookingDELETE /api/bookings/:id- Cancel bookingPATCH /api/bookings/:id/checkin- Check-inPATCH /api/bookings/:id/checkout- Check-outPOST /api/bookings/:id/services- Add service to bookingGET /api/bookings/:id/services- Get booking servicesPOST /api/bookings/:id/payments- Process paymentGET /api/bookings/:id/payment-details- Get payment detailsGET /api/bookings/available-rooms- Get available rooms
GET /api/services- Get all servicesGET /api/services/:id- Get service by IDPOST /api/services- Create service (Admin/Manager)PUT /api/services/:id- Update serviceDELETE /api/services/:id- Delete service
GET /api/dashboard/admin- Admin dashboard statisticsGET /api/dashboard/housekeeping- Housekeeping statistics
GET /api/reports/room-occupancy- Room occupancy reportGET /api/reports/guest-billing- Guest billing reportGET /api/reports/service-usage- Service usage reportGET /api/reports/monthly-revenue- Monthly revenue reportGET /api/reports/top-services- Top services report
POST /api/contact- Submit contact formGET /api/contact- Get all messages (Admin)PUT /api/contact/:id/status- Update message statusDELETE /api/contact/:id- Delete message
users- User accounts (staff and guests)staff- Staff-specific informationhotel_branches- Hotel branch informationroom_types- Room categories and pricingrooms- Individual room recordsbooking- Booking recordspayments- Payment informationpayment_transactions- Payment transaction historyservice_catalogue- Available servicesservice_usage- Service usage recordstax_policies- Tax configurationdiscounts- Discount policiescontact_messages- Customer inquiriesuser_sessions- Active user sessionsrefresh_tokens- JWT refresh tokensaudit_log- System audit trail
- Foreign key constraints
- Triggers for automatic status updates
- Stored procedures for complex calculations
- Indexes for performance optimization
- Transaction support
-
Configure Production Environment
- Update
.env.productionwith production database credentials - Set strong JWT secrets
- Configure CORS for production domain
- Update
-
Build Applications
# Backend cd backend && pnpm build # Frontend cd frontend && npm run build
-
Run Database Migrations
cd backend pnpm migrate:prod -
Deploy
- Backend: Use PM2, Docker, or your preferred Node.js hosting
- Frontend: Deploy build folder to static hosting (Nginx, Vercel, Netlify)
- Database: Use managed MySQL service or self-hosted
For detailed deployment instructions, see docs/DEPLOYMENT_CHECKLIST.md
| Role | Permissions |
|---|---|
| Admin | Full system access, manage all branches, users, and settings |
| Manager | Branch-specific management, staff, rooms, bookings, reports |
| Receptionist | Check-in/out, bookings, guest management for assigned branch |
| Housekeeping | View assigned rooms, update room status |
| Guest | View own bookings, update profile, make new bookings |
Backend:
pnpm dev # Start development server with nodemon
pnpm build # Build TypeScript to JavaScript
pnpm start # Start production server
pnpm migrate:dev # Run database migrations (development)
pnpm migrate:prod # Run database migrations (production)Frontend:
npm start # Start development server
npm run build # Create production build
npm run lint # Run ESLint- TypeScript for type safety
- ESLint for code linting
- Winston for structured logging
- Comprehensive error handling
This project is licensed under the MIT License - see the LICENSE file for details.
Lahiru
- GitHub: @adLahiru
- Built with β€οΈ for efficient hotel management
- Inspired by modern hotel management needs
- Special thanks to all contributors
For support, please:
- Check the documentation
- Open an issue on GitHub
- Contact the development team
Made with β€οΈ by SkyNest Hotels Development Team