HomeCase studiesTimezone-Safe Multi-Location Appointment Booking SaaS on Node.js...

Case study · Bristol, United Kingdom

Timezone-Safe Multi-Location Appointment Booking SaaS on Node.js and PostgreSQL

Service Scheduling & Multi-Location Booking

We engineered a multi-location appointment booking and resource scheduling SaaS using Node.js, React, PostgreSQL, Redis, and Stripe. Service businesses across multiple branches configure staff shifts, room equipment dependencies, buffer intervals, and cancellation policies while end customers book conflict-free slots online in real time. PostgreSQL range exclusion constraints, temporary checkout holds, and asynchronous calendar webhooks eliminate double-bookings even under bursty promotional traffic.

Industry
Service Scheduling & Multi-Location Booking
Solution
TypeScript Node.js scheduling engine and React booking portals backed by PostgreSQL temporal constraints, Redis holds, BullMQ jobs, and Stripe settlement.
Platforms
Web & API
Stack
Node.js · TypeScript · React · PostgreSQL · Redis · Stripe
Location
Bristol, United Kingdom · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Bristol, United Kingdom. Names withheld by agreement.

Project Overview

Multi-branch service businesses—ranging from specialist clinics to wellness studios and repair centers—depend on exact coordination between staff availability, physical rooms, and customer expectations. Out of Bristol, we built a multi-location appointment booking SaaS on Node.js, React, PostgreSQL, Redis, and Stripe that replaces fragile manual diaries with deterministic availability calculation and automated customer self-service.

Business Bottleneck

Operators expanding beyond a single branch struggled with overlapping appointments whenever receptionists updated shared spreadsheets at the same moment online customers submitted web forms. External practitioner calendars routinely drifted out of sync, deposits were chased manually over phone calls, and daylight saving shifts introduced off-by-one-hour errors for regional locations. Businesses needed an embeddable online booking flow and an operational dispatch calendar capable of enforcing room constraints, cancellation cutoffs, and multi-branch payouts cleanly.

Architectural Strategy

We placed temporal correctness directly inside PostgreSQL rather than relying exclusively on application-level mutexes that break across scaled Node.js processes. Using PostgreSQL's native tstzrange type and GiST EXCLUDE constraints guarantees at the storage engine level that neither two customers nor a receptionist and an online guest can claim overlapping time for the same practitioner or treatment room.

Node.js and TypeScript compute open slot grids dynamically from shift rules, service buffers, and synced external busy blocks, while Redis holds transient checkout reservations long enough for customers to complete Stripe authentication without blocking inventory indefinitely.

Core Capabilities

  • Multi-Branch Service Catalogs: Per-location pricing, duration, buffer padding, and paired resource requirements such as specific rooms or equipment.
  • Embeddable Customer Booking Widget: Lightweight React flow allowing clients to select branch, service, practitioner preference, and local-timezone slot without redirects.
  • Deposit & Full-Pay Checkout: Configurable deposit rules, card-on-file holds for late-cancellation fees, and branch-scoped Stripe settlement.
  • Two-Way Calendar Synchronization: Real-time busy-time imports and outbound booking updates for practitioner Google and Microsoft calendars.
  • Automated Reminder & Waitlist Engine: Scheduled SMS and email reminders alongside automatic waitlist notifications when cancellations reopen prime slots.
  • Front-Desk Dispatch Calendar: Drag-to-reschedule multi-column staff timeline supporting walk-ins, recurring appointments, and instant status tracking.

Technical Architecture

Flow: Customer / Receptionist (React SPA) -> Node.js TypeScript API -> PostgreSQL (GiST Exclusion Constraints) & Redis (Checkout Hold TTL) / BullMQ -> Stripe & External Calendars

When a customer opens the booking widget, React queries the Node.js availability endpoint with location, service ID, and date window. The service loads staff shifts, active bookings, and external calendar blocks in UTC, applies prep and teardown buffers, and caches computed slot arrays briefly in Redis for fast pagination.

Once a slot is chosen, the API opens a PostgreSQL transaction to insert a pending_hold reservation row. Because tstzrange exclusion constraints cover both confirmed and active pending_hold rows, competing requests fail cleanly with a 409 Conflict prompt to pick another time. Simultaneously, Node.js initializes a Stripe PaymentIntent and schedules a BullMQ expiry job. When the Stripe webhook confirms payment, the row flips to confirmed and triggers outbound calendar sync and confirmation alerts; if checkout stalls past the hold TTL, the cleanup worker expires the hold and frees the range.

Technology Stack

Category Technology detail
API & Domain Engine Node.js and TypeScript modular services handling availability computation and booking state
Client & Admin UI React SPA with embeddable booking widget and multi-branch calendar console
Scheduling Database PostgreSQL leveraging tstzrange exclusion constraints for zero-overlap bookings
Checkout Hold Layer Redis TTL slot locks preserving selected times briefly during payment entry
Job Orchestration BullMQ queues managing SMS/email reminders, no-show workflows, and webhook retries
Payments & Deposits Stripe PaymentIntents and Connect transfers supporting branch-level payouts
Calendar Bridges Two-way sync adapters for Google Calendar and Outlook busy-block webhooks
Deployment Packaging Docker containers running behind stateless reverse proxies with automated migrations

Engineering Trade-offs & Solutions

Challenge Architectural Solution
Eliminating concurrent booking race conditions across API replicas PostgreSQL tstzrange GiST EXCLUDE USING constraints covering staff and room resources atomically
Balancing checkout completion time against inventory lockup Short-lived pending reservation rows paired with deterministic BullMQ expiration jobs to release abandoned holds
Handling complex shift exceptions and daylight saving changes IANA timezone-anchored shift templates materialized into canonical UTC intervals at query and write time
Absorbing bursty availability lookups during email campaigns Short-TTL Redis caching of computed day-slot grids invalidated immediately on booking writes
Recovering missed third-party calendar push notifications Incremental delta-token polling fallback scheduled periodically alongside webhook listeners

Security & Reliability

Payment workflows never store raw card data on application servers; Stripe Elements tokenizes payment methods client-side, and webhook handlers verify Stripe cryptographic signatures before mutating booking states. Multi-tenant franchise data is partitioned by organization and branch identifiers enforced across every API policy, ensuring branch staff can view only authorized practitioner rosters and customer records.

Reminder dispatches and calendar sync calls implement idempotency keys and exponential backoff inside BullMQ so transient provider outages never double-text customers or silently drop calendar invites. Outbound webhook notifications to merchant POS or accounting endpoints include HMAC-SHA256 signatures and replay timestamps, allowing downstream integrators to verify authenticity cleanly.

Performance & Scale

Splitting read-heavy slot discovery from strict transactional reservation writes keeps browsing fast under marketing spikes while reserving database lock contention strictly for final checkout commitments. Composite GiST indexes on (location_id, practitioner_id, booking_range) keep overlap checks fast even as multi-year booking histories accumulate, and archival partitioning moves completed historical appointments out of hot active range checks cleanly.

Because availability grids depend on deterministic shift rules and compact active-range queries, horizontal Node.js replicas share stateless Redis caches cleanly behind standard load balancers. Peak morning check-in traffic from front-desk consoles remains isolated from public widget bursts through separate rate-limit buckets and connection pool quotas.

Operational Outcomes

Multi-location operators eliminated manual diary reconciliation and stopped losing bookings to overlapping schedule collisions. Front-desk teams gained live visibility across every practitioner and room in one timeline, while automated reminders and deposit holds brought predictable attendance and cleaner daily settlement across branches. Customers book directly in their local timezone without phone back-and-forth, freeing reception staff to focus on in-person service quality.

01 — Questions

asked about this kind of project

How does PostgreSQL guarantee zero double-bookings when two customers pick the same slot at the exact same millisecond?

Confirmed and pending-hold bookings store their start and end timestamps as a PostgreSQL tstzrange column protected by a GiST EXCLUDE USING constraint scoped by staff_id and location_id. The database engine itself rejects overlapping intervals atomically.

What happens if a customer starts entering card details in Stripe and abandons the tab?

Selecting a slot creates a short-lived pending booking record paired with a Redis TTL key and a delayed BullMQ expiration check. If payment fails to confirm before the hold window closes, the pending row transitions to expired and releases the slot automatically.

How do you calculate availability accurately across staff shifts, break times, service durations, and prep buffers?

The availability solver subtracts existing booking ranges, external calendar busy blocks, and staff break intervals from working-shift intervals in canonical UTC, then slices remaining open windows by service duration plus prep and cleanup buffers.

How are external Google or Outlook calendar events kept from causing stale availability?

External calendars subscribe via webhook push channels backed by incremental sync tokens. Busy blocks map into normalized blockout ranges in PostgreSQL, and a periodic reconciliation job catches missed push notifications.

How do daylight saving time transitions affect recurring weekly staff shifts across locations?

Business rules store recurring shift templates alongside each branch's IANA timezone identifier (such as Europe/London). Concrete bookable slots materialize into UTC tstzrange values using timezone-aware calendar arithmetic so clock changes never shift local opening hours.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.