Back to Portfolio

Digital RX

An offline-first clinic management app that lets doctors create NMC-compliant prescriptions and silently deliver them to patients via WhatsApp — eliminating paperwork entirely.

Full Stack Developer React · Node.js · Baileys Case Study
Digital RX app — prescription view with WhatsApp send

01. The Problem

Indian doctors in small and mid-level clinics still rely on handwritten prescriptions. This creates three painful problems: illegible handwriting leads to dispensing errors, no digital record means patient history is untracked, and missed follow-ups result in incomplete treatment compliance.

Existing EMR software is either too expensive, too complex, or requires constant internet — making them impractical for a busy solo practitioner.

02. The Solution

I designed and built Digital RX — a fully offline-first PWA using React + Vite that requires no database server. All patient data lives in the browser's localStorage, making it instantly available with zero setup.

The killer feature: a custom Node.js + Express backend that integrates Baileys (a lightweight WebSocket-based WhatsApp library) to silently send prescription PDFs directly to the patient's WhatsApp number — no manual copy-pasting, no third-party messaging service, no per-message fees.

Architectural Decision: I chose localStorage over a cloud database deliberately. Most clinics run on a single device (a doctor's laptop or desktop). Removing the database dependency means zero monthly hosting costs, instant startup, and full offline functionality — the app works even when the internet is down.

03. Tech Stack

  • React + Vite: Fast HMR during development; production build is a single optimized bundle served as a static site.
  • Node.js + Express: Lightweight REST API server handling WhatsApp messaging and medicine database queries.
  • Baileys (WhatsApp WebSocket): Connects directly to WhatsApp without Puppeteer or Chrome — runs on low-memory servers and local machines alike.
  • Electron: Packages the entire app (frontend + backend) as a standalone Windows .exe installer — no internet, no browser, no setup required for the doctor.
  • jsPDF / html2canvas: Generates NMC-compliant prescription PDFs client-side before WhatsApp delivery.

04. Key Features

  • Live Medicine Search: A 200+ offline Indian medicine database enables instant autocomplete — name, strength, and instructions auto-fill on selection.
  • NMC-Compliant PDF Prescriptions: Generated entirely in the browser via html2canvas + jsPDF, pre-formatted with doctor letterhead, registration number, and patient details.
  • Silent WhatsApp Delivery: After scanning a one-time QR code, the app sends PDF prescriptions to any Indian mobile number — no manual messaging needed.
  • Follow-up Reminders: Tracks scheduled follow-up dates per patient and surfaces overdue cases on the dashboard.
  • Desktop App (Electron): Distributed as a single Windows installer — the doctor installs it once and it just works, with no cloud dependency.

05. Challenges & Learnings

Challenge: WhatsApp Session Persistence
The Baileys WhatsApp session token would expire silently, requiring the doctor to re-scan the QR code — often mid-consultation, causing frustration.

Solution: I implemented a real-time QR freshness timer (a green banner counting down seconds) and a Force Restart button that wipes the stale session and generates a fresh QR instantly. Session credentials are now persisted to disk, so most reconnections happen automatically.

Challenge: Electron + Baileys Packaging
Baileys uses native Node.js modules (like bufferutil) that webpack/Vite refused to bundle for Electron — causing blank screens in the packaged .exe.

Solution: I split the architecture: Electron runs the Express/Baileys backend as a child_process on a dynamic port, and the Electron renderer loads the Vite frontend separately. This clean separation resolved all native module conflicts.

Challenge: Mobile-Responsive UI for a Clinic Setting
The app was designed desktop-first, but doctors in some clinics use tablets during rounds.

Solution: Refactored layouts to CSS Grid + card-based views, added a hamburger navigation for smaller screens, and ensured all prescription actions (send, download) were easily thumb-reachable on a 10" tablet.

06. Impact

Digital RX reduces the average prescription workflow from ~8 minutes (handwritten + photo + WhatsApp manual send) to under 90 seconds — a medicine is selected and a PDF lands in the patient's WhatsApp before they leave the clinic room.

This project deepened my expertise in full-stack offline architecture, WebSocket-based third-party integrations, and Electron desktop app packaging — a rare combination that spans both web and systems-level engineering.

Live Demo: The web version is deployed at digital-rx-ten.vercel.app — use a PIN of 1234 to log in and explore the interface.
View on GitHub Live Demo View Other Projects