A production-ready FastAPI + React health platform for tracking medical records, lab results, medications, and unified health timeline.
- Authentication: JWT-based auth with bcrypt password hashing, rate limiting, and password reset
- Medical Records: Track doctor visits, diagnoses, and notes
- Lab Results: Record and view laboratory test results with reference ranges
- Medications: Manage current and past medications with dosage validation
- Timeline: Unified chronological view of all health events
- Security: CORS protection, input validation, auth middleware
- Production Ready: Error boundaries, loading states, pagination, consistent API errors
docker-compose upThis will start both backend (port 8000) and frontend (port 5173).
- Navigate to backend directory:
cd backend- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Copy
.env.exampleto.envand configure:
cp .env.example .env
# Edit .env and change HEALTHOS_SECRET_KEY to a secure random value- Run the server:
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000
API docs: http://localhost:8000/docs
- Navigate to frontend directory:
cd frontend- Install dependencies:
npm install- Start development server:
npm run devFrontend will be available at http://localhost:5173
Run the seed script to create a test user and sample data:
cd backend
python seed_data.pyTest credentials:
- Email:
test@healthos.dev - Password:
password123
See DATABASE_SETUP.md for detailed database configuration, migrations, and backup instructions.
POST /api/auth/register- Register new userPOST /api/auth/login- Login and get JWT token
GET /api/medical-records/- List user's medical recordsPOST /api/medical-records/- Create medical record
GET /api/labs/- List user's lab resultsPOST /api/labs/- Create lab result
GET /api/medications/- List user's medicationsPOST /api/medications/- Create medication
GET /api/timeline/- Get unified health timeline
GET /api/modules/- List available modules
POST /api/imports/- Import health data from file
Protected endpoints require a JWT token in the Authorization header:
Authorization: Bearer <token>
Get a token by registering or logging in.
cd backend
pytest tests/unit/ -v
pytest tests/integration/ -v- FastAPI backend with SQLAlchemy ORM
- SQLite database (configurable via
HEALTHOS_DATABASE_URL) - JWT authentication with bcrypt password hashing
- Modular system for extending functionality
- Timeline service for unified health events
HEALTHOS_DATABASE_URL- Database connection string (default: sqlite:///./data/database/healthos.db)HEALTHOS_SECRET_KEY- JWT signing key (default: change-me, MUST change in production)HEALTHOS_ACCESS_TOKEN_EXPIRE_MINUTES- Token expiration (default: 60)HEALTHOS_LOG_LEVEL- Logging level (default: INFO)
The codebase follows these principles:
- Type hints throughout
- Dependency injection for auth
- Session-based database access
- Comprehensive test coverage
- Clear separation of concerns (routes, services, models)
- Passwords hashed with bcrypt
- JWT tokens for stateless authentication
- User data isolation (enforced at query level)
- Protected endpoints via dependency injection
MIT