---
title: "Deploy Open Wearables"
description: "One self-hosted API for wearable health data, with sync jobs and MCP."
category: "AI/ML"
url: https://railway.com/deploy/open-wearables-api
---

# Deploy Open Wearables

One self-hosted API for wearable health data, with sync jobs and MCP.

**[Deploy Open Wearables on Railway](https://railway.com/template/open-wearables-api)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/open-wearables-api/manifest.json

- **Creator:** blueorange
- **Category:** AI/ML
- **Total deploys:** 1

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### celery-flower

- **Source:** the-momentum/open-wearables
- **Start command:** `scripts/start/flower.sh`
- **Public domain:** Yes

### celery-beat

- **Source:** the-momentum/open-wearables
- **Start command:** `scripts/start/beat.sh`

### celery-worker

- **Source:** the-momentum/open-wearables
- **Start command:** `scripts/start/worker.sh`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:17

### backend

- **Source:** the-momentum/open-wearables
- **Start command:** `scripts/start/app.sh`
- **Public domain:** Yes

### frontend

- **Source:** https://github.com/the-momentum/open-wearables
- **Public domain:** Yes

## Documentation

# Deploy and Host Open Wearables on Railway

![Open Wearables logo](https://openwearables.io/favicon.svg)

Open Wearables gives developers **one REST API for wearable health data** instead of a separate integration for every device brand. It is MIT-licensed, built with FastAPI, Celery and SvelteKit, and maintained by Momentum. Connect Garmin, Oura, Whoop, Polar, Suunto, Strava, Withings, Ultrahuman and Google Health through OAuth, add Apple Health, Health Connect and Samsung Health through the mobile SDKs, and read everything back in one schema. A built-in MCP server lets AI assistants query the same data. This template deploys the complete platform on Railway, with the API on its own domain, the developer portal, background sync workers, a task monitor, PostgreSQL and Redis. Aggregator APIs charge $300–499/month before usage. Running it yourself costs about $15–30/month, with no per-user fees.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **backend** | FastAPI API on port `8000` with a public domain. Runs migrations and seeds provider settings on start, then serves the REST API, OAuth callbacks, webhooks and docs at `/docs`. |
| **frontend** | The developer portal, built from `/frontend`, on its own public domain. |
| **celery-worker** | Executes sync, import and webhook jobs (`scripts/start/worker.sh`). |
| **celery-beat** | Fires scheduled syncs (`scripts/start/beat.sh`). |
| **celery-flower** | Celery's web dashboard for queued, running and failed tasks, with a public domain. |
| **Postgres** | PostgreSQL 17 with SSL and a volume, database `open-wearables`. |
| **Redis** | Redis 8.2.1 with a password and a volume. The Celery broker. |

The four Python services build from `/backend` in the `the-momentum/open-wearables` repository, each with its own start script. Credentials, the secret key and public URLs are connected with Railway references.

---

## About Hosting Open Wearables

Health apps want data from the devices their users already wear. Each brand has its own developer program, OAuth scopes, payload shapes and rate limits, and keeping five integrations healthy is a job in itself. Open Wearables does that integration work once, as open software, and stores the results in your own Postgres.

**How a sync works.** Your app sends the user a connection link. They approve access with their provider, the backend stores the encrypted tokens, and beat schedules regular pulls. The worker fetches new data, normalizes it into sleep, activity, workouts, heart rate, HRV, SpO2 and body metrics, and can push a webhook to your app when it lands.

**Startup does the setup.** On every deploy the backend applies database migrations, creates the database it needs for outgoing webhooks, and seeds provider and device priority tables, so a fresh install is ready without manual SQL.

**Before your first deploy.** `ADMIN_EMAIL` and `ADMIN_PASSWORD` on the backend are required. Production mode refuses the default password, and the values are only used to create the first admin.

**Flower is public by default.** The task dashboard has its own domain and no login. Remove that domain in Railway, or keep it only while debugging, so job details aren't exposed.

Typical cost: **~$15–30/month** on Railway for seven services at small scale. Terra's Quick Start is from $499/month and Junction's Launch plan is $300/month.

---

## Deploy Open Wearables in Under 10 Minutes

1. Fill in `ADMIN_EMAIL` and `ADMIN_PASSWORD` on the **backend** service when Railway asks for them.
2. Click **Deploy on Railway** and wait for the first builds to finish (several minutes).
3. Open the **frontend** domain and sign in with that admin account.
4. Create an API key, then add a provider's client ID and secret in the portal's provider settings.
5. Send yourself a connection link, connect a device, and call the API from the backend's `/docs` page.

After that, syncs run on their own and new data arrives through the API or webhooks.

---

## Common Use Cases

- **Add wearables to an existing app.** Ship Garmin, Oura and Apple Health support with one integration.
- **AI health and coaching agents.** Give an assistant tools to read sleep, recovery and training data through MCP.
- **Clinical and academic studies.** Gather participant data from mixed devices into one database you control.
- **Personal training platforms.** Show each client's workouts and recovery, whatever they wear.
- **Insurance and wellness programs.** Collect activity data across brands with consistent fields.
- **Migrating off a paid aggregator.** Swap per-user API pricing for flat hosting costs.
- **Apple Health exports.** Let users upload their full Apple Health XML export, even large ones, and process it in the background.

---

## Configuration

| Variable | Required | Description |
|---|---|---|
| `ADMIN_EMAIL` | ⚠️ You set it | Email for the first admin account. |
| `ADMIN_PASSWORD` | ⚠️ You set it | Password for that account. The default is refused in production. |
| `SECRET_KEY` | 🔐 Auto-generated | Signs logins and encrypts provider tokens. Referenced by the Celery services. |
| `FRONTEND_URL`, `CORS_ORIGINS` | ✅ Auto-set | The portal's public URL and the origins allowed to call the API. |
| `VITE_API_URL`, `API_URL` | ✅ Auto-set | The backend's public URL, for the portal and the scheduler. |
| `DB_HOST`, `DB_PORT`, `DB_NAME`, `DB_USER`, `DB_PASSWORD` | ✅ Auto-injected | Postgres over the private network. |
| `REDIS_HOST`, `REDIS_PORT`, `REDIS_USERNAME`, `REDIS_PASSWORD`, `REDIS_DB` | ✅ Auto-injected | Redis broker connection. |
| `ENVIRONMENT` | ✅ Set | `production`. |
| `ACCESS_TOKEN_EXPIRE_MINUTES` | ✅ Set | `60`. |
| `SENTRY_ENABLED` | ✅ Set | `false`. |

**Provider apps.** Register a developer app with each wearable brand and set its redirect URL to your backend domain. You enter the credentials in the portal, not as Railway variables.

**Webhooks.** Register an HTTPS endpoint in the portal to receive new data as it syncs. Deliveries are signed, can be filtered by event or user, and can be replayed from the portal when debugging.

**MCP access.** Run the Open Wearables MCP server from your AI client with an API key from the portal. Data it returns is shared with that client's model provider.

---

## Open Wearables vs. Alternatives

| | Open Wearables on Railway | Terra | Junction | Building it yourself |
|---|---|---|---|---|
| **Monthly cost** | ~$15–30 usage | From $499 | From $300 | Months of engineering |
| **Self-hosted** | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
| **Per-user pricing** | ✅ None | ❌ Credits per connection | ⚠️ Tiered by users | ✅ None |
| **Normalized data model** | ✅ Yes | ✅ Yes | ✅ Yes | ❌ You design it |
| **MCP server for AI agents** | ✅ Included | ⚠️ Not core | ⚠️ Not core | ❌ You build it |
| **Data in your own Postgres** | ✅ Yes | ❌ Hosted | ❌ Hosted | ✅ Yes |
| **License** | ✅ MIT | ❌ Proprietary | ❌ Proprietary | ✅ Your own code |

---

## Dependencies for Open Wearables Hosting

- Railway account. Hobby is enough to try it; Pro for more sync volume.
- Developer accounts with the wearable providers you want to support.
- Optional: the iOS, Android, Flutter or React Native SDK for on-device health data.

### Deployment Dependencies

- [Open Wearables on GitHub](https://github.com/the-momentum/open-wearables): code, releases (latest 0.11.0) and docs
- [Open Wearables website](https://openwearables.io): features and guides
- [Celery Flower](https://flower.readthedocs.io): the task dashboard
- [Railway Private Networking](https://docs.railway.com/guides/private-networking): how services connect

### Implementation Details

The services build from the repository's default branch. The backend start script runs migrations and seeding before serving on port 8000. Flower waits until a worker answers a ping, then starts its dashboard. Postgres uses the `open-wearables` database, and Redis requires a password and saves to its volume.

The template follows the repository's default branch rather than a release tag, so each redeploy builds the latest code. Back up Postgres before redeploying in production.

---

## Frequently Asked Questions

**What does Open Wearables do?**
It connects users' wearables and health apps, syncs their data in the background, and serves it through one normalized REST API, webhooks and an MCP server.

**How does the cost compare with Terra or Junction?**
About $15–30/month on Railway for everything here, with unlimited connected users. Terra's entry plan is from $499/month and Junction's starts at $300/month.

**Which providers can users connect?**
Garmin, Oura, Whoop, Polar, Suunto, Strava, Withings, Ultrahuman and Google Health by OAuth, plus Apple Health, Health Connect and Samsung Health through the mobile SDKs.

**Do I need to run database migrations myself?**
No. The backend applies migrations and seeds its provider tables every time it starts.

**Should I keep Flower public?**
Only while you need it. Flower has no login in this setup, so remove its public domain once syncs are running smoothly.

**Can AI agents use the data?**
Yes. The MCP server exposes tools for users, sleep summaries and time series, authenticated with an API key you create in the portal.

---

## Why Deploy and Host Open Wearables on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Open Wearables on Railway, you get a ready-to-use wearable data API with background sync, a developer portal and AI access, at a flat monthly cost.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/open-wearables-api
