Deployment Guide — HeartCo
Complete checklist to deploy HeartCo to production on Vercel with Supabase, Stripe, and supporting services.
Table of Contents
- Prerequisites
- 1. Vercel Deployment
- 2. Supabase — PostgreSQL Database
- 3. Stripe Setup
- 4. Resend — Transactional Email
- 5. Redis (Upstash) — Optional
- 6. Sentry — Error Tracking (Optional)
- Pre-Launch Checklist
- Launch to Production
- Scaling Considerations
- Troubleshooting
- Contact & Support
Prerequisites
- GitHub repository set up and pushed
- Node.js 22 LTS
- Vercel account
- Supabase account (PostgreSQL)
- Stripe account
- Resend account (for transactional emails)
- Upstash Redis account (optional, for caching)
- Sentry account (optional, for error tracking)
1. Vercel Deployment
Import Repository
- Go to vercel.com/new
- Select "Import Git Repository" → choose your HeartCo repo
- Click Import
Configure Build Settings
Under Settings > Build & Development Settings:
- Build Command: (Use default)
- Output Directory: (Use default — Next.js auto-detected)
- Install Command:
pnpm install
Under Settings > Functions:
Set environment variable for Node memory:
NODE_OPTIONS=--max-old-space-size=7168
Runtime: Node.js 22.x
Set Environment Variables
In Settings > Environment Variables, add all variables from .env.example:
# Database (from Supabase, see Step 2)
DATABASE_URL=postgresql://user:password@db.supabase.co/postgres
DIRECT_URL=postgresql://user:password@db.supabase.co/postgres
# Auth
NEXTAUTH_URL=https://yourdomain.com
AUTH_SECRET=<generate-with-openssl-rand-base64-32>
# Stripe (see Step 3)
STRIPE_SECRET_KEY=sk_live_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
# Resend (see Step 4)
RESEND_API_KEY=re_...
# Redis (optional, see Step 5)
UPSTASH_REDIS_REST_URL=https://xxxx.upstash.io
UPSTASH_REDIS_REST_TOKEN=AXxxxx
# Sentry (optional, see Step 6)
SENTRY_DSN=https://...@sentry.io/...
# Branding
NEXT_PUBLIC_APP_NAME=HeartCo
NEXT_PUBLIC_APP_DOMAIN=yourdomain.com
NEXT_PUBLIC_APP_URL=https://yourdomain.com
Deploy
Click Deploy. Vercel will build and deploy automatically.
Custom Domain
- Go to Settings > Domains
- Add your custom domain (e.g.,
app.yourdomain.com) - Follow DNS configuration steps (CNAME record)
- SSL is auto-provisioned via Let's Encrypt
2. Supabase — PostgreSQL Database
Create Project
- Go to supabase.com
- Click New Project
- Enter project name, password, region (closest to your users)
- Click Create new project (wait 2-3 minutes)
Get Connection Strings
In Settings > Database > Connection strings:
- Copy URI → set as
DATABASE_URLin Vercel - Copy URI with
?schema=public→ set asDIRECT_URL
Example:
postgresql://postgres:password@db.supabase.co:5432/postgres
Run Migrations
In your local environment:
# Link to Supabase
pnpm dlx supabase link --project-ref <YOUR_PROJECT_ID>
# Run all pending migrations
npx prisma migrate deploy
# Verify
npx prisma studioEnable Extensions (if needed)
In Supabase Dashboard → SQL Editor, run:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "pgcrypto";Connection Pooling (Supavisor)
For serverless deployments, enable pooling:
- Settings > Database > Connection pooling
- Mode: Transaction (default)
- Pool size: 3-5 connections
- Use the Pooling Connection String in your serverless environment
3. Stripe Setup
Create Products & Prices
In Stripe Dashboard:
- Products → Create product
For each plan (FREE, STARTER, PRO, BUSINESS, ENTERPRISE):
- Create product with name matching
src/lib/config/branding.ts - Add 2 prices: Monthly and Annual
- Set features via product metadata
Example pricing structure:
STARTER:
- Monthly: $29/month (Price ID: price_starter_monthly)
- Annual: $290/year (Price ID: price_starter_annual)
PRO:
- Monthly: $79/month (Price ID: price_pro_monthly)
- Annual: $790/year (Price ID: price_pro_annual)
Configure Webhooks
-
Developers > Webhooks → Add endpoint
-
Endpoint URL:
https://yourdomain.com/api/stripe/webhook -
Events to listen:
checkout.session.completedinvoice.paidinvoice.payment_failedcustomer.subscription.updatedcustomer.subscription.deleted
-
Copy Signing secret → set as
STRIPE_WEBHOOK_SECRETin Vercel
Get API Keys
In Settings > API keys:
- Copy Secret key → set as
STRIPE_SECRET_KEY - Copy Publishable key → set as
STRIPE_PUBLISHABLE_KEY
Customer Portal
- Settings > Billing portal settings → Customize
- Enable:
- Switch plans
- Cancel subscriptions
- Update payment methods
- Save customization
4. Resend — Transactional Email
Create API Key
- Go to resend.com
- API Keys → Create
- Copy → set as
RESEND_API_KEYin Vercel
Verify Domain
For custom domain emails (e.g., noreply@yourdomain.com):
- Domains → Add domain
- Add your custom domain
- Add DNS records (CNAME + DKIM)
- Verify once records propagate (10-30 min)
5. Redis (Upstash) — Optional
Create Database
- Go to upstash.com
- Console > Create database
- Region: closest to your Vercel deployment
- Select Single-Zone
Get Connection String
- Copy the REST API URL → set as
UPSTASH_REDIS_REST_URL - Copy the REST token → set as
UPSTASH_REDIS_REST_TOKEN - Keep both secret — used for RBAC cache, rate limiting, realtime
6. Sentry — Error Tracking (Optional)
Create Project
- Go to sentry.io
- Projects → Create Project
- Platform: Next.js
- Alert rule: (keep defaults)
Get DSN
Copy DSN → set as SENTRY_DSN in Vercel
The app automatically captures errors via the Sentry SDK.
Pre-Launch Checklist
Before going live, verify:
- All environment variables set in Vercel
- Supabase migrations deployed (
npx prisma migrate deploy) - Stripe test mode active (use test keys first)
- Stripe webhooks configured and tested
- Resend domain verified (if using custom domain)
- Database backup configured (Supabase → Backups)
- Email templates tested
- Authentication flow tested
- Stripe products match frontend pricing
- Custom domain DNS propagated
- SSL certificate valid (Vercel auto-manages)
- Sentry alerts configured (if enabled)
- Rate limiting tested
- Monitoring/logging in place
Launch to Production
1. Test Payment Flow
- Switch Stripe to Live mode
- Run test payment with real card (will charge $1, auto-refunded)
- Verify webhook delivery in Stripe Dashboard
2. Enable Production in Vercel
- Go to Settings > Git > Production Branch
- Set to
main - All pushes to
mainauto-deploy
3. Monitor First 24 Hours
- Watch Sentry for errors
- Monitor Stripe for failed payments
- Check database performance
- Review logs for anomalies
4. Communication
- Announce launch to early users
- Provide support contact (SUPPORT_EMAIL)
- Monitor customer feedback
Scaling Considerations
As you grow:
- Database: Add read replicas in Supabase
- CDN: Enable Vercel Edge Network for faster delivery
- Redis: Scale connections for high-traffic features
- API: Monitor tRPC performance; consider caching layer
- Email: Monitor Resend quota; consider backup provider
Troubleshooting
Database Connection Timeout
- Check
DIRECT_URLhas correct credentials - Verify Supabase IP whitelist (should be open for Vercel)
- Enable connection pooling (Supisor) for serverless
Stripe Webhooks Not Firing
- Verify endpoint URL is public (not localhost)
- Check STRIPE_WEBHOOK_SECRET matches Stripe Dashboard
- Test with Stripe CLI:
stripe listen --forward-to localhost:3000/api/stripe/webhook
Resend Emails Not Sending
- Verify domain is verified (if using custom domain)
- Check RESEND_API_KEY is correct
- View email logs in Resend Dashboard
Sentry Not Capturing Errors
- Verify SENTRY_DSN is set
- Check that SENTRY_ENVIRONMENT matches deployment
- Ensure errors aren't silently caught without re-throwing
Contact & Support
- Vercel Support: vercel.com/support
- Supabase Docs: supabase.com/docs
- Stripe Docs: stripe.com/docs
- Resend Docs: resend.com/docs