Skip to content
In development

ReservationEngine

A multi-tenant booking engine: providers publish services and schedules, consumers book them.

Illustration of the ReservationEngine provider admin: a provider switcher, a list of services with durations and prices, a weekly availability grid with open slots, and a column of upcoming bookings with one new booking highlightedPROVIDER · STUDIO ASERVICESSCHEDULEBOOKINGSISOLATED PER PROVIDERSERVICES0430 MIN€ 2045 MIN€ 3060 MIN€ 4590 MIN€ 60+ ADD SERVICEAVAILABILITYWEEK 24MONTUEWEDTHUFRI09:0010:0011:0012:0013:0014:0015:0016:00NEWOPENBOOKEDBLOCKED15-MIN STEPS · BUFFERS · LEAD TIMEUPCOMING06MON 09:00CONFIRMED30 MINMON 10:00CONFIRMED45 MINTUE 11:00CONFIRMED60 MINWED 11:00NEW45 MINWED 14:00PENDING30 MIN
Stack
  • NestJS
  • Prisma
  • PostgreSQL
  • Next.js

01 — Context

ReservationEngine is a multi-tenant reservation engine. Providers publish services and a weekly schedule, and consumers book them. Tenant and Provider are the same thing: every tenant-owned row carries its provider id. Background: to be written.

02 — What I built

  • A NestJS modular monolith with bounded contexts: accounts, providers and reservations.
  • Prisma and PostgreSQL, with Row Level Security isolating each Provider's data in the database.
  • A reservation state machine (pending, confirmed, completed, cancelled, expired, no-show) kept in a pure domain layer.
  • Better Auth for authentication, and zod validation on the API.
  • A Next.js frontend with shadcn/ui, Zustand, TanStack Query and react-hook-form.
  • A test pyramid: unit tests, SQL tests against the database, API end-to-end tests, and Playwright browser tests, all run in GitHub Actions CI.

03 — Decisions

Tenant isolation in the database

Chose Postgres Row Level Security per Provider

The repo's RLS doc describes the mechanism: the tenant is set per transaction through a Postgres setting, and policies fail closed, so a missing setting returns no rows. The app connects as a role that is subject to RLS.

Layering and structure

Chose A modular monolith with a domain layer only for reservations

The repo's rules keep the pure state machine and slot math in the reservations domain, and use plain controller, service and Prisma elsewhere.

Testing strategy

Chose A test pyramid: unit, SQL, e2e, Playwright

Prompt: what did each layer catch that the others could not?

04 — Outcome

In development.

05 — Gallery

Screens are coming.