A blockchain-based secure file sharing system with integrated Electronic Health Records (EHR) module. Built with Next.js, Hardhat, IPFS, and smart contracts.
- Node.js and npm installed
- MetaMask browser extension
- Pinata account (for IPFS storage)
-
Install dependencies:
npm run setup
-
Set up environment variables: Create a
.env.localfile in the root directory:PINATA_JWT=your_pinata_jwt_token_here -
Configure MetaMask:
- Add Hardhat Local network:
- Network Name:
Hardhat Local - RPC URL:
http://127.0.0.1:8545 - Chain ID:
31337 - Currency Symbol:
ETH
- Network Name:
- Add Hardhat Local network:
You need 3 terminal windows:
Terminal 1 - Start Blockchain:
npm run backend:nodeWait for: Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
Terminal 2 - Deploy Smart Contracts:
npm run backend:deploy # Deploy FileSharing contract
npm run backend:deploy-ehr # Deploy EHR contractTerminal 3 - Start Frontend:
npm run dev- Open your browser:
- Navigate to:
http://127.0.0.1:3000 - Connect your MetaMask wallet
- Switch to Hardhat Local network if prompted
- Navigate to:
npm run setup- Install all dependencies (frontend + backend)npm run dev- Start Next.js development servernpm run build- Build for productionnpm run start- Start production servernpm run backend:node- Start Hardhat local blockchainnpm run backend:deploy- Deploy FileSharing contractnpm run backend:deploy-ehr- Deploy EHR contractnpm run backend:test- Run smart contract tests
- Upload and encrypt files
- Share access with other wallets
- Download and decrypt shared files
- Manage file permissions
- Patient and provider registration
- Consent management
- Encrypted medical record uploads
- Patient-controlled access
PROJECT_OVERVIEW.md- Complete project overview and architectureSETUP_INSTRUCTIONS.md- Detailed setup guideQUICK_START.md- Quick testing guide for EHR systemWALLET_SETUP_GUIDE.md- MetaMask configuration guidePINATA_SETUP.md- IPFS/Pinata setup instructions
"Contract not deployed"
→ Run: npm run backend:deploy and npm run backend:deploy-ehr
"Cannot connect to blockchain" → Make sure Hardhat node is running (Terminal 1)
"Files not uploading"
→ Check .env.local has valid PINATA_JWT
MetaMask errors → Ensure you're on Hardhat Local network (Chain ID: 31337)
- Frontend: Next.js 16, React 19, TypeScript
- Blockchain: Hardhat, Solidity, Ethers.js v6
- Storage: IPFS (Pinata)
- Encryption: AES-256-GCM, RSA-OAEP
- UI: Tailwind CSS, Radix UI
See PROJECT_OVERVIEW.md for detailed architecture, features, and usage instructions.
Note: This project uses a local Hardhat blockchain for development. No real cryptocurrency is required.