Npub.Health
Manage health records securely with a user-controlled platform, enabling selective sharing of health data while maintaining privacy through end-to-end encryption.
Author

HealthNoteLabs
Quick Info
Actions
Tags
Npub.Health
A decentralized health records platform built on Nostr protocol.
Project Overview
Npub.Health provides a secure, user-controlled platform for managing health data using the Nostr protocol. This application gives individuals ownership over their health information while enabling selective sharing with healthcare providers.
Features
- Secure health record storage using Nostr protocol
- User-controlled data sharing and permissions
- Provider verification system
- Cross-platform support (web, mobile)
- End-to-end encryption for sensitive health data
Tech Stack
- Frontend: React, TypeScript, TailwindCSS
- Backend: Node.js
- Database: SQLite with Drizzle ORM
- Protocol: Nostr
Getting Started
Prerequisites
- Node.js v18 or higher
- npm or yarn
Installation
-
Clone the repository
bash git clone https://github.com/HealthNoteLabs/Npub.Health.git cd Npub.Health -
Install dependencies
bash npm install -
Set up environment variables
bash cp .env.example .env # Edit .env with your configuration -
Start the development server
bash npm run dev
Project Structure
Npub.Health/
├── client/ # Frontend React application
├── server/ # Backend Node.js server
├── shared/ # Shared utilities and types
├── scripts/ # Utility scripts
└── ...
Development
Running the app in development mode
npm run dev
Building for production
npm run build
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
For any questions or feedback, please open an issue on this repository.
AWS Integration for Blossom Server Deployment
This project includes AWS integration to automatically deploy Blossom servers for users. The implementation allows users to create their own private Blossom servers on AWS EC2 instances.
Setup Steps
-
Install AWS SDK:
npm install @aws-sdk/client-ec2 -
Create Security Groups: The
scripts/create_aws_security_groups.jsscript will create the necessary security groups in each AWS region:node scripts/create_aws_security_groups.jsMake sure to update the VPC ID in the script for each region. -
Configure AWS Credentials: Create a
.envfile with the following variables: ``` AWS_ACCESS_KEY_ID=your_access_key_id AWS_SECRET_ACCESS_KEY=your_secret_access_key
# Security Groups for each region (output from the script) SECURITY_GROUP_US_EAST=sg-xxxxxxxxxxxxxxxx SECURITY_GROUP_US_WEST=sg-xxxxxxxxxxxxxxxx SECURITY_GROUP_EU_CENTRAL=sg-xxxxxxxxxxxxxxxx SECURITY_GROUP_AP_SOUTHEAST=sg-xxxxxxxxxxxxxxxx
# Database URL DATABASE_URL=postgres://postgres:postgres@localhost:5432/npubhealth ```
- Set up PostgreSQL database: Follow these steps to set up the database:
- Install PostgreSQL
- Create a database named
npubhealth -
Run migrations to create tables:
npm run db:push -
Test the integration:
npm run dev
Architecture
The AWS integration consists of:
- EC2 Manager (
server/aws/ec2Manager.ts): Handles creating and checking EC2 instances. - Server Monitor (
server/aws/serverMonitor.ts): Periodically checks and updates server status. - API Endpoints (
server/routes.ts): Provides REST endpoints for server management. - Database Integration (
server/db): Persists server information and status.
User Flow
- User selects a server tier, region, and name
- System generates a payment address
- User sends payment (simulated in development)
- System deploys an EC2 instance with the Blossom server installation script
- UI polls for server status until it's running
- User connects to their personal Blossom server
Security Considerations
- The security groups allow HTTP, HTTPS, and the Blossom server port (3000)
- SSH access should be restricted to specific IPs in production
- AWS credentials should have limited permissions following the principle of least privilege
- For production, consider using IAM roles instead of credentials
Troubleshooting
If you encounter issues:
- Check AWS credentials and permissions
- Verify that security groups are properly configured
- Look at server logs for deployment errors
- Check the database for server status information
For more information about the AWS SDK, refer to the official documentation.
