Private, Offline-First Outpatient Prescription & Electronic Medical Records (EMR) System
Built for independent physicians, outpatient clinics, and polyclinics.
Most modern electronic health systems lock doctors into expensive monthly cloud subscriptions, require continuous internet connectivity, and store sensitive patient records on third-party servers.
MedScript OPD is fundamentally different:
- π‘οΈ 100% Offline & Sovereign: All patient data, vitals, and consultation histories reside strictly on your local machine in an ACID-compliant SQLite database.
- β‘ Sub-Second Prescription Workflow: Designed with real-world outpatient speed in mind. Add medications rapidly with keyboard navigation, custom dosage prefixes, and repeat prescriptions in one click.
- π Defense-in-Depth Medical Security: Protected by PIN authentication, brute-force rate-limiting, unattended screen auto-lock, strict POSIX 0600 file permissions, and an immutable clinical audit trail.
- π¦ Cross-Platform Distribution: Ready for Linux (Flatpak & systemd), Windows (Standalone App Window & Background Service), and Local Clinic LAN.
- Keyboard-First Workflow: Type a drug name, configure dosage/timing, and press Enter to automatically open a fresh row for the next medication.
- Brand & Generic Visual Hierarchy: Displays the brand name in bold above with generic pharmacological composition below for maximum dispensing clarity.
- Dosage Form Prefixes: Automatic and selectable prefixes (
Tab.,Cap.,Inj.,Syr.,Oint.,Drops,Inhaler). - Standardized Dosing Matrix: Dosage frequencies (
1-0-1,1-1-1,SOS), meal timing (After food,Before food), duration (5 days,1 month), and special instructions. - Repeat Prescription (1-Click Refill): Instantly clone chronic medications and past clinical advice with a single click.
- 1-Click Bundles: Rapidly order comprehensive bundles:
- Diabetic Profile (HbA1c, FBS, PPBS, Urine Microalbumin)
- Hypertension Panel (Lipid Profile, Serum Creatinine, ECG, Electrolytes)
- Fever / Infection Workup (CBC, ESR, Dengue NS1, Typhoid Widal, Urine Routine)
- Cardiac Risk Panel (Troponin-I, CPK-MB, hs-CRP, Lipid Profile)
- Liver & Renal Panels (LFT, KFT, Uric Acid, Ultrasound Abdomen)
- Thyroid & Arthritic Panels (T3/T4/TSH, RA Factor, Anti-CCP, Vitamin D/B12)
- Interactive Chip Toggles: Add or remove individual lab tests with real-time badges.
- Standardized Celsius Temperature: Clinical temperatures formatted in Β°C (with fever threshold warnings β₯ 38.0Β°C).
- Interactive SVG Trend Charts: Real-time graphing of Blood Pressure (with JNC-8 alert bands), Weight progression curves, Pulse rate, SpO2 (%), and Temperature.
- Longitudinal Flowsheet: Side-by-side tabular comparison of vitals and diagnoses across all past visits.
- Dynamic Letterhead Engine: Powered by
@react-pdf/rendererfor crisp vector output. - Clinic Branding: Supports high-resolution clinic logos, doctor qualifications, registration numbers, and clinic addresses.
- Digital Rx Header & Legal Footers: Standard medical Rx symbology, date-stamped consult details, and computer-generated prescription validity notices.
- Consultation Desk PIN Lock: Secures the console against shoulder surfing.
- Anti-Brute Force Rate Limiter: Maximum 5 failed attempts triggers an automated 5-minute lockout.
- Inactivity Screen Auto-Lock: Automatically obscures and locks the screen after an idle period (configurable: 5, 10, 15, 30, or 60 min) with a 30-second warning countdown.
- Hardened HTTP Headers: Strict Content Security Policy (CSP),
X-Frame-Options: DENY,X-Content-Type-Options: nosniff, and anti-caching for patient records. - Immutable Clinical Audit Trail: Timestamped logging of logins, patient creations, prescription amendments, deletions, and data exports.
- POSIX 0600 Permissions: SQLite database files and backup snapshots are locked down so other OS accounts cannot access clinical data.
- Filter by date range (Today, 7 Days, Month, Year, Custom).
- RFC 4180 UTF-8 BOM CSV exports for:
- Complete Consultation Register
- Master Patient Directory
- Morbidity & Diagnosis Breakdown
- Drug Utilization & Scheduling Statistics
MedScript OPD conforms to the Freedesktop and Flathub packaging specifications:
# Build and install Flatpak locally
./scripts/build-flatpak.sh
# Run via Flatpak
flatpak run io.github.medscript.MedScriptOPDThe application will appear in your desktop application menu with native icons and isolated sandbox storage.
# 1. Run in current terminal (opens browser automatically)
./start-linux.sh
# 2. Or install as a permanent systemd background service (starts on computer boot)
./install-autostart.shTo manage the background service:
systemctl --user status medscript # Check service status
systemctl --user restart medscript # Restart server
systemctl --user stop medscript # Stop server
./uninstall-autostart.sh # Remove background service- Download or clone this repository.
- Double-click
start-windows.bat.- Automatically initializes dependencies and opens MedScript OPD in a clean, standalone desktop application window (via Microsoft Edge or Chrome
--appmode).
- Automatically initializes dependencies and opens MedScript OPD in a clean, standalone desktop application window (via Microsoft Edge or Chrome
- Windows Startup Service:
- Double-click
install-windows-service.batto register MedScript OPD as an automatic startup task on Windows logon. - Run
uninstall-windows-service.batto remove autostart.
- Double-click
Allow nursing stations, receptionists, or doctors on iPads/Android tablets to connect over clinic Wi-Fi:
- Windows: Run
start-lan.bat - Linux/macOS: Run
./start-lan.sh
The launcher displays your exact local network URL (e.g., http://192.168.1.45:3000).
Deploy with Docker or Docker Compose on local clinic servers, Home Assistant, or NAS:
docker compose up -dAccess the desk at http://localhost:3000. Database and backups persist in ./data and ./backups.
- Node.js 18 or 20+ (Node.js 20 LTS recommended)
- npm 9+
# Clone the repository
git clone https://github.com/Plaguedoctor-sudo/medscript-opd.git
cd medscript-opd
# Install dependencies
npm install
# Seed demo clinic data (optional)
npm run db:seed
# Start development server
npm run devnpm run typecheck # npx tsc --noEmit
npm run lint # eslint checks
npm run build # Next.js production compilation# Builds .tar.gz for Linux and .zip for Windows
npm run package:releaseFor full details on data protection, offline sovereignty, and vulnerability disclosure, please read SECURITY.md.
Contributions are warmly welcomed! Please read our CONTRIBUTING.md guide before submitting pull requests.
MedScript OPD is open-source software licensed under the MIT License.