Skip to main content
JS Mini Hotel uses three main data structures to manage hotel operations: Hotel, Room, and Reservation objects. Each structure has a specific purpose and schema.

Hotel Object

The Hotel object is the root structure that contains all hotel information, rooms, and reservations.
name
string
required
The name of the hotel (e.g., “Hotel Keepcoding”)
rooms
array
required
Array of Room objects representing all rooms in the hotel
reservations
array
required
Array of active Reservation objects (confirmed or checked-in status)
history
array
required
Array of completed Reservation objects (checked-out or cancelled status)

Example Hotel Object

{
  "name": "Hotel Keepcoding",
  "rooms": [...],
  "reservations": [...],
  "history": [...]
}
The reservations array contains only active reservations, while history stores all past reservations for reporting and guest history.

Room Object

Each room in the hotel has a specific structure that defines its type, pricing, status, and features.
number
number
required
Unique room number identifier (e.g., 101, 201, 302)
type
string
required
Room type: "single", "double", or "suite"
pricePerNight
number
required
Price per night in euros based on room type:
  • Single: €50
  • Double: €80
  • Suite: €150
status
string
required
Current room status: "available", "occupied", or "maintenance"
features
array
required
Array of strings listing room amenities (e.g., ["wifi", "tv", "minibar"])

Real Examples from rooms.json

{
  "number": 101,
  "type": "single",
  "pricePerNight": 50,
  "status": "available",
  "features": [
    "wifi",
    "tv"
  ]
}
{
  "number": 201,
  "type": "double",
  "pricePerNight": 80,
  "status": "occupied",
  "features": [
    "wifi",
    "tv",
    "minibar"
  ]
}
{
  "number": 301,
  "type": "suite",
  "pricePerNight": 150,
  "status": "available",
  "features": [
    "wifi",
    "tv"
  ]
}

Room Types

The system supports three room types, each with different pricing and features:
TypePrice per NightCommon Features
Single€50wifi, tv
Double€80wifi, tv, minibar
Suite€150wifi, tv, minibar, jacuzzi

Reservation Object

Reservations track guest bookings, including guest information, dates, pricing, and extras.
id
string
required
Unique reservation identifier (e.g., “RES-001”)
roomNumber
number
required
The room number assigned to this reservation
guest
object
required
Guest information object containing:
  • name: Full name of the guest
  • email: Email address (validated with regex)
  • phone: Phone number in format “+34 612345678” (validated with regex)
  • dni: Spanish ID in format “12345678A” (validated with regex)
checkIn
string
required
Check-in date in ISO format (YYYY-MM-DD)
checkOut
string
required
Check-out date in ISO format (YYYY-MM-DD)
nights
number
required
Number of nights (automatically calculated from check-in and check-out dates)
totalPrice
number
required
Total price in euros, including base room cost and extras
status
string
required
Reservation status: "confirmed", "checked-in", "checked-out", or "cancelled"
extras
array
required
Array of extra services. Each extra has:
  • name: Service name (e.g., “Breakfast”, “Parking”)
  • price: Price per unit in euros
  • quantity: Number of units

Real Examples from reservations.json

{
  "id": "RES-001",
  "roomNumber": 101,
  "guest": {
    "name": "Ana García",
    "email": "[email protected]",
    "phone": "+34 612345678",
    "dni": "12345678A"
  },
  "checkIn": "2026-03-01",
  "checkOut": "2026-03-05",
  "nights": 5,
  "totalPrice": 250,
  "status": "confirmed",
  "extras": [
    {
      "name": "Breakfast",
      "price": 10,
      "quantity": 5
    },
    {
      "name": "Parking",
      "price": 15,
      "quantity": 5
    }
  ]
}
{
  "id": "RES-003",
  "roomNumber": 103,
  "guest": {
    "name": "María López",
    "email": "[email protected]",
    "phone": "+34 612345678",
    "dni": "11223344C"
  },
  "checkIn": "2026-04-05",
  "checkOut": "2026-04-10",
  "nights": 5,
  "totalPrice": 250,
  "status": "confirmed",
  "extras": [
    {
      "name": "Breakfast",
      "price": 10,
      "quantity": 5
    },
    {
      "name": "Late Checkout",
      "price": 20,
      "quantity": 1
    }
  ]
}
{
  "id": "RES-004",
  "roomNumber": 201,
  "guest": {
    "name": "Carlos Sánchez",
    "email": "[email protected]",
    "phone": "+34 612345678",
    "dni": "55667788D"
  },
  "checkIn": "2026-01-02",
  "checkOut": "2026-01-05",
  "nights": 4,
  "totalPrice": 320,
  "status": "confirmed",
  "extras": []
}

Guest Object Structure

The guest object within each reservation contains validated personal information:
guest.name
string
required
Full name of the guest
guest.email
string
required
Email address (must match pattern: ^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$)
guest.phone
string
required
Phone number (must match pattern: ^(\+?\d{1,3})?[\s.-]?\d{9}$)
guest.dni
string
required
Spanish ID number (must match pattern: ^\d{1,8}[A-Za-z]$)
All guest data fields are validated before creating a reservation. Invalid data will cause the reservation to be rejected.

Extras Array Structure

Each item in the extras array represents an additional service:
{
  "name": "Breakfast",
  "price": 10,
  "quantity": 5
}
The totalPrice field in the reservation includes both the base room cost (nights × pricePerNight) and all extras (sum of price × quantity for each extra).

Build docs developers (and LLMs) love