- Push your code to GitHub
- Go to vercel.com/new
- Import your repository
- Vercel auto-detects Next.js and configures the build
In the Vercel project dashboard, go to Settings > Environment Variables and add:
NEXT_PUBLIC_SUPABASE_URL = https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY = your-anon-key
SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
WHOOP_CLIENT_ID = your-whoop-client-id
WHOOP_CLIENT_SECRET = your-whoop-client-secret
WITHINGS_CLIENT_ID = your-withings-client-id
WITHINGS_CLIENT_SECRET = your-withings-client-secret
NEXT_PUBLIC_APP_URL = https://your-app.vercel.app
CRON_SECRET = <generate-a-random-secret>
Generate a cron secret:
openssl rand -hex 32Update the redirect URIs in both provider dashboards:
- WHOOP:
https://your-app.vercel.app/api/auth/whoop/callback - Withings:
https://your-app.vercel.app/api/auth/withings/callback
Also update the Supabase auth redirect URL:
- Supabase: Add
https://your-app.vercel.app/callbackto the allowed redirect URLs in Authentication > URL Configuration
The vercel.json configures an automatic daily sync:
{
"crons": [
{
"path": "/api/cron/sync",
"schedule": "0 6 * * *"
}
]
}This runs at 6:00 AM UTC daily and syncs all connected users. The cron endpoint is secured by the CRON_SECRET environment variable -- Vercel automatically sends the Authorization: Bearer <CRON_SECRET> header.
vercel --prodOr push to your main branch and Vercel deploys automatically.
+---------------------------+
| Vercel |
| +---------------------+ |
| | Next.js (Edge/Node) | |
| | - Pages (SSR/SSG) | |
| | - API Routes | |
| | - Middleware | |
| +----------+----------+ |
| | |
| +----------v----------+ |
| | Vercel Cron | |
| | (daily sync @ 6 AM) | |
| +---------------------+ |
+------------+---------------+
|
+--------v--------+
| Supabase |
| (PostgreSQL) |
| (Auth) |
+--------+---------+
|
+--------v--------+
| External APIs |
| - WHOOP |
| - Withings |
+-----------------+
- In Vercel, go to Settings > Domains
- Add your custom domain
- Update
NEXT_PUBLIC_APP_URLto your custom domain - Update OAuth redirect URIs in WHOOP and Withings dashboards
- Update Supabase allowed redirect URLs