A comprehensive blockchain-powered digital health platform built on the Lisk blockchain that revolutionizes medical record management, prescription handling, and healthcare collaboration with IPFS-powered decentralized storage.
Features • Getting Started • API Docs • Architecture • Contributing
To create a unified, patient-controlled digital health ecosystem that eliminates data silos, empowers healthcare stakeholders, and improves patient outcomes through secure, transparent, and accessible medical record management with decentralized storage.
- 🔐 Simplified Web3 Onboarding: Streamlined user registration process that abstracts blockchain complexity
- 👥 Multi-Role Access Control: Tailored interfaces for patients, doctors, hospitals, pharmacies, and administrators
- 🔗 Blockchain Security: Immutable record storage with smart contract-based access permissions on Lisk blockchain
- 🌐 Decentralized Storage: IPFS integration for secure, distributed medical data storage
- 🎁 Gamified Reward System: Blockchain-based token rewards for daily health activities and engagement
- 🏥 Integrated Healthcare Ecosystem: Complete platform combining medical records, telemedicine, and pharmacy coordination
- 👤 Patients: Complete medical history access and data sharing control
- 👨⚕️ Doctors: Comprehensive patient data and efficient prescription management
- 🏥 Hospital Administrators: Streamlined operations and compliance management
- 💊 Pharmacists: Secure prescription verification and inventory management
- ⚙️ System Administrators: Platform security and user access management
- ✅ Multi-role registration system (Patient, Doctor, Hospital, Pharmacy, Admin)
- ✅ Document-based identity verification with file upload
- ✅ Role-based access control (RBAC)
- ✅ JWT token-based authentication
- ✅ Web3 wallet integration (Lisk blockchain)
- ✅ Account abstraction service for simplified Web3 onboarding
- ✅ User profile management and updates
- ✅ Super admin creation and management
- ✅ System admin role management with hierarchical permissions
- ✅ Comprehensive permission management system
- ✅ Practitioner verification workflows
- ✅ Admin authentication and access control
- ✅ User suspension and revocation system
- ✅ User rejection and account management
- ✅ Patient management dashboard with comprehensive metrics
- ✅ Admin-only user directory with search and pagination
- ✅ Individual user data access and profile management
- ✅ Non-verified entities management for approvals
- ✅ User deletion and account cleanup capabilities
- ✅ Mood metrics and health journal data management
- ✅ Newsletter subscriber management and analytics
- ✅ Comprehensive approval management for data access
- ✅ Patient-controlled access permissions
- ✅ Healthcare provider directory access
- ✅ Personal health journaling system
- ✅ Medical record access control
- ✅ Patient record access with permission system
- ✅ Approval management system for patient data access
- ✅ Enhanced patient information display with full names
- ✅ Doctor profile and verification status
- ✅ Paginated doctor directory
- ✅ Collaborative approval workflows
- ✅ Personal health journal entries
- ✅ Journal entry management and retrieval
- ✅ Patient-owned health data tracking
- ✅ Secure journal storage
- ✅ Blockchain-based approval system for data access
- ✅ Patient-controlled access permissions
- ✅ Doctor approval workflows (create, fetch, accept, reject)
- ✅ Smart contract integration for secure access control
- ✅ Comprehensive audit trails for all access requests
- ✅ IPFS integration for decentralized storage
- ✅ Advanced record encryption service with AES-256-CBC encryption
- ✅ Batch encryption/decryption for medical records components
- ✅ Secure clinical notes, diagnosis, lab results, and medication encryption
- ✅ Decentralized file storage system
- ✅ IPFS daemon management
- ✅ Custom IPFS client implementation
- ✅ Medical record storage on IPFS
- ✅ Automatic IPFS initialization and configuration
- ✅ Medical record encryption service implementation
- ✅ AES-256-CBC encryption with secure IV generation
- ✅ Batch encryption/decryption capabilities
- ✅ Component-based encryption (clinical notes, diagnosis, lab results, medications)
- ✅ Comprehensive error handling and validation
- ✅ Environment-based encryption key configuration
- ✅ AES-256-CBC encryption for sensitive medical data
- ✅ Batch encryption/decryption capabilities
- ✅ Secure handling of clinical notes, diagnosis, lab results, and medications
- ✅ Configurable encryption keys via environment variables
- ✅ Error handling and validation for encryption operations
- ✅ Comprehensive encryption service with proper key management
- ✅ Advanced daily task generation system with role-based tasks
- ✅ Blockchain-based health token rewards (0.01 tokens per task completion)
- ✅ Automated reward distribution with cron jobs
- ✅ Queue-based token minting system with retry mechanisms
- ✅ Daily task reset at midnight (automatic cleanup)
- ✅ Comprehensive reward metrics tracking and analytics
- ✅ Event-driven task completion tracking
- ✅ Multi-activity reward triggers (health journaling, approvals, medical records)
- ✅ Task type initialization and management system
- ✅ Task statistics with completion rates and historical data
- ✅ Role-specific task generation (Patient, Doctor, Healthcare Provider)
- ✅ Token balance tracking with claimed and pending rewards
- ✅ Old task cleanup and maintenance operations
- ✅ Newsletter subscription functionality
- ✅ Admin-controlled subscriber management
- ✅ Brevo integration for email campaigns
- ✅ Subscriber analytics and reporting
- ✅ Daily task generation with 5 different task types
- ✅ Role-based task assignment (Patient, Doctor roles)
- ✅ Task completion tracking with token rewards
- ✅ Comprehensive task statistics and analytics
- ✅ Task type management and initialization
- ✅ Patient management dashboard with metrics
- ✅ Comprehensive user management (view, suspend, delete)
- ✅ Practitioner verification and approval workflows
- ✅ Newsletter subscriber management
- ✅ Health data cleanup and management tools
- 🔄 Advanced patient portal features
- 🔄 Digital prescription writing tools
- 🔄 Telemedicine consultation platform
- 🔄 Enhanced security features and audit logging
- 🔄 Real-time notifications system
- 🔄 Medical records retrieval interface
- 🔄 Achievement badges and milestone rewards
- 🔑 One-Time Prescription Keys: Unique secure keys for prescription access with automatic expiration
- 🤝 Real-Time Collaboration: Live communication tools for healthcare teams
- 📊 Health Analytics: AI-powered health insights and recommendations
- 🌐 Interoperability: HL7 FHIR compliance for seamless data exchange
- 📱 Mobile Applications: React Native apps for iOS and Android
- 🏆 Advanced Reward Features: NFT achievements, streak bonuses, and tiered reward systems
- 💱 Token Marketplace: Exchange health tokens for healthcare services and benefits
- Framework: NestJS (Node.js)
- Database: PostgreSQL (primary), Redis (caching)
- Blockchain: Lisk SDK for custom blockchain functionality
- Storage: IPFS (InterPlanetary File System) for decentralized storage
- Encryption: AES-256-CBC for medical record encryption with secure IV generation
- Authentication: JWT, 2FA support
- File Storage: Local disk storage (development), IPFS (production)
- API: RESTful APIs with comprehensive OpenAPI documentation
- IPFS: Kubo implementation for distributed file storage
- Protocol: HTTP API for IPFS interactions
- Features: Automatic daemon management, content addressing, distributed storage
- Web: React.js with TypeScript
- Mobile: React Native
- State Management: Redux Toolkit
- UI Framework: Material-UI / Chakra UI
- Containerization: Docker with IPFS integration
- CI/CD: GitHub Actions
- Cloud: AWS/GCP (planned)
- Monitoring: Prometheus + Grafana (planned)
- Security: SSL/TLS, rate limiting, DDoS protection
- Node.js (v18 or higher)
- npm or yarn
- PostgreSQL
- Redis (optional, for caching)
- IPFS (Kubo) - for decentralized storage
The project includes a pre-compiled Kubo binary in the kubo/
directory:
# Navigate to the kubo directory
cd kubo
# Install IPFS globally (requires sudo)
sudo ./install.sh
# Or manually move to PATH
sudo mv ipfs /usr/local/bin/ipfs
# Download latest Kubo release
wget https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz
# Extract and install
tar -xzf kubo_v0.24.0_linux-amd64.tar.gz
cd kubo
sudo ./install.sh
# Verify installation
ipfs version
# macOS with Homebrew
brew install ipfs
# Ubuntu/Debian
sudo apt update
sudo apt install kubo
# Arch Linux
sudo pacman -S kubo
-
Clone the repository
git clone https://github.com/AllofHealth/allofhealth-api.git cd allofhealth-api
-
Install dependencies
npm install
-
Environment Setup
# Copy environment template cp .env.example .env # Edit .env with your configuration # Database URLs, JWT secrets, IPFS configuration, etc.
-
Database Setup
# Run database migrations npm run migrate # Generate database schema (if needed) npm run generate
-
Create uploads directory
mkdir uploads
# Start with IPFS integration (recommended)
./scripts/start-with-ipfs.sh
This script will:
- ✅ Initialize IPFS if not already done
- ✅ Configure IPFS for API access
- ✅ Start IPFS daemon
- ✅ Set up IPFS environment variables
- ✅ Start the NestJS application
- ✅ Provide access to IPFS WebUI and Gateway
# Development mode with hot reload
npm run start:dev
# Production mode
npm run start:prod
# Watch mode
npm run start
# Build and run with Docker (includes IPFS)
docker build -t allofhealth-api .
docker run -p 3001:3001 -p 5001:5001 -p 8080:8080 allofhealth-api
- API Server:
http://localhost:3001
- API Documentation:
http://localhost:3001/api
- IPFS WebUI:
http://localhost:5001/webui
- IPFS Gateway:
http://localhost:8080
POST /auth/signUp
- User registration with document uploadPOST /auth/signIn
- User authentication
POST /admin/createSuperAdmin
- Create super administratorPOST /admin/createSystemAdmin
- Create system administratorPOST /admin/managePermissions
- Manage admin permissionsPOST /admin/login
- Admin authenticationPOST /admin/verifyPractitioner
- Verify healthcare practitionersDELETE /admin/deleteAdmin
- Delete administrator accountsPOST /admin/suspendUser
- Suspend user accountsPOST /admin/revokeSuspension
- Revoke user suspensionsPOST /admin/rejectUser
- Reject user registrationDELETE /admin/deleteUser
- Delete user accountsGET /admin/dashboard/patient-management
- Patient management dashboardGET /admin/fetchAllDoctors
- Fetch all doctors with paginationGET /admin/fetchAllPatients
- Fetch all patients with paginationGET /admin/fetchAllUsers
- Fetch all users with search and filtersGET /admin/fetchUserData
- Get detailed user informationGET /admin/fetchNonVerifiedEntities
- Get pending verification requestsDELETE /admin/deleteMoodMetrics
- Delete user mood dataDELETE /admin/deleteUserHealthJournal
- Delete user health journalsGET /admin/fetchNewsletterSubscribers
- Manage newsletter subscribers
POST /approval/createApproval
- Create new approval request for patient data accessPOST /approval/fetchDoctorApprovals
- Fetch all approval requests for a doctorPOST /approval/acceptApproval
- Accept a patient's approval requestPOST /approval/rejectApproval
- Reject a patient's approval requestGET /approval/cleanup/manual
- Manually trigger cleanup of expired approvals
POST /user/updateUser
- Update user profile with file upload support
GET /doctor/fetchDoctor
- Get doctor profile and verification statusGET /doctor/fetchAllDoctors
- Get all verified doctors (paginated)
POST /health-journal/addJournalEntry
- Add personal health journal entry (triggers daily task completion)GET /health-journal/fetchUserJournals
- Fetch user's health journal entries
POST /daily-tasks/generateDailyTasks
- Generate daily tasks for usersGET /daily-tasks/userDailyTasks
- Get user's daily tasksPOST /daily-tasks/completeDailyTask
- Complete a daily task and earn rewardsGET /daily-tasks/userDailyStats
- Get task completion statisticsPOST /daily-tasks/initialize-task-types
- Initialize default task typesDELETE /daily-tasks/cleanup
- Clean up old completed tasksGET /reward/fetchRewardMetrics
- Get user reward metrics and token balance
POST /newsletter/subscribe
- Subscribe to newsletter
GET /ipfs/testIpfs
- Test IPFS functionality and upload
- Internal Service:
RewardService
- Daily task tracking and reward management - Automated Distribution: Cron-based reward distribution every minute for qualified users
- Daily Reset: Automatic daily task counter reset at midnight
- Token Minting: Queue-based health token minting (0.01 tokens per task completion)
- Task Triggers: Health journal entries, approval acceptances, medical records, profile updates
- Metrics Tracking: Comprehensive reward metrics with total points, claimed balance, and pending rewards
- Role-Based Tasks: Different task types for patients and doctors
- Task Management: Task type initialization and cleanup operations
- Internal Service:
RecordsEncryptionService
- Medical record encryption/decryption - Batch Processing: Supports bulk encryption of clinical notes, diagnosis, lab results, and medications
- Security: AES-256-CBC encryption with unique IV for each operation
- Key Management: Environment-based encryption key configuration
GET /contract/system-admin-count
- Get system administrator countGET /contract/patientCount
- Get total patient countGET /contract/patientContractId
- Get patient contract ID by address- Internal Service:
ContractService.fetchTokenBalance
- Get user's health token balance - Internal Service:
ContractService.mintHealthTokens
- Mint health tokens for qualified users
GET /user/dashboard
- Fetch role-based dashboard data including token balance and daily progress
Additional endpoints are available and documented in the Swagger UI.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend API │ │ Blockchain │
│ (Planned) │◄──►│ (NestJS) │◄──►│ (Lisk) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Database │ │ IPFS │
│ (PostgreSQL) │ │ (Kubo Node) │
└─────────────────┘ └─────────────────┘
- Decentralized Storage: Medical records stored on IPFS network
- Content Addressing: Immutable content identification via CID
- Gateway Access: HTTP gateway for content retrieval
- API Integration: Custom IPFS client for seamless integration
- AES-256-CBC Encryption: Military-grade encryption for medical records
- Initialization Vector (IV): Unique 16-byte IV generated for each encryption operation
- Batch Processing: Efficient encryption/decryption of multiple record components simultaneously
- Key Management: Base64-encoded 32-byte encryption keys via environment configuration
- Component-Based: Individual encryption for clinical notes, diagnosis, lab results, and medications
- Format: Encrypted data stored as
IV:EncryptedData
hex format for easy parsing - Error Handling: Comprehensive validation and error management for encryption operations
- 🔐 Multi-layer Encryption: AES-256-CBC for sensitive medical data with IV-based security
- 🔑 Smart Contract Access Control: Blockchain-based permission management
- 🛡️ Decentralized Storage: IPFS for tamper-proof medical records
- 📋 Audit Trails: Comprehensive logging for compliance
- 🔒 Record Encryption Service: Dedicated service for encrypting/decrypting medical records
- 🛡️ Batch Processing: Secure batch encryption for multiple data components
- Project setup and basic NestJS configuration
- Multi-role authentication system
- File upload with validation (government ID, medical license)
- Identity verification workflow
- Role-based access control foundation
- API documentation with Swagger
- Blockchain integration with Lisk
- Smart contract deployment for access control
- Account abstraction service for Web3 onboarding
- Comprehensive approval management system
- Doctor verification and compliance checking
- Patient data access control with blockchain security
- Enhanced database schema with proper relationships
- User management with profile features
- Doctor directory with specialization filtering
- IPFS integration with Kubo
- Decentralized storage system
- Health journaling functionality
- Admin management system
- Contract interaction system
- Docker integration with IPFS
- Automated startup script
- Record encryption service with AES-256-CBC
- Batch encryption/decryption for medical records
- Enhanced gamified reward system with role-based daily tasks
- Blockchain-based health token rewards with comprehensive tracking
- Automated reward distribution and daily resets
- Queue-based token minting system with retry mechanisms
- Event-driven task completion tracking
- Advanced reward metrics and analytics dashboard
- Newsletter management system with admin controls
- Comprehensive admin dashboard with user management
- User suspension, rejection, and account management
- Task statistics and historical reward data
- Frontend web application development
- Advanced patient portal features
- Medical records storage and retrieval interface
- Telemedicine integration
- Enhanced security features and audit logging
- Prescription management system
- Real-time notifications system
- Achievement system and milestone tracking
- Advanced email campaign management
- Mobile push notifications for task reminders
- One-time prescription keys with automatic expiration
- Advanced telemedicine platform with video calling
- Mobile applications (React Native)
- AI-powered health insights and recommendations
- HIPAA compliance certification
- Advanced analytics dashboard
- Multi-language support
- Insurance integration
- Lab results integration
- Appointment scheduling system
- NFT-based achievement badges
- Health token marketplace and exchange
- Streak bonuses and tiered rewards
- Social features and health challenges
- System Uptime: Target 99.9%
- API Response Time: Target <200ms
- IPFS Storage Reliability: Target 99.9%
- Encryption Success Rate: Target 99.9%
- Registration Success Rate: Target 85%
- Security Incidents: Target 0
- Reward Distribution Success Rate: Target 99.5%
- Token Minting Success Rate: Target 99.9%
- Monthly Active Users: Target 10,000 in Year 1
- Feature Adoption Rate: Target 70% for core features
- User Satisfaction: Target 4.5/5
- Daily Task Completion Rate: Target 60%
- Token Earning Users: Target 8,000 in Year 1
- Average Daily Tasks per User: Target 3.5
- HIPAA Compliance: Healthcare data protection standards
- GDPR Ready: European data protection regulation compliance
- Encryption: End-to-end encryption for all sensitive data
- Access Control: Granular permission system
- Record Encryption: AES-256-CBC encryption for all sensitive medical data
- Decentralized Storage: IPFS for tamper-proof data integrity
- Comprehensive audit trails
- Real-time security monitoring
- IPFS content verification
- Regular security assessments
- Penetration testing (planned)
The application includes full Docker support with IPFS integration:
# Build
docker build -t allofhealth-api .
# Run with all services
docker run -p 3001:3001 -p 5001:5001 -p 8080:8080 allofhealth-api
The Docker container automatically:
- Installs and configures IPFS (Kubo)
- Starts IPFS daemon
- Builds and starts the NestJS application
- Exposes all necessary ports
We welcome contributions! Please see our Contributing Guidelines for details.
- 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 best practices
- Maintain test coverage above 80%
- Use conventional commit messages
- Update documentation for new features
- Test IPFS integration for storage features
- Test encryption/decryption functionality for medical records
- Validate encryption key management and security practices
Key environment variables for IPFS integration and encryption:
# IPFS Configuration
IPFS_HOST=127.0.0.1
IPFS_PORT=5001
IPFS_PROTOCOL=http
IPFS_API_KEY= # Optional for hosted IPFS
IPFS_API_SECRET= # Optional for hosted IPFS
# Record Encryption
RECORD_ENCRYPTION_KEY= # Base64 encoded 32-byte key for AES-256-CBC encryption
# # Example: generate with crypto.randomBytes(32).toString('base64')
# Reward System
DAILY_TARGET=5 # Number of daily tasks required for token reward
REWARD_AMOUNT=0.01 # Amount of tokens minted per daily target completion (in ETH)
# Database
DATABASE_URL=postgresql://...
# JWT
JWT_SECRET=your-secret-key
# Other configurations...
For security, generate a strong encryption key for medical records:
# Generate a secure 32-byte encryption key
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
# Or use the provided utility (if available)
npm run generate:encryption-key
- 🔑 Key Strength: Always use 32-byte (256-bit) keys for AES-256-CBC
- 🔒 Key Storage: Store keys in environment variables, never in source code
- 🔄 Key Rotation: Implement regular key rotation policies for production
- 🛡️ Backup: Securely backup encryption keys - lost keys mean lost data
- 🚫 Access Control: Limit key access to essential personnel only
- 📋 Audit: Log all encryption/decryption operations for compliance
This project is licensed under the MIT License - see the LICENSE file for details.
- IPFS/Protocol Labs for decentralized storage infrastructure
- Lisk Foundation for blockchain infrastructure
- NestJS Team for the excellent framework
- Healthcare Community for valuable feedback and requirements
- Documentation: [Link to docs] (Coming soon)
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@allofhealth.com
AllOf Health - Transforming Healthcare Through Blockchain & Decentralized Storage
Built with ❤️ by the AllOf Health Team