System Overview
Open Wearables is a self-hosted health data aggregation platform built with a modern microservices architecture. Each deployment serves a single organization with full control over data and infrastructure.
Tech Stack
Backend
FastAPI - High-performance Python web framework
- Python 3.13+
- SQLAlchemy 2.0 ORM
- Pydantic for validation
- Alembic for migrations
Frontend
React + TypeScript - Modern developer portal
- React 19
- TanStack Router
- TanStack Query
- Tailwind CSS 4.0
- shadcn/ui components
Database
PostgreSQL 18 - Relational data storage
- User profiles
- Health metrics
- Provider connections
- OAuth tokens
Task Queue
Celery + Redis - Background processing
- Data synchronization
- Scheduled tasks
- Webhook processing
- Provider API calls
Core Components
Backend API (FastAPI)
The backend serves as the central hub for all platform operations:- RESTful API endpoints at
/api/v1/* - OAuth flow orchestration for wearable providers
- User authentication and authorization
- Data normalization and validation
- Real-time health data queries
Frontend Portal (React)
Web-based dashboard for managing your integration: File-based routing structure:PostgreSQL Database
Relational database storing all platform data with a normalized schema: Core tables:| Table | Purpose |
|---|---|
developer | Admin accounts for the developer portal |
application | OAuth applications (future multi-app support) |
api_key | API credentials for accessing the platform |
user | End users who connect their wearables |
user_connection | Provider OAuth tokens and connection status |
provider_settings | Provider-specific configuration |
event_record | Normalized health events (workouts, sleep) |
data_point_series | Time series data (heart rate, steps) |
Celery Task Queue
Background job processor handling asynchronous operations: Task types:- Periodic Sync
- Provider Data Sync
- Webhook Processing
- Data Import
Automatically syncs data from connected providers on a schedule:Configured interval in
.env:Redis Cache
In-memory data store serving multiple purposes:- Message broker for Celery task queue
- Result backend for task status and return values
- Session cache for OAuth flows (state parameters)
- Rate limiting for API endpoints (future)
Data Flow
OAuth Connection Flow
Initiate Connection
User clicks “Connect Garmin” in the developer portal or your app calls the SDK:Backend generates OAuth state and returns authorization URL.
Callback Handling
Garmin redirects back to:Backend exchanges code for access/refresh tokens and stores in
user_connection table.Data Synchronization Flow
API Query Flow
Provider Strategy Pattern
Extensible architecture for adding new wearable integrations:See the Provider Development Guide to add support for new wearables.
Security Architecture
Authentication
- Developer Portal
- API Access
- SDK Authentication
JWT-based authentication for admin users:
Data Isolation
Each API key is scoped to a single application:Monitoring & Observability
Celery Flower Dashboard
Real-time monitoring of background tasks:- Task execution history
- Worker status and performance
- Task success/failure rates
- Real-time task monitoring
Application Logs
Structured JSON logging to stdout:Sentry Integration
Error tracking and performance monitoring:Deployment Considerations
Docker Compose (Production)
Thedocker-compose.yml is production-ready with health checks:
Environment Variables
Critical settings to change for production:Scaling
- Horizontal Scaling
- Database
- Redis
Add more Celery workers for increased throughput:
Next Steps
API Reference
Explore all available endpoints and data models
Provider Setup
Configure OAuth for Garmin, Polar, Suunto, and more
Add New Provider
Extend the platform with custom integrations
Contributing
Join the open-source community
