The Algerian Medical Passport is a revolutionary blockchain-based healthcare ecosystem that provides secure, transparent, and patient-controlled medical data management. Built on cutting-edge Web3 technologies, it serves as the first comprehensive medical passport system in Algeria and the MENA region.
- π Patient-Controlled Data: Complete data sovereignty for patients
- ποΈ Government Verified: Official medical ID issuance and regulation
- π’ Multi-Stakeholder: Serves all healthcare ecosystem participants
- π± Mobile-First: Responsive design for all devices
- π Multi-Network: Supports Polygon, Ethereum, and local networks
- π Enterprise Security: Military-grade encryption and security
- β‘ Real-Time: Instant verification and updates
- π Interoperable: Cross-platform medical record sharing
The system serves six main stakeholders in a comprehensive healthcare ecosystem:
| Stakeholder | Role | Key Capabilities |
|---|---|---|
| ποΈ Government | Identity verification & regulation | Medical ID issuance, system oversight, policy enforcement |
| π¨ββοΈ Doctors | Medical diagnosis & prescription | Patient record access, medical record creation, prescriptions |
| π’ Hospitals | Institutional care coordination | Patient admissions, department coordination, treatment tracking |
| π¬ Clinics | Outpatient & specialized care | Consultation records, specialized treatments, care coordination |
| π Pharmacies | Prescription verification & dispensing | Real-time verification, fraud prevention, dispensing history |
| π§βπ€βπ§ Patients | Data ownership & access control | Permission management, medical history access, emergency protocols |
- Blockchain Networks: Polygon, Ethereum, Hardhat Local
- Smart Contracts: Solidity 0.8.19
- Development Framework: Hardhat
- Web3 Library: Ethers.js v5
- Wallet Integration: MetaMask
- Framework: React 18+ with TypeScript
- UI Library: Material-UI (MUI)
- State Management: React Hooks + Context
- Form Handling: Formik with Yup validation
- Styling: Responsive CSS with Mobile-First approach
- Runtime: Node.js 16+
- Framework: Express.js
- Database: MongoDB (optional), IPFS for documents
- Authentication: JWT tokens
- Security: Helmet, CORS, Rate limiting
- Logging: Winston
- Package Manager: npm
- Testing: Hardhat tests, Jest
- Linting: ESLint, Prettier
- Version Control: Git
- CI/CD Ready: GitHub Actions compatible
algerian-medical-passport-blockchain/
βββ π contracts/ # Smart contracts (Solidity)
β βββ IdentityManagement.sol # Medical ID issuance & verification
β βββ MedicalRecords.sol # Medical record storage & access
β βββ PrescriptionManagement.sol # Prescription lifecycle
β βββ AccessControl.sol # Permission management
β
βββ π± frontend/ # React + TypeScript application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Route components
β β βββ hooks/ # Custom React hooks
β β βββ config/ # Configuration files
β β βββ types/ # TypeScript definitions
β βββ public/
β βββ healty1.png # Custom logo
β
βββ βοΈ backend/ # Node.js API server
β βββ src/
β β βββ controllers/ # Request handlers
β β βββ middleware/ # Authentication & validation
β β βββ routes/ # API routes
β β βββ services/ # Business logic
β βββ tests/ # Backend tests
β
βββ π scripts/ # Deployment & utility scripts
β βββ deploy.js # Contract deployment
β βββ setupDemo.js # Demo data setup
β
βββ π§ͺ test/ # Smart contract tests
βββ π demo/ # Demo & presentation files
β βββ EXECUTIVE_PRESENTATION.html # Executive presentation
β βββ DEMO_WALKTHROUGH.html # Interactive demo guide
β
βββ π docs/ # Documentation
β βββ SYSTEM_ARCHITECTURE.md # Comprehensive system docs
β
βββ π .env.example # Environment variables template
βββ βοΈ hardhat.config.js # Hardhat configuration
βββ π¦ package.json # Main package configuration
βββ π README.md # You are here!
Before you begin, ensure you have the following installed:
- Node.js (>= 16.0.0) - Download here
- npm (>= 8.0.0) - Comes with Node.js
- MetaMask browser extension - Install here
- Git - Download here
# Clone the repository
git clone https://github.com/nasrosoft/algerian-medical-passport-blockchain.git
# Navigate to project directory
cd algerian-medical-passport-blockchain
# Install dependencies for all packages
npm install# Copy environment template
cp .env.example .env
# Edit .env file with your configuration (optional for local development)
# nano .env# Terminal 1: Start local Hardhat blockchain
npm run node
# Terminal 2: Deploy contracts to local network
npm run deploy:local
# Set up demo data with sample users and records
npx hardhat run scripts/setupDemo.js --network localhost# Option 1: Start all services simultaneously
npm run dev
# Option 2: Start services individually
# Frontend (Terminal 1)
cd frontend && npm start
# Backend (Terminal 2)
cd backend && npm run dev| Service | URL | Description |
|---|---|---|
| π± Frontend | http://localhost:3000 | Main application interface |
| βοΈ Backend API | http://localhost:8000 | RESTful API server |
| β€οΈ Health Check | http://localhost:8000/health | API health status |
| π Demo Guide | demo/DEMO_WALKTHROUGH.html | Interactive walkthrough |
| π Presentation | demo/EXECUTIVE_PRESENTATION.html | Executive presentation |
| Network | Chain ID | Status | Purpose | RPC URL |
|---|---|---|---|---|
| π Localhost | 1 | β Active | Local Development | http://localhost:8545 |
| π Localhost | 1337 | β Active | Hardhat Local | http://localhost:8545 |
| π¨ Localhost Hardhat | 31337 | β Active | Hardhat Network | http://localhost:8545 |
| π£ Polygon Mumbai | 80001 | β Ready | Testnet | https://rpc-mumbai.maticvigil.com/ |
| π£ Polygon Mainnet | 137 | π§ Planned | Production | https://polygon-rpc.com/ |
The application automatically detects your network and provides guidance for setup. For manual configuration:
Localhost Network:
- Network Name: Localhost 8545
- New RPC URL: http://localhost:8545
- Chain ID: 1 (or 1337)
- Currency Symbol: ETH
# Run all smart contract tests
npm test
# Run tests with coverage report
npm run coverage
# Run specific test file
npx hardhat test test/IdentityManagement.test.js
# Run tests with gas reporting
npm test -- --gas# Frontend tests
cd frontend && npm test
# Backend tests
cd backend && npm test
# E2E tests (if available)
npm run test:e2e# Set up environment variables for testnet
export PRIVATE_KEY="your_private_key"
export POLYGON_MUMBAI_URL="your_rpc_url"
# Deploy to testnet
npm run deploy:testnet
# Verify contracts
npm run verify- Visit Polygon Faucet
- Enter your wallet address
- Request testnet MATIC tokens
After running the demo setup script, you'll have the following test accounts:
| Role | Account | Address | Private Key Available |
|---|---|---|---|
| ποΈ Government | #0 | Deployer account | β In Hardhat |
| π¨ββοΈ Doctor 1 | #1 | Cardiology specialist | β In Hardhat |
| π¨ββοΈ Doctor 2 | #2 | General practitioner | β In Hardhat |
| π’ Hospital | #7 | City General Hospital | β In Hardhat |
| π¬ Clinic | #8 | Specialized clinic | β In Hardhat |
| π Pharmacy | #3 | Neighborhood pharmacy | β In Hardhat |
| π§βπ€βπ§ Patient 1 | #4 | Adult patient | β In Hardhat |
| π§βπ€βπ§ Patient 2 | #5 | Elderly patient | β In Hardhat |
| π§βπ€βπ§ Patient 3 | #6 | Young adult patient | β In Hardhat |
-
Patient Registration
- Connect as Patient and register through the system
- Government approves and issues medical ID
-
Doctor-Patient Consultation
- Patient grants access to doctor
- Doctor creates medical records
- Patient can view their records
-
Prescription Workflow
- Doctor issues prescription during consultation
- Patient receives prescription notification
- Pharmacy verifies and dispenses medication
-
Access Control Management
- Patient grants/revokes doctor access
- Time-limited permissions
- Emergency access controls
-
Government Analytics
- View system-wide statistics
- Monitor healthcare provider activity
- Generate anonymized reports
- Complete Control: Patients own and control their medical data
- Granular Permissions: Grant/revoke access to specific providers
- Time-Limited Access: Temporary permissions with automatic expiration
- Emergency Protocols: Special access controls for critical situations
- Audit Trail: Complete history of data access and permissions
- Medical ID Issuance: Secure, blockchain-based identity verification
- Provider Verification: Healthcare provider license validation
- System Analytics: Privacy-preserving healthcare insights
- Regulatory Compliance: Built-in compliance with healthcare regulations
- Policy Enforcement: Automated enforcement of healthcare policies
- Instant Access: Real-time access to patient medical history (with permission)
- Immutable Records: Tamper-proof medical record creation
- Smart Prescriptions: Cryptographically secured prescription management
- Multi-Stakeholder: Seamless coordination between hospitals, clinics, and doctors
- Treatment Tracking: Complete treatment outcome monitoring
- Real-Time Verification: Instant prescription authenticity validation
- Fraud Prevention: Blockchain-based anti-counterfeiting
- Dispensing History: Complete medication dispensing records
- Inventory Management: Track medication stock and expiration
- Drug Interaction Alerts: Safety warnings for medication conflicts
- End-to-End Encryption: AES-256 encryption for sensitive data
- Multi-Signature Controls: Multi-party authorization for critical operations
- Role-Based Access: Granular permission system by user type
- Zero-Knowledge Ready: Privacy-preserving analytics capabilities
- GDPR Compliance: Built-in data protection regulation adherence
- Mobile-First Design: Responsive interface for all devices
- Multi-Language Support: Arabic, French, English interfaces
- Real-Time Notifications: Instant updates on medical activities
- Intuitive Dashboards: Role-specific user interfaces
- Offline Capabilities: Essential functions work without internet
# Set up environment variables
export PRIVATE_KEY="your_private_key_here"
export POLYGON_MUMBAI_URL="your_polygon_rpc_url"
export POLYGONSCAN_API_KEY="your_polygonscan_api_key"
# Deploy to Mumbai testnet
npm run deploy:testnet
# Verify contracts on Polygonscan
npm run verify:testnet# Set up mainnet environment variables
export PRIVATE_KEY="your_production_private_key"
export POLYGON_MAINNET_URL="your_polygon_mainnet_rpc"
export POLYGONSCAN_API_KEY="your_polygonscan_api_key"
# Deploy to mainnet (use with caution)
npm run deploy:mainnet
# Verify contracts
npm run verify:mainnet- Polygon Mumbai Faucet: https://faucet.polygon.technology/
- Alchemy Polygon Faucet: https://www.alchemy.com/faucets/polygon-mumbai
We welcome contributions to the Algerian Medical Passport project! Here's how you can help:
- Check existing issues to avoid duplicates
- Use the issue templates when available
- Provide detailed reproduction steps
- Include environment details (OS, Node.js version, etc.)
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript/JavaScript best practices
- Write comprehensive tests for new features
- Update documentation for API changes
- Use conventional commit messages
- Ensure all tests pass before submitting PR
Help improve our documentation:
- Fix typos and improve clarity
- Add examples and use cases
- Translate to Arabic or French
- Create video tutorials
- Project Lead: Mohammed TAMALI Abdelmadjid LARBI
- Blockchain Developer: nasrosoft
- Frontend Developer: nasrosoft
- Backend Developer: nasrosoft
- Email: amdlarbi@gmail.com / mtamali@gmail.com / nasrosoft.dev@gmail.com
- Website: https://medical-passport.dz Loading..β³
- LinkedIn: Mohammed TAMALI
- LinkedIn: Abdelmadjid LARBI
- LinkedIn: nasrosoft
- β Core smart contracts development
- β 6-stakeholder system implementation
- β Multi-network support
- β Comprehensive form validation
- β Responsive UI/UX design
- π Mobile application (iOS/Android)
- π Advanced analytics dashboard
- π Multi-language support (Arabic/French)
- π IPFS integration for document storage
- π API marketplace for third-party integrations
- β³ Regional expansion (MENA countries)
- β³ Insurance company integrations
- β³ Cross-border medical record sharing
- β³ Government API integration
- β³ Healthcare research platform
- β³ AI-powered diagnostic assistance
- β³ Telemedicine platform integration
- β³ IoT medical device connectivity
- β³ Advanced privacy (homomorphic encryption)
- β³ Decentralized governance (DAO)
If you find this project useful, please consider:
- β Starring this repository
- π€ Following for updates
- π¨βπ» Contributing to the codebase
- π’ Sharing with your network
- π Writing about your experience
This project is licensed under the MIT License - see the LICENSE file for details.
- β Commercial use allowed
- β Modification allowed
- β Distribution allowed
- β Private use allowed
β οΈ License and copyright notice required- β No warranty provided

