Skip to content

kuldipsolanki46/secure-file-share

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure File Sharing with EHR System

A blockchain-based secure file sharing system with integrated Electronic Health Records (EHR) module. Built with Next.js, Hardhat, IPFS, and smart contracts.

🚀 Quick Start

Prerequisites

  • Node.js and npm installed
  • MetaMask browser extension
  • Pinata account (for IPFS storage)

Installation

  1. Install dependencies:

    npm run setup
  2. Set up environment variables: Create a .env.local file in the root directory:

    PINATA_JWT=your_pinata_jwt_token_here
    
  3. Configure MetaMask:

    • Add Hardhat Local network:
      • Network Name: Hardhat Local
      • RPC URL: http://127.0.0.1:8545
      • Chain ID: 31337
      • Currency Symbol: ETH

Running the Application

You need 3 terminal windows:

Terminal 1 - Start Blockchain:

npm run backend:node

Wait 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 contract

Terminal 3 - Start Frontend:

npm run dev
  1. Open your browser:
    • Navigate to: http://127.0.0.1:3000
    • Connect your MetaMask wallet
    • Switch to Hardhat Local network if prompted

📋 Available Scripts

  • npm run setup - Install all dependencies (frontend + backend)
  • npm run dev - Start Next.js development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run backend:node - Start Hardhat local blockchain
  • npm run backend:deploy - Deploy FileSharing contract
  • npm run backend:deploy-ehr - Deploy EHR contract
  • npm run backend:test - Run smart contract tests

🎯 Features

Secure File Sharing

  • Upload and encrypt files
  • Share access with other wallets
  • Download and decrypt shared files
  • Manage file permissions

Electronic Health Records (EHR)

  • Patient and provider registration
  • Consent management
  • Encrypted medical record uploads
  • Patient-controlled access

📚 Documentation

  • PROJECT_OVERVIEW.md - Complete project overview and architecture
  • SETUP_INSTRUCTIONS.md - Detailed setup guide
  • QUICK_START.md - Quick testing guide for EHR system
  • WALLET_SETUP_GUIDE.md - MetaMask configuration guide
  • PINATA_SETUP.md - IPFS/Pinata setup instructions

🔧 Troubleshooting

"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)

🛠️ Tech Stack

  • 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

📖 Learn More

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 92.2%
  • Solidity 3.7%
  • JavaScript 2.2%
  • CSS 1.9%