Live demo

Booking for several practices without overlapping appointments

A working live demo of a system that separates the data of each practice, blocks double booking of the same slot and starts the payment only after the slot is secured.

Client
Live demo · sample clinics and test data
Duration
About 2 days
Live demo of the booking system: a doctor’s free slots on the following days
The booking system on a phone
Live demo — screenshot

Before

  • In a simple version, two people can try to take the same slot
  • One missing filter can expose another practice’s data
  • A payment started before the slot is locked risks a refund
  • A calendar that is not refreshed can show a slot that is already gone

After

  • The database accepts only one active booking for a given slot
  • Separation of the practices’ data is enforced on every read
  • First the slot is locked, only then does the payment start
  • 9 of 9 runs of the full path completed correctly

Live demo: dental.arturmrowicki.pl  ·  Source code: GitHub

An easy calendar, difficult edge cases

Booking an appointment looks simple: the patient picks a doctor and a time, and pays. The difficulty appears when two people click the last free slot almost at the same moment, or when the payment confirmation arrives late.

I built this project as a live demo for several independent practices. Each one has its own calendar and sees only its own patients. Payments run in test mode, so the demo does not take real money.

Four things that cannot be left to chance

  • The same slot. Two people cannot get a confirmation of the same appointment.
  • The practices’ data. Practice A cannot see the patients of practice B.
  • The order of payment. A patient should not pay for a time the system has not secured.
  • An up-to-date calendar. A taken slot should also disappear for someone who already has the page open.

How the system makes sure of it

The database has the last word

It is not the screen that decides whether a slot is free. The database allows only one active booking for a given doctor and time. If two requests arrive simultaneously, the first takes the slot and the second gets a clear message that someone has just beaten them to it.

Each practice stays in its own area

The access restriction is written next to the data itself, not only in the page view. Even a faulty query from the application should not return another practice’s records to an employee. A patient can book an appointment without creating an account, but gets no direct access to the database.

First the slot, then on to the payment

The system locks the chosen time for 15 minutes, and only then opens the payment page. A repeated confirmation from the payment provider does not create a second appointment or change it again. If the message arrives after the lock has expired, the event is saved for a refund to be handled.

The calendar changes without a reload

When someone takes a slot, it disappears from the screens of other people viewing the same doctor’s calendar. There is no need to refresh the page by hand.

How I checked the full path

An automated run creates a booking in the working live demo, rejects a second attempt for the same time, starts the payment, accepts a signed confirmation and sends it again to make sure nothing is charged twice. All 9 steps checked completed correctly.

Check it yourself

The demo runs in test mode and does not take real payments:

  • choose a clinic and a free slot on the demo site,
  • use the Stripe test card 4242 4242 4242 4242, any future date and any CVC code,
  • open the same calendar in two windows and watch the taken slot disappear in the other one.

What is ready, and what would need more work

What is ready is the booking core, the separation of practices, the test payment and the live calendar updates. Before use in a specific chain, the doctors’ schedules, cancellation rules, automatic refunds, the wording of consents and the way medical data is processed would have to be adapted. The live demo does not pretend to be a finished product for every clinic.

For the technically interested

The project uses Next.js, a PostgreSQL database provided by Supabase and Stripe test payments. The one-booking limit and the split of data between practices are enforced in the database, so they do not depend solely on the screen’s code being correct.

Technologies in this project

Next.js 14TypeScriptSupabasePostgreSQLRLSStripeRealtimeVercel

A similar situation at your company?

Call and tell me what has to work.

You do not need to know the technical terms. The first conversation is free — I will tell you where I would start.

Before you pay, you see how it will work.

A free demo: a working demo, a mock-up, a cost calculation or a repair plan. Then a fixed price in writing and a warranty of at least 30 days on every stage.

If I don’t pick up, I call back the same business day.

← All case studies