1. Production Environment Variables
Configure these variables in your hosting provider (or.env on your server):
R2_* variables if you use media uploads (Bio Link avatars, Sales Chat assets, Automation voice/PDF/images, and Scheduled Posts).
2. Database Migrations
Instance uses Prisma ORM. Always run migrations usingDIRECT_URL before starting new API and worker builds:
- Why both
DATABASE_URLandDIRECT_URL? Serverless and managed Postgres providers (like Neon or Supabase) use a connection pooler (DATABASE_URL) for high-concurrency runtime queries, while Prisma schema migrations require a direct, unpooled connection (DIRECT_URL). - If deploying with
docker-compose.yml, thedb-migrateservice runs migrations automatically beforeapiandworkersstart.
3. Configure Meta Webhooks for Production
- Open your app in the Meta Developer Dashboard.
- Navigate to Instagram -> API setup with Instagram Business login -> Configure Webhook.
- Set Callback URL to:
(Always include the
/api/prefix, because NestJS mounts all routes under/api.) - Set Verify Token to match your
META_WEBHOOK_VERIFY_TOKEN. - Click Verify and Save, then subscribe to
messages,messaging_postbacks,comments,message_reactions, andlive_comments.
4. Health Checks and Cron Jobs
- API Health Check:
GET https://api.yourdomain.com/api/healthreturns200 OKwhen the API, PostgreSQL, and Redis are healthy. - Background Workers (
apps/workers): Must run continuously alongsideapps/apito process outbound DMs, comment replies, profile enrichment, and scheduled posts. - Scheduled Cron Maintenance: Configure your cron runner (or Railway/GitHub Actions) to call the
/api/cron/*maintenance endpoints withAuthorization: Bearer <CRON_SECRET>so hourly rate-limit counters reset and paused accounts auto-resume on schedule.
