How zahraaasgari/medical-appointment-app works
This Telegram Mini App lets clinic staff—not patients—authenticate, manage a clinic’s schedule and records, and complete appointment workflows in a Persian RTL interface. The UI shell hosts the daily timeline, appointment and patient management, and profile settings; forms call protected API routes, which enforce user-scoped access and scheduling conflicts before database operations. The README documents broad API capabilities, while several route implementations are unsampled; those subsystems are represented from documented routes, without asserting unverified internal calls.
Main entry points: api.ts API client · index.ts PostgreSQL · session.ts Session access · page.tsx Tab shell
Components 26
Staff interface
- Tab shell
src/app/page.tsx - App state
src/components/providers.tsx - Daily timeline
src/components/home-tab.tsx - Appointment views
src/components/appointments-tab.tsx - Patient management
src/components/patients-tab.tsx - Profile settings
src/components/profile-tab.tsx - Workflow forms
src/components/forms.tsx - Jalali picker
src/components/date-picker.tsx - UI primitives
src/components/ui.tsx - Telegram SDK
src/lib/twa.ts - API client
src/lib/api.ts
API and scheduling
- Appointment routes
src/app/api/appointments - Patient routes
src/app/api/patients - Profile and clinic
src/app/api/profile - Working hours
src/app/api/working-hours - Unavailable slots
src/app/api/unavailable - Conflict checking
src/lib/appointments.ts - Appointment DTOs
src/lib/dto.ts - Date and formatting
src/lib/format.ts
Identity and setup
- Telegram sign-in
src/app/api/auth/telegram/route.ts - Session access
src/lib/session.ts - Account defaults
src/lib/seed.ts
Persistence
- PostgreSQL
src/db/index.ts - Clinic data model
src/db/schema.ts
Other components
- Clinic staff
- Telegram platform
Connections 43
- Clinic staff → Tab shell: uses
README.md - Tab shell → App state: renders
src/app/page.tsx - Tab shell → Daily timeline: renders
src/app/page.tsx - Tab shell → Appointment views: renders
src/app/page.tsx - Tab shell → Patient management: renders
src/app/page.tsx - Tab shell → Profile settings: renders
src/app/page.tsx - Daily timeline → API client: fetches
src/components/home-tab.tsx - Appointment views → API client: fetches
src/components/appointments-tab.tsx - Profile settings → API client: fetches
src/components/profile-tab.tsx - Patient management → API client: fetches
- App state → API client: fetches
src/components/providers.tsx - App state → Workflow forms: opens
src/components/providers.tsx - Workflow forms → API client: submits
src/components/forms.tsx - Workflow forms → Jalali picker: renders
src/components/forms.tsx - Daily timeline → Jalali picker: opens
src/components/home-tab.tsx - Workflow forms → UI primitives: renders
src/components/forms.tsx - App state → UI primitives: renders
src/components/providers.tsx - App state → Telegram SDK: uses
src/components/providers.tsx - API client → Appointment routes: requests
README.md - API client → Patient routes: requests
README.md - API client → Profile and clinic: requests
README.md - API client → Working hours: requests
README.md - API client → Unavailable slots: requests
README.md - Appointment routes → Session access: requires user
src/app/api/appointments/route.ts - Patient routes → Session access: requires user
src/app/api/patients/route.ts - Profile and clinic → Session access: requires user
src/app/api/profile/route.ts - Working hours → Session access: requires user
src/app/api/working-hours/route.ts - Unavailable slots → Session access: requires user
src/app/api/unavailable/route.ts - Appointment routes → Conflict checking: checks conflicts
src/app/api/appointments/route.ts - Appointment routes → Appointment DTOs: maps results
src/app/api/appointments/route.ts - Appointment routes → PostgreSQL: queries
src/app/api/appointments/route.ts - Patient routes → PostgreSQL: queries
src/app/api/patients/route.ts - Profile and clinic → PostgreSQL: queries
src/app/api/profile/route.ts - Working hours → PostgreSQL: queries
src/app/api/working-hours/route.ts - Unavailable slots → PostgreSQL: queries
src/app/api/unavailable/route.ts - Telegram sign-in → Telegram platform: validates initData
README.md - Telegram sign-in → Session access: creates session
src/app/api/auth/telegram/route.ts - Telegram sign-in → Account defaults: bootstraps demo
src/app/api/auth/telegram/route.ts - Session access → PostgreSQL: reads and writes
src/lib/session.ts - Account defaults → PostgreSQL: initializes records
src/lib/seed.ts - PostgreSQL → Clinic data model: uses tables
README.md - Conflict checking → PostgreSQL: checks schedule data
src/lib/appointments.ts - Appointment routes → Date and formatting: validates dates
src/app/api/appointments/route.ts