Kridaz: booking a sports court with money involved, and no double-bookings.
Two players can tap the same 6:30 slot at the same second. I built the Flutter app and the Supabase backend so that only one of them can ever pay for it.
- Role
- Flutter app, Supabase backend, Next.js admin
- Users
- Players · venue owners · admins
- Stack
- Flutter · Riverpod · Supabase · Razorpay
- Links
- Google Play

Bookings, payments and refunds have to agree, even when the network doesn't.
Players pay part online and part at the venue, repeat bookings weekly and cancel late. Owners need today's bookings and revenue. A payment that succeeds while the app is offline must still end up as a booking.
The database is the referee; the app and the webhook just ask it.
- Flutter appplayer + owner roles
- Supabase Postgresslot holds · constraints
- Razorpaycheckout · webhooks
Trade-offs I made on purpose.
- 01
Block double-booking in the database, not the app
A Postgres exclusion constraint on court and time range means two overlapping bookings cannot both be saved, whatever the client does.
- 02
Webhook is the source of truth for payments
The app's success screen is not trusted on its own. The booking is confirmed when Razorpay's signed webhook arrives.
- 03
One app, two roles
Players and venue owners share one Flutter codebase and one backend; role-based screens keep the release process single.
- 04
Phone OTP sign-in
Players in the target market sign in with a phone number, not an email and password.
// bookings_wallet_money_path.sql
alter table public.court_slots
add constraint court_slots_no_overlap
exclude using gist (
court_id with =,
tstzrange(starts_at, ends_at, '[)') with &&
)
where (status in ('available', 'held', 'booked', 'blocked'));