A blockchain-powered Electronic Health Record (EHR) platform built using Hyperledger Fabric, Node.js, Docker, and IPFS.
This project demonstrates how enterprise blockchain can be used for:
- Secure patient record management
- Decentralized healthcare data sharing
- Role-based access control
- Immutable medical audit logs
- Multi-organization healthcare ecosystems
| Technology | Purpose |
|---|---|
| Hyperledger Fabric | Enterprise blockchain framework |
| Node.js | Backend APIs and SDK integration |
| Fabric Node SDK | Blockchain interaction |
| Docker | Containerized blockchain deployment |
| Hyperledger Explorer | Blockchain visualization and monitoring |
| Angular / Next.js Frontend | User interface |
| CouchDB | State database |
| IPFS | Decentralized file storage |
| WSL2 | Linux development environment on Windows |
Frontend UI
↓
Node.js Backend APIs
↓
Hyperledger Fabric SDK
↓
Smart Contracts (Chaincode)
↓
Fabric Blockchain Network
├── Org1 (Hospital)
├── Org2 (Insurance)
├── Orderer
├── Certificate Authorities
├── CouchDB
└── Hyperledger Explorer
EHR-Hyperledger-Fabric-Project/
│
├── fabric-samples/ # Hyperledger Fabric samples and network
├── server-node-sdk/ # Backend APIs and Fabric SDK scripts
├── fabric-explorer/ # Hyperledger Explorer setup
├── backup/ # Backup utility scripts
├── screenshots/ # Project screenshots
├── README.md
└── install-fabric.sh
Before starting, install:
- Docker Desktop
- WSL2 Ubuntu
- Node.js >= 20
- npm >= 10
- Git
- VS Code with WSL Extension
./install-fabric.shThis downloads:
- Fabric binaries
- Docker images
- Fabric samples repository
cd fabric-samples/test-network
./network.sh upCheck containers:
docker psStop network:
./network.sh downcd fabric-samples/test-network
./network.sh up createChannel -caThis will:
- Start peers
- Start orderer
- Start CA servers
- Create
mychannel
./network.sh deployCC -ccn ehrChainCode -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascriptIf deployment succeeds, you should see:
Chaincode initialization is not required
cd server-node-sdk/
node cert-script/registerOrg1Admin.js
node cert-script/registerOrg2Admin.jsnode cert-script/onboardHospital01.js
node cert-script/onboardDoctor.js
node cert-script/onboardInsuranceCompany.js
node cert-script/onboardInsuranceAgent.jsThese scripts:
- Register identities
- Enroll users
- Store credentials in wallet
- Invoke blockchain transactions
npm install
npm run devBackend runs on:
http://localhost:5000
| API | Purpose |
|---|---|
| registerPatient | Register patient |
| loginPatient | Login patient |
| grantAccess | Grant access to doctor |
| addRecord | Add patient medical record |
| getRecordById | Fetch record by ID |
| getAllRecordByPatienId | Fetch patient records |
| fetchLedger | Fetch blockchain ledger |
- Government - Network owner
- Hospital - Network organization
- Doctor - Hospital member
- Diagnostics Center
- Pharmacies
- Researchers / R&D
- Insurance Companies
- Patient
| Actor | Permissions |
|---|---|
| Government | Admin Access |
| Hospital | Read/Write Doctor Data |
| Doctor | Read/Write Patient Data |
| Diagnostics Center | Read/Write Diagnostic Records |
| Pharmacies | Read/Write Prescriptions |
| Researchers | Read-only based on consent |
| Insurance Companies | Read/Write Claims |
| Patient | Full access to own data |
{
"recordType": "hospital",
"createdBy": "hospitalId",
"data": {
"name": "ABC Hospital",
"address": "ABC Location"
}
}{
"recordType": "physician",
"createdBy": "physicianID",
"data": {
"name": "Doctor Name",
"hospital": "ABC Hospital"
}
}cd fabric-explorer/sudo cp -r ../fabric-samples/test-network/organizations/ .
cp -r ../fabric-samples/test-network/organizations/ .export EXPLORER_CONFIG_FILE_PATH=./config.json
export EXPLORER_PROFILE_DIR_PATH=./connection-profile
export FABRIC_CRYPTO_PATH=./organizationsInside adminPrivateKey:
- verify certificate path
- ensure key filename matches crypto materials
Without logs:
docker-compose up -dWith logs:
docker-compose updocker-compose down✅ Multi-Organization Fabric Network
✅ Chaincode Deployment
✅ Smart Contract Invocation
✅ Node SDK Integration
✅ Blockchain Explorer Monitoring
✅ Dockerized Infrastructure
✅ CA-Based Identity Management
✅ CouchDB State Database
✅ Healthcare Role Management
The project uses multiple containers:
- peer0.org1.example.com
- peer0.org2.example.com
- orderer.example.com
- ca_org1
- ca_org2
- ca_orderer
- couchdb0
- couchdb1
- fabric-explorer
- chaincode containers
One of the biggest learning experiences in this project was debugging and fixing real enterprise blockchain setup issues.
VS Code was not opening properly in WSL.
Installed:
- WSL2
- VS Code WSL extension
Used:
code .Also fixed PATH configuration issues.
write unix @->/var/run/docker.sock: write: broken pipe
while deploying chaincode.
Corrupted/stale Fabric Docker images.
Removed old images:
docker rmi hyperledger/fabric-peer:latest -f
docker rmi hyperledger/fabric-orderer:latest -f
docker rmi hyperledger/fabric-ca:latest -fThen restarted Docker Desktop.
npm was using Windows binaries inside WSL.
Errors:
UNC paths are not supported
Disabled Windows PATH integration in WSL.
Verified:
which node
which npmExpected:
/usr/bin/node
/usr/bin/npm
Angular CLI and Angular core versions were incompatible.
Installed compatible versions:
npm install --legacy-peer-deps
npm install @types/node@16 --save-devfabric-samples was treated as embedded Git repository.
Removed nested Git metadata:
rm -rf fabric-samples/.gitThen re-added project files.
You've asked to invoke a function that does not exist: onboardDoctor
Backend SDK called function not implemented in deployed chaincode.
Updated and redeployed correct chaincode.
Old Node.js versions caused Fabric SDK failures.
Upgraded to:
Node.js v20+
Explorer failed to load network.
Correctly copied:
organizations/and updated:
adminPrivateKey path
inside Explorer connection profile.
This project provided practical experience in:
- Enterprise blockchain development
- Smart contract deployment
- Docker container orchestration
- Distributed ledger architecture
- Blockchain identity management
- Hyperledger Fabric administration
- Real-world debugging
- WSL Linux development
- Node SDK integration
- Blockchain monitoring and analytics
Planned enhancements:
- Full healthcare frontend UI
- JWT authentication
- IPFS encrypted medical file storage
- Role-based dashboards
- Patient consent workflows
- Blockchain analytics
- Audit reports
- REST API documentation
- Kubernetes deployment
- CI/CD pipelines
Murari Guna
GitHub Repository:
https://github.com/murariguna/blockchain-system
-
Hyperledger Fabric GitHub Repository:
https://github.com/hyperledger/fabric -
Hyperledger Fabric Samples Repository:
https://github.com/hyperledger/fabric-samples -
Hyperledger Explorer Repository:
https://github.com/hyperledger-labs/blockchain-explorer -
Hyperledger Fabric Documentation:
https://hyperledger-fabric.readthedocs.io/ -
Additional Architecture & Implementation Reference:
https://github.com/akshaykurhekar/EHR-Hyperledger-Fabric-Project.git
This project uses components and tools from the Hyperledger Fabric ecosystem.
Hyperledger Fabric is licensed under the Apache License 2.0.
-
Apache License 2.0:
https://www.apache.org/licenses/LICENSE-2.0 -
Hyperledger Project Website:
https://www.hyperledger.org/