An enterprise-grade, multi-tenant SaaS healthcare platform connecting patients, medical practitioners, diagnostics laboratories, and local pharmacies. Built on the MERN stack with selective microservice separation, the system features AI-powered prescription parsing (OCR), virtual telemedicine consultations, voice-activated booking channels, and automated patient reminder networks.
The system consists of three web portals (Patient, Doctor, Admin) communicating with a monolithic Node.js/Express API, integrated with a Python drug-import migration pipeline and multiple external communication/AI services.
graph TD
%% Portals
subgraph Client Portals [Client Web Applications]
A[Patient React Portal]
B[Doctor React Portal]
C[Admin Management Portal]
end
%% Routing / Load Balancer
D[Nginx Gateway / Reverse Proxy]
%% Backend Services
subgraph API Services [Core Application Tier]
E[Express.js Web Server]
F[Python Drug-Import Script]
end
%% Databases
subgraph Databases [Persistent Storage]
G[(MongoDB Primary DB)]
H[(Redis Queue & Cache)]
end
%% External Services
subgraph Integration Tier [External Services Integrations]
I[Cloudinary CDN]
J[Twilio SMS Gateway]
K[Gemini & Groq AI Engines]
L[Vapi.ai Telephony Webhook]
M[Jitsi WebRTC SDK]
end
%% Connections
A & B & C -->|HTTP / HTTPS| D
D -->|Route Proxy| E
F -->|Bulk Seed| G
E -->|Mongoose ODM| G
E -->|Caching / BullMQ| H
%% Integrations links
E -->|Upload Prescriptions| I
E -->|Outbound Reminders| J
E -->|OCR & Translation| K
E -->|Voice Assistant Booking| L
A & B -->|WebRTC Sessions| M
style Client Portals fill:#f5f7ff,stroke:#5c76ff,stroke-width:2px;
style API Services fill:#fffbf5,stroke:#ff9d00,stroke-width:2px;
style Databases fill:#fff0f0,stroke:#da1e28,stroke-width:2px;
- Multi-Role Authentication: Dedicated JWT namespaces and authentication tokens (
utoken,dtoken,atoken) securing patient, doctor, and administrator views. - AI Prescription OCR: Automated OCR prescription reading using Google Gemini and Groq (with automatic fallback routing). Extracts compositions, dosages, and maps them to active pharmacy inventory.
- Telehealth / Telemedicine: Embedded WebRTC audio-video consultations powered by
@jitsi/react-sdkdirectly inside doctor and patient portals. - Voice Booking Gateway: Integration with
Vapi.aiwebhook nodes to allow patients to book appointments over phone calls via an interactive AI agent. - e-Pharmacy & Diagnostics: Fully functioning pharmacy shopping cart, checkout pipeline, and laboratory/radiology slot reservation management.
- Automated Reminders: Secured
/api/cron/remindersendpoint triggered by external cron triggers, sending SMS (Twilio) and email alerts to reduce clinic no-show rates.
├── admin/ # React 19 + Vite Admin & Doctor Dashboard
├── backend/ # Node.js + Express API Backend service
│ ├── api/ # Serverless routing wrappers
│ ├── config/ # Mongoose database & Cloudinary configurations
│ ├── controllers/ # Controller logic (Auth, Bookings, AI, Pharmacy)
│ ├── middleware/ # Role verification & file upload middlewares
│ ├── models/ # Mongoose Schemas (User, Doctor, Appointment, Medicine)
│ ├── routes/ # Express API routes
│ └── services/ # Reusable business logic services (e.g., appointment booking)
├── frontend/ # React 19 + Vite Patient Portal
├── drug-data-service/ # Python pipeline for bulk importing drug datasets
│ └── bulk_import.py # Pandas-based MongoDB bulk upsert migration script
├── docker-compose.yml # Container configuration for local orchestration
├── nginx.conf # Gateway proxy routing configuration
└── package.json # Monorepo workspaces definition
You can spin up the entire application stack using Docker Compose, or run the components manually in a development environment.
Make sure you have Docker and Docker Compose installed on your machine.
- Clone the repository:
git clone https://github.com/your-username/appointment-management-system.git cd appointment-management-system - Configure Environment Variables:
Create a
.envfile inside thebackend/directory and populate it with your API keys (see Environment Configuration). - Spin up the stack:
docker-compose up -d --build
- Access the Portals:
- Patient Portal:
http://localhost:3000 - Admin & Doctor Dashboard:
http://localhost:3001 - API Backend:
http://localhost:4000
- Patient Portal:
- Install dependencies across the monorepo:
From the root directory, run:
npm run install-all
- Import Medicine Dataset (Optional):
Navigate to the
drug-data-servicefolder, configure a Python virtual environment, and run the ingestion script:cd drug-data-service python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate pip install pandas pymongo tqdm python-dotenv python bulk_import.py
- Start the Backend server:
cd ../backend npm run server - Start the Patient Frontend portal:
cd ../frontend npm run dev - Start the Admin/Doctor Dashboard portal:
cd ../admin npm run dev
Create a .env file inside the backend/ directory with the following variables:
# Server Config
PORT=4000
MONGODB_URI=mongodb://localhost:27017/Appointment_Management_System
# Security
JWT_SECRET=your_jwt_signing_secret_key
ADMIN_EMAIL=admin@smarthealth.com
ADMIN_PASSWORD=your_secure_admin_password
CRON_SECRET=your_reminder_cron_secret_token
# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
# AI API Keys
GEMINI_API_KEY=your_gemini_api_key
GROQ_API_KEY=your_groq_api_key
# Twilio (SMS Reminders)
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_numberThe test suite includes unit, integration, and end-to-end API tests.
# Run backend tests
cd backend
npm run testSee our Testing Strategy Document for full details on our QA methodologies, manual test plans, and synthetic performance testing targets.
This project is licensed under the MIT License. See LICENSE for details.