07
TL;DRDouble bookings and unpaid no-shows from DMs → a PostgreSQL exclusion constraint and prepaid holds → double bookings impossible at the schema level.
- Role
- Full-Stack Engineer
- Client
- Vysota 890 · Carpathians
- Year
- 2024
- Stack
- Next.js, TypeScript, PostgreSQL, Payment gateway
In one paragraph
The database itself makes a double booking impossible. Bookings moved from DMs to the site and the owner manages availability from one calendar.
Context
The lodge took bookings through phone calls and DMs. Double bookings happened and unpaid no-shows cost real money.
Problem
No single source of truth for availability, and nothing was prepaid.
What I did
- 01
Exclusion constraints
Bookings stored as date ranges with a PostgreSQL exclusion constraint — overlaps are rejected by the database, not by hope.
- 02
Prepayment holds
A reservation is confirmed by online prepayment; unpaid holds release automatically after a timeout.
- 03
Owner in the loop
Every confirmed booking lands in the owner's Telegram with dates, guest contact and payment status.
Results
0
double bookings possible at the schema level
100%
of confirmed reservations are prepaid
Stack
- Next.js
- TypeScript
- PostgreSQL
- Payment gateway
- Telegram Bot API