Connect your Oura Ring and get a personalised nightly recovery plan built from your actual sleep, readiness, and activity data — powered by Claude.
Built on Context Gateway by Open Data Labs.
- Next.js 14 App Router + TypeScript
- Tailwind CSS
@opendatalabs/connect-js— Oura Ring OAuth via Context Gateway@anthropic-ai/sdk— Claude Haiku for recovery plan generation
git clone https://github.com/vana-com/sleep-coach
cd sleep-coach
npm installcp .env.example .env.localThen fill in each value (see table below).
npm run devOpen http://localhost:3000.
| Variable | Where to get it |
|---|---|
OPENDATALABS_API_KEY |
Open Data Labs dashboard → API Keys |
OPENDATALABS_ENCRYPTION_SECRET |
Dashboard → App Settings → Data Encryption Secret |
OPENDATALABS_APP_ID |
Dashboard → Apps → your app ID |
ANTHROPIC_API_KEY |
console.anthropic.com |
NEXT_PUBLIC_APP_URL |
Your deployed URL (e.g. https://sleep-coach.vercel.app). Use http://localhost:3000 locally. |
- Sign in at dashboard.opendatalabs.xyz.
- Create a new app. Copy the App ID into
OPENDATALABS_APP_ID. - Under API Keys, generate a key and copy it into
OPENDATALABS_API_KEY. - Under App Settings, generate a Data Encryption Secret and copy it into
OPENDATALABS_ENCRYPTION_SECRET. - Under Allowed Origins, add your domain (e.g.
https://sleep-coach.vercel.appandhttp://localhost:3000). The Connect iframe will not load from unlisted origins. - Confirm that
ourais an enabled source for your app.
- User clicks "Connect Oura Ring" on the landing page.
- The app creates a short-lived Connect session via the ODL API (server-side, key never exposed to the browser).
- The ODL Connect iframe opens and the user authenticates with Oura through the hosted flow.
- On success, the app receives a
connectionIdand fetches decrypted Oura data (readiness, sleep periods, activity) from the ODL API. - That data goes to Claude Haiku with a structured prompt. Claude returns 3-4 specific recommendations and a single tonight's priority, as JSON.
- The result page renders the plan.
vercel deploy --prodSet all five environment variables in the Vercel dashboard under Settings → Environment Variables, then add the production URL to your ODL app's allowed origins.
This app uses Context Gateway to connect to Oura Ring. Context Gateway handles OAuth, token management, and end-to-end encrypted data retrieval — your server never sees plaintext Oura credentials.