How tech-maniacs/blockchain-phr works
Project type and purpose
• From the file tree and README, we see a full-stack web application (“MEDICHAIN”) that manages Personal Health Records (PHRs) on a blockchain.
• Frontend: React (client/ folder), uses Redux for state.
• Backend: Node.js + Express (server.js, routes/, controllers/, models/), persisting data in MongoDB.
• Blockchain integration: a Solidity smart contract deployed on Sepolia, accessed via web3.js (client/src/web3.js and smartcontract/).
File structure
• Top-level folders:
• client/ – React app (public/, src/, package.json)
• config/ – database connection (config/db.js)
• controllers/ – Express controllers for admin, doctor, hospital, user
• models/ – Mongoose schemas for patients, doctors, hospitals, PHRs
• routes/ – Express routers for each role
• middlewares/ – auth middleware (JWT or role-based)
• smartcontract/ – Solidity code
• server.js – Express app entry point
• Patterns:
• Backend uses MVC (models/controllers/routes)
• Frontend uses component-based structure, Redux slices (alertSlice, userSlice).
• Integration layer with web3.js for blockchain calls.
Readme insights
• Points out blockchain network (Sepolia), smart contract deployed on Remix, web3.js integration.
• No built-in backend-to-contract communication: client handles contract calls.