Booking & management systemBarbearia Paulo e Sonely
Interactive demo of the booking app
Simulation: no real booking is made.
01
Context and problem
The shop needed customers to book on their own, at any hour, without back-and-forth messages. The system also stores real people's names and phone numbers, so security and privacy couldn't be an afterthought: each barber sees only what they need, bots can't flood the calendar, and data has to survive any failure.
02
Architecture and security decisions
The server decides, the browser only asks
Price, duration and availability are computed in the database. An Edge Function validates every request with Zod before calling PostgreSQL functions, so nobody can book for free or out of hours by editing the request.
No double booking, even under concurrency
A PostgreSQL exclusion constraint (btree_gist) prevents overlapping bookings for the same barber. The rule lives in the database, so it holds even if two customers click in the same second.
RLS and MFA for anyone who sees data
Row Level Security on every table plus role-based access. Owners and managers can only read data with an MFA session (aal2): a leaked password isn't enough.
Built for many barbershops
The database is multi-tenant from day one: every table stores the shop that owns the row, and foreign keys include it. A row can never point at another shop's data, and RLS keeps each shop isolated.
Bot protection and rate limiting
Cloudflare Turnstile on create and reschedule, plus rate limits per IP and per phone. IPs are stored only as hashes, never in plain text.
A manage link without a login
Customers reschedule or cancel through a link with a random token. The database stores only its SHA-256 hash, so a database leak doesn't expose the links.
Daily encrypted backup
A GitHub Actions workflow exports and encrypts the database every day, and automated tests cover database and security rules.
03
Architecture
Cliente
Picks service, barber and time. Never sends price or duration.
Select a block in the diagram to see its details.