Skip to content

Mitan11/Prescripto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Doctor Appointment Booking System 🏥

MERN Stack Version Stripe

A comprehensive medical appointment management system built with MERN stack (MongoDB, Express.js, React.js, Node.js) featuring multi-role access, real-time scheduling, and secure payments through Stripe integration.

Table of Contents 📑

Features ✨

Multi-Role Access Control

Role Capabilities
Patient - Book/cancel appointments
- Secure payment integration
- Profile management
- Password management
Doctor - Manage Appointment
- Earnings dashboard
- Availability management
- Password management
Admin - User/doctor management
- System analytics
- Content moderation
- Password management

Core Functionalities

  • 🔐 JWT-based authentication system
  • 🔑 Secure password management with OTP verification
  • 🗓 Real-time appointment scheduling
  • 💳 Secure payment processing with Stripe
  • 📱 Responsive mobile-first design
  • 📊 Interactive dashboards with analytics
  • 📧 Email notifications for important actions

Architecture 🏗️

graph TD
    A[React Frontend] -->|HTTP Requests| B[Express API]
    B -->|Mongoose ODM| C[MongoDB Atlas]
    C -->|Data Storage| B
    B -->|JSON Responses| A
    D[Cloudinary] -->|Image Storage| B
    E[Stripe API] -->|Payment Processing| B
    F[Email Service] -->|Notifications| B
Loading

Project Structure 📂

The project is organized into three main directories: frontend, backend, and admin.

Backend Structure

backend/
├── app.js                    # Main server entry point
├── package.json              # Node.js dependencies
├── .env                      # Environment variables
├── config/                   # Configuration files
│   ├── mongodb.js            # Database connection
│   ├── cloudinary.js         # Cloudinary setup
│   └── ...
├── models/                   # Mongoose data models
│   ├── userModel.js          # Patient schema & model
│   ├── doctorModel.js        # Doctor schema & model
│   ├── appointmentModel.js   # Appointment schema & model
│   └── reviewModel.js        # Review schema & model
├── controllers/              # Request handlers
│   ├── userController.js     # Patient-related functions
│   ├── doctorController.js   # Doctor-related functions
│   └── adminController.js    # Admin-related functions
├── routes/                   # API endpoint definitions
│   ├── userRoute.js          # Patient routes
│   ├── doctorRoute.js        # Doctor routes
│   └── adminRoute.js         # Admin routes
└── middlewares/              # Express middlewares
    ├── authMiddleware.js     # JWT authentication
    └── ...

Frontend Structure

frontend/
├── src/
│   ├── main.jsx              # Entry point
│   ├── App.jsx               # Main component
│   ├── index.css             # Global styles
│   ├── components/           # Reusable UI components
│   │   ├── Navbar.jsx        # Navigation component
│   │   ├── Footer.jsx        # Footer component
│   │   ├── PreLoader.jsx     # Loading component
│   │   └── ...
│   ├── pages/                # Page components
│   │   ├── Home.jsx          # Homepage
│   │   ├── Doctors.jsx       # Doctors listing
│   │   ├── Login.jsx         # Authentication
│   │   ├── MyProfile.jsx     # User profile
│   │   └── ...
│   ├── context/              # React Context API
│   │   └── ...               # State management
│   ├── assets/               # Static files
│   └── lib/                  # Utility functions
├── public/                   # Public assets
├── package.json              # Dependencies
├── .env                      # Environment variables
├── index.html                # HTML template
└── tailwind.config.js        # Tailwind CSS config

Admin Panel Structure

admin/
├── src/
│   ├── main.jsx              # Entry point
│   ├── App.jsx               # Main component
│   ├── index.css             # Global styles
│   ├── components/           # Reusable UI components
│   │   ├── Navbar.jsx        # Navigation component
│   │   ├── Sidebar.jsx       # Admin sidebar
│   │   └── ...
│   ├── pages/                # Page components
│   │   ├── Login.jsx         # Authentication
│   │   ├── Admin/            # Admin-specific pages
│   │   │   ├── Dashboard.jsx # Admin dashboard
│   │   │   └── ...
│   │   └── Doctor/           # Doctor-specific pages
│   │       ├── DoctorDashboard.jsx
│   │       └── ...
│   ├── context/              # React Context API
│   └── assets/               # Static files
├── public/                   # Public assets
├── package.json              # Dependencies
└── .env                      # Environment variables

Data Flow

  1. Authentication Flow:

    • User credentials → Backend validation → JWT generation → Client storage
    • Protected routes check JWT validity before allowing access
  2. Appointment Booking Flow:

    • User selects doctor → Chooses available time slot → Confirms booking → Makes payment → Receives confirmation
  3. Review System Flow:

    • User completes appointment → Can leave review → Review updates doctor's average rating

Installation ⚙️

Prerequisites

  • Node.js v16+
  • MongoDB Atlas cluster
  • Cloudinary account
  • Gmail account (for email notifications)
  • Stripe account (for payment processing)

Setup Guide

  1. Clone Repository
git clone https://github.com/Mitan11/Prescripto.git
cd Prescripto
  1. Backend Setup
cd backend
npm install
cp .env.example .env
# Configure .env with your credentials
npm start
  1. Frontend Setup
cd ../frontend
npm install
cp .env.example .env
npm run dev
  1. Admin Setup
cd ../admin
npm install
cp .env.example .env
npm run dev

Configuration ⚙️

Environment Variables

# Backend .env
MONGODB_URI = 'mongodb+srv://<user>:<password>@cluster.mongodb.net/dbname'

# Cloudinary config
CLOUDINARY_NAME = 'your_cloud_name'
CLOUDINARY_API_KEY = 'your_api_key'
CLOUDINARY_SECRET_KEY = 'your_api_secret'

# Admin credentials
ADMIN_EMAIL = '[email protected]'
ADMIN_PASSWORD = 'admin123'

# JWT configuration
JWT_SECRET = "your_jwt_secret_key"

# Payment settings
CURRENCY = "INR"
STRIPE_SECRET_KEY = 'your_stripe_secret_key'

# Email configuration
EMAIL = "[email protected]"
PASSWORD = "your_app_password"
TOEMAIL = "[email protected]"
# Frontend .env
REACT_APP_API_URL='http://localhost:5000'
REACT_APP_STRIPE_PUBLIC_KEY='your_stripe_public_key'
# Admin .env
REACT_APP_API_URL='http://localhost:5000'

🔌 API Documentation

User Endpoints

Endpoint Method Description Auth Required
/api/user/register POST User registration
/api/user/login POST User authentication
/api/user/getProfile GET Get user profile
/api/user/updateProfile POST Update user profile with image
/api/user/bookAppointment POST Book new appointment
/api/user/appointments GET List user appointments
/api/user/cancelAppointment POST Cancel appointment
/api/user/makePayment POST Process appointment payment
/api/user/contactUs POST Send contact/inquiry message
/api/user/addReview POST Add review for a doctor
/api/user/reviewedAppointments GET Get user's reviewed appointments
/api/user/reviews GET Get all reviews for testimonials
/api/user/sendResetPasswordEmail POST Send password reset email
/api/user/verifyOTP POST Verify OTP for password reset
/api/user/resetPassword POST Reset password with OTP
/api/user/changePassword POST Change password (logged in)

Doctor Endpoints

Endpoint Method Description Auth Required
/api/doctor/login POST Doctor authentication
/api/doctor/list GET Get all doctors list
/api/doctor/appointments GET Get doctor's appointments
/api/doctor/appointment-completed POST Mark appointment as completed
/api/doctor/appointment-cancelled POST Mark appointment as cancelled
/api/doctor/dashboard GET Get doctor's dashboard data
/api/doctor/profile GET Get doctor's profile
/api/doctor/update-profile POST Update doctor's profile
/api/doctor/change-password POST Change doctor's password
/api/doctor/reviews GET Get doctor's reviews
/api/doctor/delete-review POST Delete a review

Admin Endpoints

Endpoint Method Description Auth Required
/api/admin/login POST Admin authentication
/api/admin/add-doctor POST Add new doctor with image
/api/admin/all-doctors POST Get all doctors data
/api/admin/change-availability POST Update doctor availability
/api/admin/all-appointments GET Get all system appointments
/api/admin/cancel-appointment POST Cancel any appointment
/api/admin/dashboard GET Get admin dashboard data
/api/admin/remove-doctor POST Remove a doctor

Tech Stack 🛠️

Frontend
React Tailwind CSS Framer Motion

Backend
Node.js Express JWT

Database
MongoDB Mongoose

Services
Cloudinary Nodemailer Stripe

Browser Compatibility 🌐

The application has been tested and optimized for the following browsers:

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+
  • Opera 76+

Mobile browsers are also supported with a responsive design optimized for different screen sizes.

Deployment Links 🌐

Access the live application using the following links:

Documentation 📚

Documentation Presentation

Contact 📧

Email
Instagram LinkedIn

About

User Side

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages