Case study 03
Gohar Medical Trust HMS
Hospital management for a community hospital
- React
- TypeScript
- Vite
- Convex
- Convex Auth
- shadcn/ui
- Tailwind CSS
- Framer Motion
- Bun
Overview
A hospital management system for Gohar Hospital & Trust, a 24/7 community hospital in District Buner, Khyber Pakhtunkhwa. It replaces paper workflows with patient records, scheduling, admissions, medical records and a lab system on a real-time backend.
The Problem
Gohar Hospital & Trust runs much of its work on paper. Records are slow to find, handwriting is hard to read, patient history isn’t available remotely, and there’s no central view of beds or hospital-wide figures.
Each group of staff has its own pain points: reception, clinicians, nurses and administration. A system that fits only one of them wouldn’t be used.
The Approach
I modelled the hospital before building screens. That meant a Convex schema with indexes and validation, and a role-based permission matrix of 9 staff roles across 13 modules.
Delivery follows the clinical flow in phases: foundation, then patients, departments and rooms, appointments, admission/discharge/transfer, medical records and the lab system. Each phase is documented and finished before the next one starts.
Architecture
- ClientReact + TypeScript on Vite, with shadcn/ui and Tailwind. A responsive app shell has a fixed desktop sidebar and a mobile drawer, plus route guards with return-to redirects.
- BackendConvex serverless functions over a 21-table schema with indexes and validation.
- AccessConvex Auth plus an RBAC permission matrix that checks every module against the user’s role.
- UI kitReusable DataTable (sortable and filterable), debounced SearchInput, StatusBadge and EmptyState components shared across modules.
Engineering Decisions
Readable, collision-safe MRNs
Patient numbers follow a GMT-YYYY-XXXXX format and retry on collision, so staff can read them aloud and they stay unique.
Permissions as data
Access is defined as a roles × modules matrix rather than scattered checks, which makes it easy to audit and to extend when new staff roles appear.
Build in clinical order
Modules ship in the order a patient moves through the hospital, so each phase builds on real, working data from the one before.
Documented as it grows
ARCHITECTURE.md and a living context document record the schema, personas, UX decisions and phase status.
My Contribution
- Requirements, personas and phased roadmap
- Convex schema, functions and RBAC system
- Every module built so far, from the app shell to the lab system
Where It Stands
Built
- Foundation: auth, RBAC, user management, app shell and dashboard
- Patient registration, search, detail and editing with MRN generation
- Departments, rooms and appointment scheduling
- Admission / discharge / transfer and medical records
- Lab information system
Next
- Radiology and imaging (phase 3.2)
- Pharmacy, billing and finance, HR and reporting
- AI-assisted features once the core workflows are in daily use
Next case study
MehZu AI