Skip to main content
Hero Light

What is JS Mini Hotel?

JS Mini Hotel is a complete hotel management system built in vanilla JavaScript. It provides a robust API for handling all aspects of hotel operations, from room availability searches to guest check-in/check-out, billing, and comprehensive reporting. Whether you’re building a hotel booking platform, property management system, or learning about real-world JavaScript applications, JS Mini Hotel offers a production-ready foundation with clean, maintainable code.

Quick Navigation

Quickstart

Get up and running with JS Mini Hotel in minutes

API Reference

Explore all available functions and methods

Core Concepts

Understand the data structures and architecture

Guides

See practical examples and use cases

Core Features

Create, modify, and cancel reservations with built-in validation. Supports guest data management, date validation, and automatic pricing calculations.
Streamlined check-in and check-out processes with status tracking, room availability updates, and automatic invoice generation.
Add extra services (breakfast, parking, late check-out) to reservations with automatic price recalculation. Generate detailed invoices with itemized breakdowns.
Generate occupancy reports for any date, revenue reports for date ranges, and guest history tracking for customer relationship management.
Flexible cancellation system with automatic penalty calculation based on cancellation timing:
  • More than 7 days before check-in: No charge
  • 3-7 days before: 50% of total
  • Less than 3 days: 100% of total

Key Capabilities

Data Validation

Email, phone, DNI regex validation

Auto Calculations

Nights, prices, and penalties

Date Handling

Temporal API for date operations

State Management

Active reservations + history tracking

Guest Tracking

Complete guest history by email

Occupancy Analytics

Real-time and historical reports

Installation

JS Mini Hotel is a vanilla JavaScript library with no external dependencies (except for development utilities).

Option 1: Clone the Repository

git clone <repository-url>
cd js-mini-hotel

Option 2: Copy the Source Files

Copy the following files from the source directory into your project:
source/
├── main.js              # Core hotel management functions
├── utils/
│   ├── utils.js         # Utility functions
│   ├── validation.js    # Validation logic
│   └── constants.js     # Constants and enums
└── data/
    ├── rooms.json       # Room definitions
    ├── reservations.json # Sample reservations
    └── history.json     # Reservation history

Option 3: Module Import

Since this is a modern ES6+ project using module syntax, you can import it directly:
import {
  createHotel,
  searchAvailableRooms,
  createReservation,
  addExtras,
  checkIn,
  checkOut,
  cancelReservation,
  getOccupancyReport,
  getRevenueReport,
  getGuestHistory
} from './source/main.js';
Make sure your project supports ES6 modules. Use type: "module" in your package.json or use the .mjs extension.

Room Types & Pricing

The system supports three room types with standard pricing:
Room TypePrice per NightTypical Features
Single€50WiFi, TV
Double€80WiFi, TV, Minibar
Suite€150WiFi, TV, Minibar, Jacuzzi

Available Extras

Enhance reservations with additional services:
  • Breakfast: €10/day
  • Parking: €15/day
  • Late Check-out: €30 (one-time charge)
  • Early Check-in: €20 (one-time charge)

Next Steps

1

Complete the Quickstart

Follow the Quickstart Guide to create your first hotel and reservation
2

Explore the API

Review the API Reference to understand all available functions
3

Build Your Application

Start integrating JS Mini Hotel into your project

Build docs developers (and LLMs) love