Skip to content

HealthX is a comprehensive doctor appointment management system built with the MERN stack. It provides a seamless experience for patients to book appointments with doctors, while offering powerful administrative tools for healthcare providers to manage their practice efficiently.

Notifications You must be signed in to change notification settings

Akcthecoder200/HealthX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ HealthX - Doctor Appointment Management System

HealthX Logo

πŸ“‹ Table of Contents

🩺 About

HealthX is a comprehensive doctor appointment management system built with the MERN stack. It provides a seamless experience for patients to book appointments with doctors, while offering powerful administrative tools for healthcare providers to manage their practice efficiently.

Key Highlights:

  • Patient Portal: Easy appointment booking and management
  • Doctor Management: Complete doctor profile management
  • Admin Dashboard: Comprehensive administrative controls
  • Real-time Updates: Instant appointment status updates
  • Responsive Design: Optimized for all devices
  • Secure Authentication: JWT-based secure login system

✨ Features

πŸ‘¨β€βš•οΈ For Patients

  • βœ… User registration and secure login
  • βœ… Browse doctors by specialty
  • βœ… View detailed doctor profiles
  • βœ… Book appointments with preferred doctors
  • βœ… Manage personal profile
  • βœ… View appointment history
  • βœ… Cancel appointments
  • βœ… Real-time appointment status updates

πŸ₯ For Administrators

  • βœ… Secure admin authentication
  • βœ… Add new doctors to the system
  • βœ… Manage doctor profiles and availability
  • βœ… View all appointments
  • βœ… Cancel appointments
  • βœ… Dashboard with analytics
  • βœ… Patient management
  • βœ… System-wide settings

πŸ‘©β€βš•οΈ For Doctors

  • βœ… Doctor profile management
  • βœ… Availability status control
  • βœ… Appointment scheduling
  • βœ… Patient information access

πŸ›  Technology Stack

Frontend

  • React.js 18.3.1 - Modern UI library
  • Vite 5.4.1 - Fast build tool and development server
  • React Router 6.26.2 - Client-side routing
  • Tailwind CSS 3.4.11 - Utility-first CSS framework
  • Axios 1.7.7 - HTTP client for API calls
  • React Toastify 10.0.5 - Elegant notifications

Backend

  • Node.js - JavaScript runtime environment
  • Express.js 4.21.0 - Web application framework
  • MongoDB 8.7.0 - NoSQL database with Mongoose ODM
  • JWT 9.0.2 - JSON Web Tokens for authentication
  • Bcrypt 5.1.1 - Password hashing
  • Cloudinary 2.5.0 - Image upload and management
  • Multer 1.4.5 - File upload middleware
  • CORS 2.8.5 - Cross-origin resource sharing

Development Tools

  • ESLint - Code linting and formatting
  • PostCSS - CSS post-processing
  • Autoprefixer - CSS vendor prefixing
  • Nodemon - Development server auto-restart

πŸ“ Project Structure

HealthX/
β”œβ”€β”€ backend/                 # Backend API server
β”‚   β”œβ”€β”€ config/             # Database and service configurations
β”‚   β”‚   β”œβ”€β”€ cloudinary.js   # Cloudinary setup
β”‚   β”‚   └── mongodb.js      # MongoDB connection
β”‚   β”œβ”€β”€ controllers/        # Business logic controllers
β”‚   β”‚   β”œβ”€β”€ adminController.js
β”‚   β”‚   β”œβ”€β”€ doctorController.js
β”‚   β”‚   └── userController.js
β”‚   β”œβ”€β”€ middlewares/        # Custom middleware functions
β”‚   β”‚   β”œβ”€β”€ authAdmin.js    # Admin authentication
β”‚   β”‚   β”œβ”€β”€ authUser.js     # User authentication
β”‚   β”‚   └── multer.js       # File upload configuration
β”‚   β”œβ”€β”€ models/            # Database models/schemas
β”‚   β”‚   β”œβ”€β”€ appointmentModel.js
β”‚   β”‚   β”œβ”€β”€ doctorModel.js
β”‚   β”‚   └── userModel.js
β”‚   β”œβ”€β”€ routes/            # API route definitions
β”‚   β”‚   β”œβ”€β”€ adminRoute.js
β”‚   β”‚   β”œβ”€β”€ doctorRoute.js
β”‚   β”‚   └── userRoute.js
β”‚   β”œβ”€β”€ .env               # Environment variables
β”‚   β”œβ”€β”€ package.json       # Backend dependencies
β”‚   └── server.js          # Main server file
β”‚
β”œβ”€β”€ frontend/              # Patient-facing React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/        # Static assets and sample data
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable React components
β”‚   β”‚   β”‚   β”œβ”€β”€ Banner.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RelatedDoctor.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SpecialityMenu.jsx
β”‚   β”‚   β”‚   └── TopDoctors.jsx
β”‚   β”‚   β”œβ”€β”€ context/       # React Context for state management
β”‚   β”‚   β”‚   └── AppContext.jsx
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ About.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Appointment.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Contact.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Doctors.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MyAppointments.jsx
β”‚   β”‚   β”‚   └── MyProfile.jsx
β”‚   β”‚   β”œβ”€β”€ App.jsx        # Main App component
β”‚   β”‚   └── main.jsx       # Application entry point
β”‚   β”œβ”€β”€ .env               # Frontend environment variables
β”‚   β”œβ”€β”€ index.html         # HTML template
β”‚   β”œβ”€β”€ package.json       # Frontend dependencies
β”‚   └── tailwind.config.js # Tailwind CSS configuration
β”‚
└── admin/                 # Admin panel React application
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ assets/        # Admin-specific assets
    β”‚   β”œβ”€β”€ components/    # Admin UI components
    β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
    β”‚   β”‚   └── Sidebar.jsx
    β”‚   β”œβ”€β”€ context/       # Admin context providers
    β”‚   β”‚   β”œβ”€β”€ AdminContext.jsx
    β”‚   β”‚   β”œβ”€β”€ AppContext.jsx
    β”‚   β”‚   └── DoctorContext.jsx
    β”‚   β”œβ”€β”€ pages/         # Admin page components
    β”‚   β”‚   β”œβ”€β”€ Login.jsx
    β”‚   β”‚   └── Admin/
    β”‚   β”‚       β”œβ”€β”€ AddDoctor.jsx
    β”‚   β”‚       β”œβ”€β”€ AllAppointments.jsx
    β”‚   β”‚       β”œβ”€β”€ Dashboard.jsx
    β”‚   β”‚       └── DoctorsList.jsx
    β”‚   β”œβ”€β”€ App.jsx        # Admin App component
    β”‚   └── main.jsx       # Admin entry point
    β”œβ”€β”€ .env               # Admin environment variables
    β”œβ”€β”€ package.json       # Admin dependencies
    └── tailwind.config.js # Admin Tailwind configuration

οΏ½ Prerequisites

Before running this project, make sure you have the following installed:

  • Node.js (v16.0.0 or higher)
  • npm (v8.0.0 or higher)
  • MongoDB (local installation or MongoDB Atlas account)
  • Git (for cloning the repository)

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/Akcthecoder200/HealthX.git
cd HealthX

2. Backend Setup

# Navigate to backend directory
cd backend

# Install dependencies
npm install

# Create environment file
cp .env.example .env
# Edit .env with your configuration (see Configuration section)

# Start the backend server
npm run start
# or for development with auto-restart
npm run server

3. Frontend Setup

# Navigate to frontend directory
cd ../frontend

# Install dependencies
npm install

# Create environment file
echo "VITE_BACKEND_URL=http://localhost:4000" > .env

# Start the frontend development server
npm run dev

4. Admin Panel Setup

# Navigate to admin directory
cd ../admin

# Install dependencies
npm install

# Create environment file
echo "VITE_BACKEND_URL=http://localhost:4000" > .env

# Start the admin development server
npm run dev

βš™οΈ Configuration

Backend Environment Variables (.env)

# MongoDB Connection
MONGODB_URI=mongodb+srv://username:[email protected]

# Cloudinary Configuration (for image uploads)
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_SECRET_KEY=your_secret_key

# JWT Secret (use a strong random string)
JWT_SECRET=your_jwt_secret_key

# Admin Credentials
ADMIN_EMAIL=[email protected]
ADMIN_PASSWORD=your_admin_password

# Server Port
PORT=4000

Frontend Environment Variables (.env)

# Backend API URL
VITE_BACKEND_URL=http://localhost:4000

Admin Environment Variables (.env)

# Backend API URL
VITE_BACKEND_URL=http://localhost:4000

🎯 Usage

Accessing the Applications

Default Admin Credentials

Sample Doctor Specialties

The system includes sample doctors in the following specialties:

  • General Physician
  • Gynecologist
  • Dermatologist
  • Pediatricians
  • Neurologist
  • Gastroenterologist

πŸ“‘ API Documentation

Authentication Endpoints

User Registration

POST /api/user/register
Content-Type: application/json

{
  "name": "John Doe",
  "email": "[email protected]",
  "password": "password123"
}

User Login

POST /api/user/login
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "password123"
}

Admin Login

POST /api/admin/login
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "admin_password"
}

Doctor Endpoints

Get All Doctors

GET /api/doctor/list

Add Doctor (Admin Only)

POST /api/admin/add-doctor
Authorization: Bearer admin_token
Content-Type: multipart/form-data

{
  "name": "Dr. John Smith",
  "email": "[email protected]",
  "password": "doctorpass",
  "speciality": "General physician",
  "degree": "MBBS",
  "experience": "5 Years",
  "about": "Experienced doctor...",
  "fees": 100,
  "address": {
    "line1": "123 Main St",
    "line2": "City, State"
  },
  "image": "doctor_image.jpg"
}

Appointment Endpoints

Book Appointment

POST /api/user/book-appointment
Authorization: Bearer user_token
Content-Type: application/json

{
  "docId": "doctor_id",
  "slotDate": "2024-01-15",
  "slotTime": "10:00 AM"
}

Get User Appointments

GET /api/user/appointments
Authorization: Bearer user_token

Cancel Appointment

POST /api/user/cancel-appointment
Authorization: Bearer user_token
Content-Type: application/json

{
  "appointmentId": "appointment_id"
}

πŸ” Security Features

  • JWT Authentication: Secure token-based authentication
  • Password Hashing: Bcrypt encryption for password security
  • Input Validation: Server-side validation for all inputs
  • CORS Protection: Configured cross-origin resource sharing
  • File Upload Security: Secure image upload with Cloudinary
  • Admin Authorization: Protected admin routes and functions

🎨 UI/UX Features

  • Responsive Design: Mobile-first responsive design
  • Modern UI: Clean and intuitive user interface
  • Loading States: Proper loading indicators
  • Error Handling: User-friendly error messages
  • Toast Notifications: Real-time feedback system
  • Form Validation: Client-side and server-side validation
  • Image Optimization: Optimized image loading and caching

🚦 Development Scripts

Backend Scripts

npm start          # Start production server
npm run server     # Start development server with nodemon

Frontend Scripts

npm run dev        # Start development server
npm run build      # Build for production
npm run preview    # Preview production build
npm run lint       # Run ESLint

Admin Scripts

npm run dev        # Start development server
npm run build      # Build for production
npm run preview    # Preview production build
npm run lint       # Run ESLint

πŸ›‘οΈ Database Schema

User Model

{
  name: String (required),
  email: String (required, unique),
  password: String (required),
  image: String (default: placeholder),
  address: Object,
  gender: String,
  dob: String,
  phone: String
}

Doctor Model

{
  name: String (required),
  email: String (required, unique),
  password: String (required),
  image: String (required),
  speciality: String (required),
  degree: String (required),
  experience: String (required),
  about: String (required),
  available: Boolean (default: true),
  fees: Number (required),
  address: Object (required),
  date: Number (required),
  slots_booked: Object (default: {})
}

Appointment Model

{
  userId: ObjectId (required),
  docId: ObjectId (required),
  slotDate: String (required),
  slotTime: String (required),
  userData: Object (required),
  docData: Object (required),
  amount: Number (required),
  date: Number (required),
  cancelled: Boolean (default: false),
  payment: Boolean (default: false),
  isCompleted: Boolean (default: false)
}

🌍 How it looks

πŸ“Έ - Demo Images

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘₯ Authors

  • Akcthecoder200 - Initial work - GitHub

πŸ™ Acknowledgments

  • React.js community for excellent documentation
  • MongoDB team for the robust database solution
  • Tailwind CSS for the utility-first CSS framework
  • Cloudinary for image management services
  • All contributors who helped in making this project better

πŸ“ž Support

If you have any questions or need help with setup, please:

  1. Check the Issues page
  2. Create a new issue if your problem isn't already listed
  3. Contact the maintainer through GitHub

Made with ❀️ for better healthcare management

About

HealthX is a comprehensive doctor appointment management system built with the MERN stack. It provides a seamless experience for patients to book appointments with doctors, while offering powerful administrative tools for healthcare providers to manage their practice efficiently.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages