Core room allocation engine for hotel PMS and booking systems
npm install room-allocation-engineA logic-only, deterministic room allocation core for hotel PMS and booking systems.
This package focuses on correctness around date overlaps, maintenance rooms, and future availability — without UI or database assumptions.
Hotel booking systems need bulletproof room allocation logic. Double-bookings cost money, maintenance rooms must be respected, and availability must be calculated correctly across date ranges.
``bash`
npm install room-allocation-engine
`typescript
import { allocateRoom } from "room-allocation-engine"
const result = allocateRoom(
[{ id: "101", type: "DELUXE", status: "AVAILABLE" }],
[], // existing bookings
{ roomType: "DELUXE", from: "2026-01-01", to: "2026-01-02" }
)
console.log(result) // { success: true, roomId: "101" }
``
✅ Date overlap detection - Prevents double-booking
✅ Maintenance awareness - Respects unavailable rooms
✅ Type matching - Allocates by room category
✅ Pure functions - No side effects, fully testable
❌ No database operations
❌ No UI components
❌ No pricing logic
❌ No external API calls
Logic-only, deterministic, reusable core. Built for composition, not consumption. Testable, auditable, and maintainable.