Patient Management — Profiles, timelines, blood groups, allergies
Doctor Directory — Specializations, license tracking, affiliations
Prescriptions — Create, dispense, and track Rx with one click
Billing & Invoicing — POS-style sales, PDF invoices, email receipts
Stock Batches — Track expiry dates, batch numbers, quantities
Low-Stock Alerts — Automated reorder level notifications
Expiry Warnings — Proactive alerts before medicines expire
Supplier Management — Full supplier database with contact info
Live Dashboard — Revenue charts, top medicines, KPI cards
Sales Analysis — Date-range reports with visual charts
Inventory Reports — Stock health, expiry analysis
Audit Logs — Complete user activity trail for compliance
JWT Authentication — Stateless, token-based auth
TOTP Two-Factor Auth — Google Authenticator + backup codes
Role-Based Access — Admin / Pharmacist / Doctor / Staff
Email Verification — OTP-verified account & email changes
Session Management — View & revoke active sessions per device
Dark Mode
Light Mode
Palette
Teal on charcoal
Clinical blue on white
Best for
Night shifts
Bright pharmacies
Key UX features
⌨️ Command Palette (Ctrl+K) — jump anywhere instantly
🌙 Dark / Light theme toggle — persistent per user
🔍 Global search — patients, medicines, doctors in one box
📄 Sortable, paginated tables — column sorting + per-page control on every table
🔔 Real-time toast notifications
🖼️ Cloudinary avatars — profile pictures stored in the cloud
pharmadesk/
├── client/ # React + Vite frontend
│ └── src/
│ ├── components/ # Reusable UI (Toast, Modal, Charts, Skeleton…)
│ ├── context/ # Auth, Theme, Sidebar, Shortcuts
│ ├── pages/ # Full-page route components
│ ├── services/ # Axios API layer
│ └── utils/ # generateInvoice, useSortPaginate…
└── server/ # Node.js + Express backend
├── db/ # MySQL schema & migration scripts
├── middleware/ # auth, auditLog, permissions
├── routes/ # REST API route handlers
└── services/ # email, expiryAlerts
Requirement
Version
Node.js
≥ 18
MySQL
≥ 8.0
npm
≥ 9
git clone https://github.com/your-username/pharmadesk.git
cd pharmadesk
# Backend
cd server && npm install
# Frontend
cd ../client && npm install
2 · Configure Environment
cp server/.env.example server/.env
# Then edit server/.env with your values
# Database
DB_HOST = localhost
DB_USER = root
DB_PASSWORD = your_password
DB_NAME = pharmadesk
# Auth
JWT_SECRET = your_super_long_random_secret
# Email (for OTP verification & receipts)
SMTP_HOST = smtp.gmail.com
SMTP_PORT = 587
SMTP_USER = [email protected]
SMTP_PASS = your_app_password
# Cloudinary (for profile pictures)
CLOUDINARY_CLOUD_NAME = your_cloud_name
CLOUDINARY_API_KEY = your_api_key
CLOUDINARY_API_SECRET = your_api_secret
# Create the database first
mysql -u root -p -e " CREATE DATABASE pharmadesk;"
# Run schema
mysql -u root -p pharmadesk < server/db/schema.sql
# Seed initial admin account
cd server && node create-admin.js
# Terminal 1 — Backend (port 5000)
cd server && npm run dev
# Terminal 2 — Frontend (port 5173)
cd client && npm run dev
Open http://localhost:5173 — admin credentials are printed by create-admin.js.
Feature
Admin
Pharmacist
Doctor
Staff
User Management
✅
❌
❌
❌
Billing & Sales
✅
✅
❌
✅
Prescriptions
✅
✅
✅
✅
Inventory
✅
✅
❌
✅
Audit Logs
✅
❌
❌
❌
Reports
✅
✅
❌
❌
Feature
Implementation
Passwords
bcrypt (cost 10)
Sessions
JWT + DB session table
2FA
TOTP (otplib) + 8 backup codes
Email OTPs
6-digit, 10-min expiry, single-use
Email change
Password + OTP double verification
Audit trail
Every CRUD action logged with user/IP/timestamp
Frontend
Backend
Method
Endpoint
Description
POST
/api/auth/login
Login + 2FA check
POST
/api/auth/register
Register with email verification
POST
/api/auth/forgot-password
Send password reset OTP
PUT
/api/auth/change-password
Change password (authenticated)
POST
/api/auth/request-email-change
Send OTP to new email
POST
/api/2fa/setup
Generate QR code for TOTP
POST
/api/2fa/disable
Disable 2FA (requires password)
POST
/api/upload/avatar
Upload profile picture to Cloudinary
GET
/api/patients
List patients (search, pagination)
GET
/api/inventory/overview
Stock overview + alerts
POST
/api/billing
Create sale / invoice
GET
/api/reports/dashboard
Dashboard KPIs
Fork the repository
Create a feature branch: git checkout -b feature/amazing-feature
Commit your changes: git commit -m 'Add amazing feature'
Push to the branch: git push origin feature/amazing-feature
Open a Pull Request