How goldhoang/clinic-booking works
Clinic Booking System is a role-based clinic appointment web app. Patients register or sign in, book appointments, and manage them; doctors and administrators use role-specific dashboards and management screens. The graph shows documented user flows and source-indexed component usage, plus the sampled API-to-auth, validation, and persistence calls. Several page-to-API connections and dashboard data flows are not shown in the available excerpts, so they are omitted rather than inferred.
Main entry points: route.ts Admin user creation · dashboard/page.tsx Patient dashboard · dashboard/page.tsx Doctor dashboard · ThemeProvider.tsx Theme provider
Components 30
User experience
- Login screen
src/app/login/page.tsx - Registration screen
src/app/register/page.tsx - Appointment booking
src/app/book-appointment/page.tsx - Patient dashboard
src/app/patient/dashboard/page.tsx - Doctor dashboard
src/app/doctor/dashboard/page.tsx - Admin dashboard
src/app/admin/dashboard/page.tsx - Admin user management
src/app/admin/users/page.tsx - My appointments
src/app/my-appointments/page.tsx
App workflows
- Login endpoint
src/app/api/auth/login/route.ts - Registration endpoint
src/app/api/auth/register/route.ts - Appointment endpoints
src/app/api/appointments/route.ts - Appointment status update
src/app/api/appointments/[id]/route.ts - Admin user creation
src/app/api/admin/users/route.ts
Identity and security
- Validation and rate limits
src/lib/security.ts - Session route client
src/lib/supabase-route.ts - Privileged auth client
src/lib/supabase-admin.ts
Data and presentation
- Prisma client
src/lib/prisma.ts - Theme provider
src/components/ThemeProvider.tsx - Role theme settings
src/lib/theme.ts - Appointment card
src/components/AppointmentCard.tsx - Appointment details modal
src/components/AppointmentDetailModal.tsx - Dashboard shell
src/components/DashboardShell.tsx - Dashboard hero
src/components/HeroSection.tsx - Dashboard statistics
src/components/StatsCard.tsx - Date utilities
src/lib/date-utils.ts - Doctor specialties
src/lib/specialties.ts
Other components
- Patient
- Doctor
- Administrator
- Supabase Auth and database
Connections 47
- Patient → Login screen: signs in
README.md - Patient → Registration screen: registers
README.md - Patient → Appointment booking: books visit
README.md - Patient → Patient dashboard: views dashboard
README.md - Doctor → Doctor dashboard: views dashboard
README.md - Administrator → Admin dashboard: views dashboard
README.md - Administrator → Admin user management: manages users
README.md - Patient → My appointments: manages appointments
README.md - Login screen → Login endpoint: submits credentials
README.md - Registration screen → Registration endpoint: submits registration
README.md - Appointment booking → Appointment endpoints: books appointment
README.md - Login endpoint → Validation and rate limits: validates and limits
src/app/api/auth/login/route.ts - Login endpoint → Session route client: creates session client
src/app/api/auth/login/route.ts - Registration endpoint → Validation and rate limits: validates and limits
src/app/api/auth/register/route.ts - Registration endpoint → Session route client: creates session client
src/app/api/auth/register/route.ts - Appointment endpoints → Validation and rate limits: validates and limits
src/app/api/appointments/route.ts - Appointment endpoints → Session route client: creates session client
src/app/api/appointments/route.ts - Appointment status update → Validation and rate limits: validates and limits
src/app/api/appointments/[id]/route.ts - Appointment status update → Session route client: creates session client
src/app/api/appointments/[id]/route.ts - Admin user creation → Session route client: checks caller session
src/app/api/admin/users/route.ts - Admin user creation → Prisma client: reads and creates profile
src/app/api/admin/users/route.ts - Admin user creation → Privileged auth client: creates auth user
src/app/api/admin/users/route.ts - Admin user creation → Validation and rate limits: validates and limits
src/app/api/admin/users/route.ts - Admin user creation → Doctor specialties: checks doctor specialty
src/app/api/admin/users/route.ts - Appointment endpoints → Supabase Auth and database: reads and creates appointments
src/app/api/appointments/route.ts - Appointment status update → Supabase Auth and database: reads and updates appointment
src/app/api/appointments/[id]/route.ts - Login endpoint → Supabase Auth and database: authenticates and reads profile
src/app/api/auth/login/route.ts - Registration endpoint → Supabase Auth and database: registers and creates profile
src/app/api/auth/register/route.ts - Admin user creation → Supabase Auth and database: creates auth account
src/app/api/admin/users/route.ts - Patient dashboard → Appointment card: renders
src/app/patient/dashboard/page.tsx - Patient dashboard → Appointment details modal: renders
src/app/patient/dashboard/page.tsx - Patient dashboard → Dashboard hero: renders
src/app/patient/dashboard/page.tsx - Patient dashboard → Dashboard statistics: renders
src/app/patient/dashboard/page.tsx - Doctor dashboard → Appointment card: renders
src/app/doctor/dashboard/page.tsx - Doctor dashboard → Appointment details modal: renders
src/app/doctor/dashboard/page.tsx - Doctor dashboard → Dashboard hero: renders
src/app/doctor/dashboard/page.tsx - Doctor dashboard → Dashboard statistics: renders
src/app/doctor/dashboard/page.tsx - Admin dashboard → Date utilities: uses
src/app/admin/dashboard/page.tsx - Admin user management → Date utilities: uses
src/app/admin/users/page.tsx - My appointments → Date utilities: uses
src/app/my-appointments/page.tsx - Patient dashboard → Theme provider: uses
- Doctor dashboard → Theme provider: uses
src/app/doctor/dashboard/page.tsx - Appointment card → Theme provider: reads theme
src/components/AppointmentCard.tsx - Appointment details modal → Theme provider: reads theme
src/components/AppointmentDetailModal.tsx - Theme provider → Role theme settings: loads palettes
src/components/ThemeProvider.tsx - Dashboard shell → Theme provider: uses theme
src/components/DashboardShell.tsx - Dashboard shell → Role theme settings: uses settings
src/components/DashboardShell.tsx