🔥 Project 8 — Doctor Appointment & Prescription Portal
🎯 Project Goal
Build a Doctor Appointment & Prescription Portal where patients can book appointments with doctors, doctors can write digital prescriptions, and patients can view their history.
Focus on:
➨ Clean backend structure with Express & MongoDB
➨ Correct relationships between users (patients/doctors), appointments, and prescriptions
➨Real-world constraints: no double‑booking, prescription access control, role‑based views
Core Features (Must Have)
1️⃣ Users (Two Roles)
➝Patients: name, email, phone, dateOfBirth
➝Doctors: name, email, specialty (cardiology, dermatology, etc.), licenseNumber
2️⃣ Appointments
➝ Fields: patientId, doctorId, date, timeSlot (e.g., "10:00-10:30"), status (pending, confirmed, completed, canceled), reason (symptom description)
➨ Constraints:
➝ No two appointments for same doctor at overlapping timeSlots
➝Patients cannot book if they already have an appointment at that same time
➨ Features:
➝Patients: create (book), cancel, view their appointments
➝Doctors: view their schedule, confirm or cancel appointments
3️⃣ Prescriptions
➝Fields: appointmentId (linked to a completed appointment), patientId, doctorId, medications (array of objects: name, dosage, duration), instructions, dateIssued
➝Only doctors can create prescriptions (after an appointment is completed)
➝ Patients can view their own prescriptions (not modify)
4️⃣ Search & Filtering
➝ Patients can search doctors by specialty or name
➝ Doctors can filter appointments by date or status
➝Optional: pagination for appointment lists
5️⃣ Aggregation & Reports
➝ Number of appointments per doctor (last 30 days)
➝ Most prescribed medication across all prescriptions
➝Average number of appointments per patient
➝ Optional: monthly report of completed appointments per specialty
6️⃣ Data Structure & Relationships
➨Users (Doctors) → Appointments: One‑to‑Many
➨Users (Patients) → Appointments: One‑to‑Many
➨Appointments → Prescriptions: One‑to‑One (a prescription belongs to one completed appointment)
➨ Prescriptions → Medications: Embedded array (no separate collection needed)
7️⃣ Backend Requirements
➝ Use MongoDB + Mongoose
➝Use Express routers to modularize: /users, /appointments, /prescription:
➝ CRUD where appropriate:
➢Users: register/login (role‑based)
➢ Appointments: create, read, update (status only), cancel
➢ Prescriptions: create (doctors only), read (patients & doctors)
➝Use query parameters (?specialty=cardiology, ?date=2026-04-27)
➝ Implement overlap check before saving appointment (business logic in controller or schema pre‑save)
✅ Expected Outcomes
➝· Patients can find doctors by specialty, book appointments without time conflicts, and view their own prescriptions.
➝· Doctors can manage their schedule, confirm/cancel appointments, and write prescriptions after visits.
➝· Admins / dashboard can see aggregated reports: busiest doctors, top medications, appointment trends.
➝· Relationships between collections are correctly referenced (ObjectId) and populated when needed.
➝· Data integrity is maintained (no double‑booking, prescriptions only after completed appointments).
Pro tip: Start with users and appointments — get the time‑slot validation right. Then add prescriptions. Finally add aggregation reports.
Commit after each working feature. Use a .env for your MongoDB URI.
When you’re done building your project:
💥 Push to GitHub
💥 Deploy with GitHub Pages / Netlify
💥 Share your repo + live demo with us
💥invite a friend,
and as always —
💥stay well, stay curious, and stay coding ✌️
27 abr, 04:42
