A modern, full-stack hospital management system with AI-powered features built using the MERN stack (MongoDB, Express.js, React, Node.js).
ClinicEase is a comprehensive healthcare management platform that streamlines hospital operations with role-based access control for patients, doctors, and administrators. The system features AI-powered chatbot assistance, automated patient summaries, and seamless appointment management.
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
- Google Gemini API Key (for AI features)
- AWS S3 (optional, for cloud file storage)
git clone <repository-url>
cd ClinicEasecd backend
npm install
# Create .env file from example
cp .env.example .env
# Edit .env and add your configuration
# Add GEMINI_API_KEY for AI features
# Add AWS credentials for S3 (optional)
# Seed database with demo data
npm run seed
# Start backend server
npm run devBackend will run on http://localhost:3000
cd frontend
npm install
# Create .env file from example
cp .env.example .env
# Start frontend development server
npm run devFrontend will run on http://localhost:5173
Ensure MongoDB is running on your system:
mongodOr use MongoDB Atlas for cloud database.
| Role | Password | |
|---|---|---|
| Patient | john@example.com | patient123 |
| Doctor | dr.smith@clinicease.com | doctor123 |
| Admin | admin@clinicease.com | admin123 |
- β User Registration & Authentication - Secure signup and login
- β Appointment Booking - Schedule appointments with available doctors
- β Appointment Management - View, track, and cancel appointments
- β Medical Report Upload - Upload and store medical documents
- β Medical History - Access complete medical history and reports
- β AI Chatbot - Get instant health guidance and symptom analysis
- β Dashboard - View statistics and upcoming appointments
- β Profile Management - Update personal information
- β Doctor Registration - Register with admin approval workflow
- β Appointment Management - View and manage patient appointments
- β Status Updates - Approve, reject, or complete appointments
- β Patient History Access - View complete patient medical records
- β Report Generation - Create and upload medical reports
- β File Attachments - Attach documents to patient reports
- β AI Patient Summaries - Generate AI-powered patient summaries
- β Dashboard - View appointment statistics and pending cases
- β Prescription Guidance - AI-assisted treatment recommendations
- β Doctor Approval System - Approve or reject doctor registrations
- β User Management - Manage all users (patients, doctors)
- β Appointment Oversight - View all appointments across departments
- β System Analytics - Comprehensive statistics and insights
- β Search Functionality - Search users and appointments
- β User Deletion - Remove users from the system
- β Status Management - Update doctor approval status
- β Dashboard - System-wide overview and metrics
- β Medical Chatbot - Powered by Google Gemini 2.0 Flash
- β Symptom Analysis - AI-driven symptom evaluation
- β Patient Summaries - Automated patient history summaries
- β Prescription Guidance - Treatment recommendations for doctors
- β Conversation History - Persistent chat history with context
- β Fallback Responses - Rule-based responses when AI is unavailable
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- Password Security: bcryptjs
- File Upload: Multer
- Cloud Storage: AWS S3 SDK
- AI Integration: Google Generative AI (Gemini)
- CORS: Enabled for cross-origin requests
- Environment: dotenv for configuration
- Framework: React 19
- Routing: React Router DOM v7
- Styling: Tailwind CSS with custom Neobrutalism theme
- HTTP Client: Axios
- Form Handling: React Hook Form
- Validation: Zod
- Charts: Recharts
- Icons: Lucide React
- Notifications: Sonner (toast notifications)
- Build Tool: Vite
ClinicEase/
βββ backend/
β βββ src/
β β βββ controllers/ # Business logic & request handlers
β β β βββ appointmentController.js
β β β βββ authController.js
β β β βββ chatbotController.js
β β β βββ reportController.js
β β β βββ userController.js
β β βββ models/ # MongoDB schemas
β β β βββ User.js
β β β βββ Appointment.js
β β β βββ Report.js
β β β βββ ChatHistory.js
β β βββ routes/ # API route definitions
β β β βββ authRoutes.js
β β β βββ appointmentRoutes.js
β β β βββ reportRoutes.js
β β β βββ userRoutes.js
β β β βββ chatbotRoutes.js
β β βββ middleware/ # Custom middleware
β β β βββ auth.js # JWT authentication
β β β βββ upload.js # File upload handling
β β βββ services/ # External services
β β β βββ geminiService.js # AI integration
β β β βββ s3Service.js # AWS S3 integration
β β βββ App.js # Express app setup
β β βββ seed.js # Database seeding
β βββ uploads/ # Local file storage
β βββ .env # Environment variables
β βββ .env.example # Environment template
β βββ package.json
β βββ setup-s3-bucket.js # S3 bucket setup script
β
βββ frontend/
βββ src/
β βββ components/ # Reusable UI components
β β βββ ProtectedRoute.jsx
β β βββ ChatBotWindow.jsx
β β βββ ReportCard.jsx
β β βββ ...
β βββ contexts/ # React Context providers
β β βββ AuthContext.jsx
β βββ hooks/ # Custom React hooks
β β βββ useTheme.js
β βββ pages/ # Page components
β β βββ auth/ # Login, Register
β β βββ patient/ # Patient pages
β β βββ Doctor/ # Doctor pages
β β βββ admin/ # Admin pages
β β βββ shared/ # Shared pages
β βββ services/ # API service layer
β β βββ api.js
β β βββ authService.js
β β βββ appointmentService.js
β β βββ reportService.js
β β βββ chatbotService.js
β β βββ usersService.js
β βββ config/ # Configuration files
β β βββ api.js
β βββ App.jsx # Main app component
β βββ main.jsx # Entry point
β βββ index.css # Global styles
βββ public/ # Static assets
βββ .env # Environment variables
βββ .env.example # Environment template
βββ index.html
βββ package.json
βββ tailwind.config.js # Tailwind configuration
βββ vite.config.js # Vite configuration
| Method | Endpoint | Description | Auth Required | Role |
|---|---|---|---|---|
| POST | /api/auth/register |
Register new user | No | - |
| POST | /api/auth/login |
Login user | No | - |
| GET | /api/auth/me |
Get current user | Yes | All |
| PUT | /api/auth/profile |
Update user profile | Yes | All |
| Method | Endpoint | Description | Auth Required | Role |
|---|---|---|---|---|
| POST | /api/appointments |
Create appointment | Yes | Patient |
| GET | /api/appointments/my-appointments |
Get user appointments | Yes | All |
| GET | /api/appointments/all |
Get all appointments | Yes | Doctor, Admin |
| GET | /api/appointments/stats |
Get appointment stats | Yes | Admin |
| GET | /api/appointments/:id |
Get appointment by ID | Yes | All |
| PUT | /api/appointments/:id/status |
Update appointment status | Yes | Doctor, Admin |
| DELETE | /api/appointments/:id |
Delete appointment | Yes | Patient, Admin |
| Method | Endpoint | Description | Auth Required | Role |
|---|---|---|---|---|
| POST | /api/reports |
Create report (doctor) | Yes | Doctor |
| POST | /api/reports/upload |
Upload report (patient) | Yes | Patient |
| GET | /api/reports/my-reports |
Get user's reports | Yes | All |
| GET | /api/reports/patient/:patientEmail |
Get patient reports | Yes | All |
| GET | /api/reports/ai-summary/:patientEmail |
Generate AI patient summary | Yes | All |
| GET | /api/reports/:id |
Get report by ID | Yes | All |
| GET | /api/reports |
Get all reports | Yes | Admin |
| PUT | /api/reports/:id |
Update report | Yes | Doctor, Admin |
| DELETE | /api/reports/:id |
Delete report | Yes | Doctor, Admin |
| Method | Endpoint | Description | Auth Required | Role |
|---|---|---|---|---|
| GET | /api/users/doctors |
Get all doctors | Yes | All |
| GET | /api/users/patients |
Get all patients | Yes | Doctor, Admin |
| GET | /api/users/stats |
Get user statistics | Yes | Admin |
| GET | /api/users/search |
Search users | Yes | All |
| GET | /api/users/:id |
Get user by ID | Yes | All |
| PUT | /api/users/doctors/:id/status |
Update doctor status | Yes | Admin |
| DELETE | /api/users/:id |
Delete user | Yes | Admin |
| Method | Endpoint | Description | Auth Required | Role |
|---|---|---|---|---|
| POST | /api/chatbot/message |
Send chat message | Yes | All |
| GET | /api/chatbot/history |
Get chat history | Yes | All |
| DELETE | /api/chatbot/history |
Clear chat history | Yes | All |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/health |
Health check | No |
# Server Configuration
PORT=3000
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/clinicease
# JWT Secret (Change in production!)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# Frontend URL
FRONTEND_URL=http://localhost:5173
# Google Gemini AI
GEMINI_API_KEY=your-gemini-api-key
# AWS S3 (Optional)
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
AWS_REGION=us-east-1
AWS_S3_BUCKET_NAME=clinicease-uploadsVITE_API_URL=http://localhost:3000/apiThe project includes several test scripts to verify functionality:
cd backend
# Test all endpoints
node test-all-endpoints.js
# Test AI features
node test-ai-features.js
# Test report creation
node test-report-creation.js
# Test Gemini API directly
node test-gemini-direct.js
# Simple API test
node test-simple.js- JWT Authentication - Secure token-based authentication
- Password Hashing - bcryptjs with salt rounds
- Role-Based Access Control (RBAC) - Granular permissions
- Protected Routes - Frontend and backend route protection
- CORS Configuration - Controlled cross-origin access
- File Upload Validation - Secure file handling with Multer
- Environment Variables - Sensitive data protection
- Input Validation - Zod schema validation on frontend
- MongoDB Injection Prevention - Mongoose sanitization
The frontend uses a custom Neobrutalism design system with:
- Bold borders and shadows
- Vibrant color palette
- Rounded corners (1.25rem)
- Custom shadow effects
- Accessible color contrast
- Responsive design
nb-bg: #F2F7F9 // Background
nb-ink: #0F172A // Text/Borders
nb-accent: #A78BFA // Primary accent (Purple)
nb-accent-2: #34D399 // Secondary accent (Green)
nb-warn: #FBBF24 // Warning (Yellow)
nb-error: #F43F5E // Error (Red)
nb-ok: #22C55E // Success (Green)
nb-card: #FFFFFF // Card background# Ensure MongoDB is running
mongod
# Or check if MongoDB service is active
sudo systemctl status mongod# Backend: Change PORT in backend/.env
PORT=3001
# Frontend: Vite will auto-select next available port
# Or specify in package.json: "dev": "vite --port 5174"Verify FRONTEND_URL in backend/.env matches your frontend URL:
FRONTEND_URL=http://localhost:5173Ensure you have a valid Google Gemini API key:
GEMINI_API_KEY=your-actual-api-keyGet your API key from: https://makersuite.google.com/app/apikey
Check upload directory permissions:
cd backend
mkdir -p uploads
chmod 755 uploads- Set
NODE_ENV=productionin environment - Use a process manager like PM2
- Configure MongoDB Atlas for cloud database
- Set up AWS S3 for file storage
- Use environment variables for all secrets
- Build the production bundle:
npm run build-
Deploy the
distfolder to:- Vercel
- Netlify
- AWS S3 + CloudFront
- Any static hosting service
-
Update
VITE_API_URLto production backend URL
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License. See the LICENSE file for details.
16010123036 - Amandeep Singh
16010123037 - Ambuj Rai
16010123035 - Alapan Barman
- Google Gemini AI for chatbot capabilities
- MongoDB for database solutions
- React and Vite teams for excellent developer experience
- Tailwind CSS for styling framework
Status: β Production Ready - All features implemented and tested
Version: 1.0.0
For questions or support, please open an issue on GitHub.