Deployment
Deploy InvoiceToTable to production.
Prerequisites
Before deploying, ensure you have:
- PostgreSQL database (Supabase, Neon, or Vercel Postgres)
- Volcano Engine API key
- Creem account and API key
- Resend API key
- (Optional) Google OAuth credentials
- (Optional) S3-compatible storage
Deploy to Vercel
1. Push to GitHub
git push origin main2. Import in Vercel
- Go to vercel.com
- Import your GitHub repository
- Set all environment variables (see Environment Variables)
- Deploy
3. Database Migration
After first deploy:
pnpm db:push4. Configure Webhook
In Creem Dashboard, set webhook URL:
https://your-domain.com/api/payments/creem/webhook5. Set Up Cron Jobs
Configure the following protected cron endpoints:
curl -H "Authorization: Bearer YOUR_CRON_SECRET" \
https://your-domain.com/api/cron/subscription-grants
curl -H "Authorization: Bearer YOUR_CRON_SECRET" \
https://your-domain.com/api/cron/invoice-document-worker
curl -H "Authorization: Bearer YOUR_CRON_SECRET" \
https://your-domain.com/api/cron/cleanup-expired-batches
curl -H "Authorization: Bearer YOUR_RUNTIME_LOG_API_KEY" \
"https://your-domain.com/api/runtime-logs?levels=error&limit=100"For RUNTIME_LOG_DIR to be useful in production, deploy on a runtime with a persistent filesystem or mounted volume. Pure serverless instances only keep best-effort local history per instance.
On Vercel, add to vercel.json:
{
"crons": [
{
"path": "/api/cron/subscription-grants",
"schedule": "0 * * * *"
},
{
"path": "/api/cron/invoice-document-worker",
"schedule": "*/1 * * * *"
},
{
"path": "/api/cron/cleanup-expired-batches",
"schedule": "15 2 * * *"
}
]
}6. Create Admin Account
ADMIN_EMAIL=admin@example.com pnpm admin:setup7. Verify Environment
Make sure production .env has correct values for:
BETTER_AUTH_URL— Your actual domainNEXT_PUBLIC_APP_URL— Your actual domainRESEND_FROM_EMAIL— Verified domain sender
Post-Deploy Checklist
- Database migrated
- Webhook URL configured in Creem
- Cron jobs set up for credit grants, document processing, and cleanup
- Admin account created
- Email sender domain verified in Resend
- OAuth redirect URIs updated for production domain
- Analytics keys configured (PostHog, GA, Clarity)