Starlo Hotel Booking API Development

Ali

Ali Toman

Starlo : Hotel Booking API (Node.js + TypeScript)

Summary

Starlo is a production-grade hotel booking API built with Node.js, Express and TypeScript. It provides secure user management (signup/login/password reset + optional 2FA), advanced room discovery (filtering, sorting, pagination), booking lifecycle management, review aggregation, and admin tools. The stack was containerized with Docker, fronted by a load balancer, and enhanced with an in-memory caching layer to improve response times and availability.

Problem / Context

Small-to-mid hotels and booking platforms need a resilient backend that handles search complexity, high read volume, concurrent bookings, and administrative reporting without becoming a maintenance burden. The core challenges were:
Complex search & filtering (many query combos) producing heavy DB load.
Concurrency risk during bookings (preventing double-book).
Need for real-time average rating updates and efficient review handling.
Requirement for maintainable, strongly-typed code (team handoff).
Need for resilience and horizontal scaling in production.

Approach & Key Decisions

Tech choices
Node.js + Express + TypeScript — strong typing for safer refactors.
MongoDB — flexible document model for rooms & bookings.
Redis (or in-memory cache) — cache frequently-read queries (room lists, stats).
Docker + container orchestration behind a load balancer — for scaling and predictable deployments.
MVC structure + layered services — separation of concerns and testability.
Design highlights
Booking atomicity: booking endpoint uses optimistic checks and DB-level safeguards to avoid double-booking (document-level checks + unique constraints / transactions).
Advanced APIFeatures: query parser supports gt/lt/gte/lte, field selection, paging, and combined filters.
Review aggregation: when a review is created/updated/deleted, the room’s average rating is recalculated using incremental aggregation for constant-time cost.
Caching strategy: cache hot read endpoints (room listing, room-info) with TTL and cache invalidation on booking/review events.
TypeScript contracts: DTOs and controller/service boundaries reduce runtime errors and speed up maintenance.

Architecture (summary)

Like this project

Posted Nov 9, 2025

Developed a hotel booking API using Node.js, Express, and TypeScript for Starlo.