L-03Project / Deep DiveEL +0.00 m
Projects
EGYStay logo

Deep Dive · Production

EGYStay

Booking and reservation backend for a short-term rental platform, built from the ground up.

Role
Backend Engineer — primary, ~80% of the implementation (1100 of 1300 commits)
Timeline
Stack
TypeScript Express.js MongoDB Redis BullMQ Socket.IO Amazon Payment Services Paymob AWS Docker ...

01 — Overview

EGYStay is a short-term rental platform for the Egyptian market. Guests book accommodations; hosts and co-hosts manage their properties through dedicated dashboards. Reservations, availability, and pricing are the core of the product — if any of them is wrong, someone loses money or a place to stay.

I architected and developed the backend from the ground up: reservation workflows, availability management, pricing logic, payments, authentication, messaging, notifications, and administrative services.

I contributed roughly 80% of the implementation — around 63,000 lines of production code across 600+ source files — with maintainability and performance as explicit goals rather than afterthoughts.

02 — Challenges

Reservation conflicts

Two guests must never book the same property for the same nights — even when they try at the same moment.

Calendar consistency

Property availability has to stay synchronized after every booking and cancellation.

Pricing complexity

A total price depends on nights, cleaning fee, service fee, discounts, taxes, and promotions — and must come out identical everywhere it is computed.

Search

Filtering by city, dates, guests, price, amenities, and property type, with responses that stay fast.

Instant updates

Guests and hosts need to hear about booking events as they happen.

Booking integrity

Only valid bookings may ever reach payment.

Operations

Listings, reservations, users, and reports need efficient day-to-day administrative management.

03 — What I Built

Booking system

Problem
A booking is only correct when availability, pricing, and reservation state agree — including when two guests race for the same nights.
Approach
Validate on the server, and make the final booking write atomic so a race cannot produce two winners.
Implementation
Backend availability validation with overlapping-reservation checks, booking creation protected by atomic database operations, and availability calculation logic that updates automatically on bookings and cancellations.
Outcome
Double bookings were eliminated.

Pricing engine

Problem
The total price of a stay depends on nights, cleaning fee, service fee, discounts, taxes, and promotions — computed in more than one place, it will eventually disagree with itself.
Approach
One implementation of the math, used everywhere.
Implementation
Pricing calculations centralized in a reusable service, with every calculation validated on the server — never trusted from the client.

Payment system (Amazon Payment Services + Paymob)

Problem
Real money moves on every reservation, so payment state has to stay consistent with booking state.
Implementation
A payment system integrating two gateways — Amazon Payment Services and Paymob — covering payment initiation, gateway callbacks, and payment state tracking for reservations.

Property search

Problem
Search spans city, dates, guests, price, amenities, and property type — and still has to answer fast.
Implementation
Optimized filtering queries over indexes on the frequently searched fields, with unnecessary database work stripped out of the hot path.

Real-time chat system

Problem
Guests and hosts need to communicate about a stay inside the platform, in real time.
Implementation
A real-time messaging system built on Socket.IO.

Notifications

Problem
Guests and hosts need instant updates when a booking changes state.
Implementation
Booking events trigger notifications; confirmations and status changes are processed asynchronously, so delivery never blocks the booking flow.

Co-host system

Implementation
Hosts can delegate property management to co-hosts, who operate through dedicated dashboards.

Admin platform

Problem
Listings, reservations, users, and reports need efficient day-to-day management.
Implementation
Administrative APIs with dashboards and reporting endpoints, gated by role-based authorization.

04 — Performance

Search indexes

Frequently searched fields are indexed, and the filtering queries are shaped around those indexes.

Less database work

Unnecessary database work was stripped out of request paths rather than optimized in place.

Async processing

Booking confirmations, status changes, and notification delivery run asynchronously, off the request path.

05 — Security

Secure booking flow

Server-side validation, ownership checks, and availability verification all run before a booking is allowed to reach payment.

Role-based authorization

Administrative APIs and dashboards are gated by role-based authorization.

Further Reading