How gildaciolopes/doctor-schedule works
Dr. Schedule is a clinic-management SaaS. Its documented user journey is account creation/login, subscription or trial access, clinic setup, then managing doctors, patients and appointments and reviewing clinic metrics. The repository separates Next.js screens and API routes from server actions, authentication/session logic, dashboard queries and Drizzle/PostgreSQL data. The README documents the broad product workflow; source-index references and excerpts support the implementation links shown. Several CRUD and billing internals were not sampled, so their specific call paths are not inferred.
Main entry points: index.ts Drizzle connection · auth.ts Auth service · route.ts Data export · with-authentication.tsx Access guard
Components 22
Web experience
- Marketing site
src/app/page.tsx
Clinic operations
- Clinic setup
src/actions/create-clinic/index.ts - Doctor management
src/app/(protected)/doctors - Patient management
src/app/(protected)/patients - Appointment management
src/app/(protected)/appointments - Available times
src/actions/get-available-times/index.ts - Clinic dashboard
src/app/(protected)/dashboard/page.tsx - Dashboard queries
src/data/get-dashboard.ts - Data export
src/app/api/export/[entity]/route.ts
Identity and access
- Account screens
src/app/authentication - Auth API
src/app/api/auth/[...all]/route.ts - Auth service
src/lib/auth.ts - Session lookup
src/lib/get-session.ts - Access guard
src/hocs/with-authentication.tsx - Trial rules
src/helpers/demo-trial.ts
Data and billing
- Subscription screen
src/app/(protected)/subscription/_components/subscription-plan.tsx - Checkout action
src/actions/create-stripe-checkout/index.ts - Billing webhook
src/app/api/stripe/webhook/route.ts - PostgreSQL data
src/db/schema.ts - Drizzle connection
src/db/index.ts
Other components
- Visitor / staff
- Stripe
Connections 26
- Visitor / staff → Marketing site: visits
src/app/page.tsx - Visitor / staff → Account screens: signs up
README.md - Account screens → Auth API: authenticates
- Auth API → Auth service: routes to
- Auth service → Drizzle connection: reads session data
src/lib/auth.ts - Drizzle connection → PostgreSQL data: maps schema
src/db/index.ts - Session lookup → Auth service: gets session
src/lib/get-session.ts - Access guard → Session lookup: checks session
src/hocs/with-authentication.tsx - Access guard → Trial rules: checks trial
src/hocs/with-authentication.tsx - Visitor / staff → Subscription screen: selects plan
README.md - Subscription screen → Checkout action: starts checkout
src/app/(protected)/subscription/_components/subscription-plan.tsx - Checkout action → Stripe: creates checkout
- Stripe → Billing webhook: sends events
README.md - Billing webhook → Drizzle connection: updates billing data
src/app/api/stripe/webhook/route.ts - Visitor / staff → Clinic setup: creates clinic
README.md - Visitor / staff → Doctor management: manages doctors
README.md - Visitor / staff → Patient management: manages patients
README.md - Visitor / staff → Appointment management: manages appointments
README.md - Appointment management → Available times: requests times
- Available times → Drizzle connection: queries schedules
src/actions/get-available-times/index.ts - Visitor / staff → Clinic dashboard: views metrics
README.md - Clinic dashboard → Dashboard queries: loads metrics
- Dashboard queries → Drizzle connection: queries clinic data
src/data/get-dashboard.ts - Visitor / staff → Data export: requests export
- Data export → Auth service: checks session
src/app/api/export/[entity]/route.ts - Data export → Drizzle connection: reads clinic records
src/app/api/export/[entity]/route.ts