This Electronic Health Record (EHR) system is built using Node.js, Express, PostgreSQL, and Firebase Authentication. It is deployed on Aptible to ensure it meets strict legal requirements for handling medical data. The system is designed to work with the INET-READY platform, making travel safer and more informed.
- User Authentication: Secure JWT-based authentication via Firebase.
- Medical Data API: CRUD endpoints for storing, retrieving, and deleting user medical data.
- PostgreSQL Integration: Robust, scalable data storage.
- CORS Support: Configured for secure cross-origin requests from trusted frontends.
- Dockerized: Easy containerized deployment.
- Cloud Ready: Out-of-the-box support for Aptible and other cloud platforms.
- Node.js (v18+ recommended)
- PostgreSQL database
- Firebase project with a service account key
- Docker (optional, for containerized deployment)
-
Clone the repository:
git clone https://github.com/your-username/inet-ready-ehr.git cd inet-ready-ehr -
Install dependencies:
npm install
-
Set up environment variables:
- Copy
.envandserviceAccountKey.json(do not commit secrets!) - Example
.env:FIREBASE_ADMIN_SDK=serviceAccountKey.json DATABASE_URL=postgres://localhost:5432/mydb PORT=3000
- Copy
-
Prepare PostgreSQL database:
- Create a
medical_datatable:CREATE TABLE medical_data ( user_id VARCHAR(128) PRIMARY KEY, data JSONB NOT NULL, updated_at TIMESTAMP DEFAULT NOW() );
- Create a
node server.jsAll endpoints require a valid Firebase ID token in the Authorization: Bearer <token> header.
- Description: Fetches the authenticated user's medical data.
- Response:
[ { "data": { /* user medical data */ } } ]
- Description: Creates or updates the user's medical data.
- Body:
{ "medicalData": { /* your data */ } } - Response:
{ "user_id": "...", "data": { /* ... */ }, "updated_at": "..." }
- Description: Deletes the authenticated user's medical data.
- Response:
{ "message": "Entry deleted", "deleted": { /* ... */ } }
Build and run the app in a container:
docker build -t inet-ready-ehr .
docker run -p 3000:3000 --env-file .env inet-ready-ehrThis app is ready for deployment on Aptible via GitHub Actions. See .github/workflows/deploy.yml for CI/CD setup.
Contributions are welcome! Please open issues or submit pull requests for improvements and bug fixes.
This project is licensed under the MIT License.
- Author: bpmiranda3099
- Project: inet-ready-ehr
Your Heat Check for Safe and Informed Travel.