Skip to content

Misrilal-Sah/PharmaDesk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Features

Β  Β  Β 



Β  Β  Β  Β  Β 



Β  Β  Β  Β  Β 



πŸ’‘ Streamline your pharmacy operations β€” from inventory and prescriptions to billing and analytics, all in one beautiful, secure dashboard.



✨ Feature Highlights

πŸ₯ Clinical Workflow

  • 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

πŸ“¦ Inventory Intelligence

  • 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

πŸ“Š Analytics & Reports

  • 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

πŸ” Security First

  • 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

πŸ–₯️ Interface

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

πŸ—‚οΈ Project Structure

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

πŸš€ Getting Started

Prerequisites

Requirement Version
Node.js β‰₯ 18
MySQL β‰₯ 8.0
npm β‰₯ 9

1 Β· Clone & Install

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=your@gmail.com
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

3 Β· Initialize Database

# 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

4 Β· Start the App

# 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.


πŸ”‘ Roles & Permissions

Feature Admin Pharmacist Doctor Staff
User Management βœ… ❌ ❌ ❌
Billing & Sales βœ… βœ… ❌ βœ…
Prescriptions βœ… βœ… βœ… βœ…
Inventory βœ… βœ… ❌ βœ…
Audit Logs βœ… ❌ ❌ ❌
Reports βœ… βœ… ❌ ❌

πŸ”’ Security Architecture

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

πŸ› οΈ Tech Stack

Frontend

Backend


πŸ“œ Key API Endpoints

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

🀝 Contributing

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


Β  Β 



Β  Β 



Β  Β  Β  Β 



Β  Β  Β 



About

A web-based Pharmacy Management System for managing patients, prescriptions, inventory, and billing in clinics and hospitals. Designed to streamline pharmacy workflows with secure data handling and real-time inventory control.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors