Three apps, one platform
Two frontends and one backend. Each is independently runnable and talks to the API over HTTPS/JSON.
Patient App :5173
The public-facing booking experience for patients.
- Browse doctors & services
- Book and pay online
- View appointments & prescriptions
- AR / EN with full RTL
- Light / dark theming
Staff Dashboard :4321
The internal control room for running the clinic.
- Role-based experience
- Admin — staff, services, reports
- Receptionist — front desk & calendar
- Doctor — schedule & visits
Backend API :5180
The single source of truth behind both apps.
- JWT authentication
- Race-safe slot engine
- Swagger UI at
/swagger - 44 REST endpoints
Architecture
Both clients call the same API over HTTPS/JSON with a JWT bearer token. The API layers requests through controllers and services into EF Core, persisting to SQL Server LocalDB.
:5173 and :4321 — a comma-separated list, so multiple dev origins are supported
Tech stack
A modern TypeScript frontend pairing with a clean .NET backend, with i18n, theming, and auth as cross-cutting concerns across the whole platform.
Frontend UI
Backend API
Cross-cutting Both
Roles & permissions
Four roles. The matrix below maps every core capability to the roles allowed to perform it. Permissions are always enforced on the server.
| Capability | Patient | Receptionist | Admin | Doctor |
|---|---|---|---|---|
| Browse doctors & slots (incl. anonymous) | ✓ | ✓ | ✓ | ✓ |
| Book & pay online | ✓ | — | — | — |
| View own appointments & prescriptions | ✓ | — | — | — |
| Day calendar | — | ✓ | ✓ | — |
| Walk-in booking | — | ✓ | ✓ | — |
| Check-in / no-show / cash-paid / reschedule | — | ✓ | ✓ | — |
| Manage services & availability | — | ✓ | ✓ | — |
| Add doctors / receptionists & reports | — | — | ✓ | — |
| Complete visit + write diagnosis / prescription | — | — | — | ✓ |
| View patient history | — | — | — | ✓ |
Appointment lifecycle
An appointment moves through a small set of states. Online bookings start as PendingPayment; cash / in-clinic bookings land on Confirmed directly.
End-to-end flows
Four real journeys through the system, from a patient booking online to an admin onboarding a new doctor.
a Patient books online (pays now)
b Patient books in-clinic (pays cash)
c Clinic day — reception, doctor, patient
d Admin onboards a doctor, reception books a walk-in
API at a glance
All 44 endpoints, grouped by area. Base path /api, served at :5180. Methods are color-coded; auth shows the access level required.
Auth 5 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/auth/register | Anonymous | Patient signup |
| POST | /api/auth/login | Anonymous | Authenticate, receive JWT |
| GET | /api/auth/me | Authed | Current user profile |
| PUT | /api/auth/profile | Authed | Update own profile |
| PUT | /api/auth/password | Authed | Change password |
Doctors & Slots 8 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/doctors | Anonymous | Paged doctor search |
| GET | /api/doctors/{id} | Anonymous | Doctor detail |
| GET | /api/doctors/{id}/slots | Anonymous | Available slots (query: date, serviceId) |
| GET | /api/doctors/{id}/availability | Admin · Recep | Read weekly availability |
| PUT | /api/doctors/{id}/availability | Admin · Recep | Set weekly availability |
| GET | /api/doctors/{id}/blocked-dates | Admin · Recep | List blocked days |
| POST | /api/doctors/{id}/blocked-dates | Admin · Recep | Block a date |
| DELETE | /api/doctors/{id}/blocked-dates/{date} | Admin · Recep | Unblock a date |
Services 4 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/services | Anonymous | List services |
| POST | /api/services | Admin · Recep | Create a service |
| PUT | /api/services/{id} | Admin · Recep | Update a service |
| DELETE | /api/services/{id} | Admin · Recep | Delete a service |
Appointments — Patient 5 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/appointments | Patient | Book an appointment |
| GET | /api/me/appointments | Patient | My appointments |
| GET | /api/me/prescriptions | Patient | My prescriptions |
| GET | /api/appointments/{id} | Authed | Appointment detail |
| PUT | /api/appointments/{id}/cancel | Authed | Cancel (frees the slot) |
Appointments — Front desk 6 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/appointments | Admin · Recep | Day calendar |
| POST | /api/appointments/walk-in | Admin · Recep | Book a walk-in |
| PUT | /api/appointments/{id}/reschedule | Admin · Recep | Move to another slot |
| PUT | /api/appointments/{id}/arrived | Admin · Recep | Check in → Arrived |
| PUT | /api/appointments/{id}/no-show | Admin · Recep | Mark no-show |
| PUT | /api/appointments/{id}/cash-paid | Admin · Recep | Record cash payment |
Doctor — Clinical 5 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| PUT | /api/appointments/{id}/complete | Doctor | Complete the visit |
| POST | /api/appointments/{id}/visit | Doctor | Record visit + prescription |
| PUT | /api/visits/{id} | Doctor | Update a visit |
| GET | /api/doctor/schedule | Doctor | My schedule |
| GET | /api/patients/{id}/history | Doctor | Patient history |
Patients 2 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/patients | Admin · Recep | Create a patient record |
| GET | /api/patients | Admin · Recep | List / search patients |
Admin 6 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/admin/staff | Admin | List staff |
| POST | /api/admin/doctors | Admin | Add a doctor |
| POST | /api/admin/receptionists | Admin | Add a receptionist |
| PUT | /api/admin/staff/{id} | Admin | Update staff member |
| PUT | /api/admin/staff/{id}/active | Admin | Activate / deactivate |
| GET | /api/admin/reports | Admin | Clinic reports |
Dashboard 1 endpoint
| Method | Path | Auth | Purpose |
|---|---|---|---|
| GET | /api/dashboard/stats | Admin · Recep | Dashboard statistics |
Payments 2 endpoints
| Method | Path | Auth | Purpose |
|---|---|---|---|
| POST | /api/payments/webhook | Anonymous | Payment provider webhook |
| POST | /api/payments/mock/pay | Anonymous | Mock pay (dev/demo) |
Plus GET /health — no auth, not under /api — a liveness/readiness probe (200 healthy / 503 unhealthy).
Getting started
Each app runs independently. Start the API first, then either or both frontends.
Backend API :5180
Patient App :5173
Staff Dashboard :4321
Seeded credentials
The database seeds one doctor with two services — General Consultation (30 min / 300 EGP) and Follow-up (15 min / 150 EGP) — with working days Sun–Thu. Doctor cards also carry rating, reviewCount, and yearsExperience.
| Role | Name | Password | |
|---|---|---|---|
| Admin | — | admin@clinic.local | Admin#123 |
| Doctor | Dr. Layla Hassan | doctor@clinic.local | Doc#123 |
| Receptionist | Mona Adel | reception@clinic.local | Recep#123 |
| Patient | Ahmed Samir | patient@clinic.local | Pat#123 |
docs/postman/Clarity-Clinic.postman_collection.json
Full API reference (browsable) → /docs/api-reference.html
Frontend integration notes: FRONTEND.md