aditya
H
o
m
e
M
y
S
e
l
f
E
x
p
e
r
i
e
n
c
e
M
y
W
o
r
k
R
e
v
i
e
w
s
C
e
r
t
i
f
i
c
a
t
i
o
n
s
B
l
o
g
C
y
b
e
r
s
e
c
u
r
i
t
y
C
o
n
t
a
c
t
Return to Articles
Healthcare Tech

The Ayushman Bharat Protocol: Building Offline-First Hospital ERPs

2024-09-28

🏥 Engineering Offline-First Rural Healthcare

Blog Graphic

The Ayushman Bharat scheme is arguably the largest state-sponsored health insurance program in the world, targeting over 500 million beneficiaries. However, the software running the actual intake at the Primary Health Centers (PHCs) in rural India is fundamentally broken.

Most SaaS Hospital Management Systems (HMS) assume a sustained 4G connection. When a patient arrives at a clinic in rural Bihar, and the internet route drops, the front desk physically cannot log the patient into the government APIs, forcing them to turn back to vulnerable paper ledgers.

The Local-First Architecture

To build a healthcare ERP that actually survives rural India, the architecture must abandon synchronous cloud checks and adopt a Local-First Paradigm.

  1. Service Workers & PWA: The hospital terminal operates as a Progressive Web App. When the system boots up with internet, a Service Worker aggressively caches the entire React application bundle securely into the browser.
  2. IndexedDB Core: When the network drops, the application doesn't freeze. Patient intake flows, vaccination records, and medication logs are intercepted by the application and written instantly to the browser's IndexedDB.
  3. Optimistic UI Updates: The nurse sees a green "Saved" checkmark instantly. There is no loading spinner. The UI responds instantly because it trusts the local database.

Background Synchronization

The real magic happens when the internet connection stutters back to life for 30 seconds.

The frontend utilizes the Background Sync API. It silently detects the network heartbeat and immediately offloads the IndexedDB transaction queue to the central Node.js servers, syncing the patient data with the massive Ayushman Bharat APIs asynchronously.

Building tech for India means engineering software that functions perfectly in states of catastrophic failure.