Demo & Documentation

Online Appointment Booking System

Complete, production-ready booking flow for medical clinics

8-Step Booking Flow

✓ Doctor selection with specialty display

✓ Interactive calendar (30-day range)

✓ Real-time availability checking

✓ Patient information form

✓ Identity verification (phone + DOB)

✓ Visit reason collection

✓ Confirmation review

✓ Success confirmation with booking ID

Features

✓ Responsive design (mobile-first)

✓ Bilingual support (EN/ZH)

✓ Real-time slot availability

✓ Appointment cancellation with token

✓ Form validation & error handling

✓ Timezone-aware scheduling

✓ Schedule & blockout integration

✓ No login required

Server Actions (Public API)

getClinicDetails(clinicID)

Fetch clinic info and associated practitioners

getAvailableSlots(clinicID, practitionerID, date, duration?)

Get available time slots considering schedules, blockouts, and existing appointments

createOnlineBooking(bookingData)

Create new appointment with guest information

cancelAppointmentByToken(appointmentId, cancelToken)

Cancel appointment using secure token

File Structure
src/app/book/
├── [clinicID]/
│   ├── page.tsx              # Server-rendered booking page
│   └── confirm/page.tsx      # (Optional) Success confirmation page
├── cancel/page.tsx           # Appointment cancellation page
├── demo/page.tsx             # This page
├── booking-form.tsx          # Multi-step form (Client)
├── actions.ts                # Server actions for business logic
├── i18n.ts                   # Translations (EN/ZH)
└── components/
    ├── DoctorSelector.tsx    # Step 1 component
    ├── DateSelector.tsx      # Step 2 component
    ├── TimeSlotSelector.tsx  # Step 3 component
    └── PatientForm.tsx       # Step 4-6 component

src/app/api/book/
└── cancel/route.ts           # Cancel API endpoint

src/app/zh/book/
└── [clinicID]/page.tsx       # Chinese booking page
Integration Example

English booking page:

/book/clinic123

Chinese booking page:

/zh/book/clinic123

Language parameter (alternative):

/book/clinic123?lang=zh
Database Requirements

The system uses existing Prisma models:

  • Clinic - Clinic information
  • Practitioner - Doctors/practitioners
  • PractitionerSchedule - Weekly schedules
  • PractitionerBlockout - Blocked time periods
  • Appointment - Appointment bookings
Implementation Notes

• Email notifications should be queued from createOnlineBooking() in production

• Cancel link should be included in appointment confirmation email

• Phone number validation is basic (10+ digits); customize as needed

• All times are displayed in user's local timezone

• Schedule availability is gap-based (uses slot duration, not appointment duration)

To test the booking system, you need to have:

  • ✓ A Clinic in the database
  • ✓ Practitioners assigned to that clinic
  • ✓ PractitionerSchedules configured