The Doctor Appointment Booking System is a full-stack web application built using the MERN Stack: MongoDB, Express.js, React.js, and Node.js. This platform streamlines the process of booking medical appointments online by enabling Admins, Doctors, and Users to manage profiles, schedules, and appointments with ease.
The backend features secure authentication, image upload with Cloudinary, appointment management, and role-based dashboards, while the frontend (React) provides a responsive and interactive UI.
- Key Features
- Project Structure
- Tech Stack
- Installation & Setup
- API Endpoints
- Testing
- Deployment
- Future Improvements
- Author
- Acknowledgments
- Secure registration and login with JWT authentication
- Profile management, including uploading and updating profile photos
- Intuitive appointment booking, viewing, and cancellation
- Seamless and secure online payment processing
- Secure doctor login and role-based dashboard access
- Full control over appointment management: view, confirm, complete, or cancel
- Ability to update profile and professional details, including image uploads
- Access to a personalized dashboard summarizing key performance metrics
- Role-restricted admin authentication with elevated privileges
- Doctor onboarding: add new doctors with image uploads and role assignments
- View and manage the list of all registered doctors
- Toggle doctor availability and manage platform compliance
- Access to comprehensive appointment analytics and system dashboard
- JWT-based token authentication for all user roles (Admin, Doctor, User)
- Passwords encrypted using bcrypt hashing
- Middleware-layered access control ensures secure and role-specific route access
- Image handling via Cloudinary (CDN) + Multer (upload middleware)
- Global error handling, request validation, and secure RESTful API conventions
- Standardized HTTP status codes and response structure for consistent API usage
- Built with React (Vite) for lightning-fast performance and optimized build pipeline
- Styled using Tailwind CSS with full mobile responsiveness
- Organized in a scalable component architecture for maintainability and reusability
- Integrated with Axios and React Router for robust API communication and navigation
- Enhanced UX with Toast notifications and role-based conditional rendering
π¦ DOCTOR-APPOINTMENT-SYSTEM
βββ backend (Express + Node + MongoDB)
β βββ config/
β β βββ cloudinary.js
β β βββ mongodb.js
β βββ controllers/
β β βββ adminController.js
β β βββ doctorController.js
β β βββ userController.js
β βββ middlewares/
β β βββ authAdmin.js
β β βββ authDoctor.js
β β βββ authUser.js
β β βββ multer.js
β βββ models/
β β βββ appointmentModel.js
β β βββ doctorModel.js
β β βββ userModel.js
β βββ routes/
β β βββ adminRoute.js
β β βββ doctorRoute.js
β β βββ userRoute.js
β βββ .env
β βββ server.js
β βββ package.json
β
β
βββ admin-portal (React + Vite)
β βββ public/
β βββ src/
β β βββ assets/
β β βββ components/
β β β βββ DoctorCard.jsx
β β β βββ Navbar.jsx
β β β βββ Sidebar.jsx
β β βββ context/
β β β βββ AdminContext.jsx
β β β βββ AppContext.jsx
β β β βββ DoctorContext.jsx
β β βββ layout/
β β β βββ AdminLayout.jsx
β β β βββ DoctorLayout.jsx
β β βββ pages/
β β β βββ admin/
β β β β βββ AddDoctor.jsx
β β β β βββ AllAppointments.jsx
β β β β βββ Dashboard.jsx
β β β β βββ DoctorList.jsx
β β β βββ auth/
β β β β βββ Login.jsx
β β β β βββ NotAuthorized.jsx
β β β β βββ NotFound.jsx
β β β βββ doctor/
β β β βββ DoctorAppointments.jsx
β β β βββ DoctorDashboard.jsx
β β β βββ DoctorProfile.jsx
β β βββ App.jsx
β β βββ index.css
β β βββ main.jsx
β βββ .env
β βββ index.html
β βββ vite.config.js
β βββ package.json
β
β
βββ frontend (React + Vite)
β βββ public/
β βββ src/
β β βββ assets/
β β βββ components/
β β β βββ Banner.jsx
β β β βββ ConfirmModal.jsx
β β β βββ DoctorCard.jsx
β β β βββ Footer.jsx
β β β βββ Hero.jsx
β β β βββ Navbar.jsx
β β β βββ RelatedDoctors.jsx
β β β βββ ScrollToTop.jsx
β β β βββ SpecialityMenu.jsx
β β β βββ TopDoctors.jsx
β β βββ context/
β β β βββ AppContext.jsx
β β βββ layout/
β β β βββ AdminLayout.jsx
β β β βββ DoctorLayout.jsx
β β βββ pages/
β β β βββ About.jsx
β β β βββ Appointment.jsx
β β β βββ Appointments.jsx
β β β βββ Contact.jsx
β β β βββ Doctors.jsx
β β β βββ Home.jsx
β β β βββ Login.jsx
β β β βββ NotFound.jsx
β β β βββ Profile.jsx
β β βββ App.jsx
β β βββ index.css
β β βββ main.jsx
β βββ .env
β βββ index.html
β βββ vite.config.js
β βββ package.json
- Node.js & Express.js β API and server logic
- MongoDB + Mongoose β Database & data modeling
- JWT β Role-based authentication
- bcrypt β Secure password hashing
- Cloudinary β Image hosting
- Multer β File upload handling
- dotenv β Environment variable management
- cors β Cross-origin resource sharing
- React β Component-based UI
- Vite β Lightning-fast build tool
- Tailwind CSS β Utility-first styling
- Axios β HTTP client
- React Router β SPA routing
- React Toastify β User notifications
git clone https://github.com/Mahmud-Alam/mern-doctor-appointment-booking-system.git
cd mern-doctor-appointment-booking-system/
cd backend
npm install
Create a .env
file with:
PORT=8000
MONGODB_URI='mongodb+srv://<user>:<pass>@cluster.mongodb.net'
JWT_SECRET=<your_secret>
CLOUDINARY_NAME=<name>
CLOUDINARY_API_KEY=<key>
CLOUDINARY_API_SECRET=<secret>
ADMIN_EMAIL=<email>
ADMIN_PASSWORD=<pass>
Start dev server:
npm run server
cd ../frontend
npm install
Create .env
at project root:
VITE_BACKEND_URL='http://localhost:8000'
Start the client:
npm run dev
- Admin: login β add doctors β update availability.
- Doctor: login β manage appointments.
- User: register/login β update profile β book/cancel β make payment.
POST /register
: Register a new userPOST /login
: Login user and return tokenGET /get-profile
: Get logged-in user profilePOST /update-profile
: Update profile with image uploadPOST /book-appointment
: Book an appointment with a doctorGET /appointments
: List all appointmentsPOST /cancel-appointment
: Cancel a bookingPOST /make-payment
: Make a mock payment (expandable)
GET /list
: Get list of doctorsPOST /login
: Doctor loginGET /appointments
: View all appointmentsPOST /complete-appointment
: Mark appointment as completePOST /cancel-appointment
: Cancel an appointmentGET /dashboard
: Doctor dashboardGET /profile
: Get doctor profilePOST /update-profile
: Update doctor profile
POST /login
: Admin loginPOST /add-doctor
: Add new doctor with imageGET /all-doctors
: View all registered doctorsPOST /change-availability
: Change doctorβs available statusGET /appointments
: View all appointments in systemPOST /cancel-appointment
: Cancel appointments manuallyGET /dashboard
: Admin dashboard metrics
- Use tools like Postman, Thunder Client or Insomnia.
- Implement unit tests later using Jest or Mocha.
- Build and deploy test versions.
- Use React Testing Library or Cypress for integration tests.
- Backend: Deploy on Render, Heroku, or DigitalOcean.
- Frontend: Deploy on Vercel, Netlify, or AWS.
- Configure environment variables on the platform.
- Use services like MongoDB Atlas and Cloudinary for production assets and images.
- Email notifications for bookings and cancellations
- Payment integration
- Doctor availability calendar view
- Admin analytics dashboard
- Pagination and filtering for large appointment datasets
Mahmud Alam
- π Portfolio Website
- π§ Email: mahmudalam.official@gmail.com
- π» GitHub
- πΌ LinkedIn
- MongoDB Atlas for the scalable cloud database
- Cloudinary for seamless image management
- The MERN community for open-source knowledge and resources