Optare v1.0 is now available. Get started →
Deployment
Production Checklist

Production Deployment Checklist

🎯 Quick Start (Choose One)

Vercel (Recommended - 5 minutes)

AWS (30 minutes)

  • Create RDS PostgreSQL database
  • Launch EC2 instance (Ubuntu 22.04)
  • Install Node.js and pnpm
  • Clone repository
  • Configure environment variables
  • Build and start app
  • Set up Nginx + SSL

DigitalOcean (15 minutes)

  • Create PostgreSQL database
  • Connect GitHub repository
  • Add environment variables
  • Deploy
  • Add custom domain

📋 Environment Variables (Copy & Paste)

## Database (Get from Neon console)
DATABASE_URL=postgresql://user:password@host/database

## Better Auth (Generate random 32+ char string)
BETTER_AUTH_SECRET=your-random-secret-key-here

## Your production domain
BETTER_AUTH_URL=https://optare.one
PRODUCTION_URL=https://optare.one

## Email service (Get from Resend)
RESEND_API_KEY=re_your_api_key_here

## Optional: Redis for caching
REDIS_URL=redis://your-redis-url

🔐 Security Checklist

  • HTTPS/SSL enabled
  • Environment variables in secrets manager (not in code)
  • Database backups enabled
  • Strong BETTER_AUTH_SECRET (32+ random characters)
  • API keys rotated
  • CORS configured for your domain
  • Rate limiting enabled
  • Monitoring set up

✅ Pre-Deployment Verification

## 1. Build locally
pnpm build
 
## 2. Check for errors
pnpm type-check
 
## 3. Commit changes
git add .
git commit -m "Production ready"
git push origin main
 
## 4. Verify database connection
## (Test with your production DATABASE_URL)

🚀 After Deployment

1. Create Admin User

## SSH into your server or use platform's terminal
pnpm tsx create-admin.ts
 
## Creates:
## Email: admin@optare.one
## Password: admin123

2. Access Admin Dashboard

https://optare.one/admin
Login: admin@optare.one
Password: admin123

3. Create Test Product

  • Go to Admin → Products
  • Click "Create Product"
  • Name: "Pro Plan"
  • Save

4. Create Test Organization

5. Test OAuth Integration

  • Go to Portal → OAuth Clients
  • Create OAuth client
  • Get Client ID and Secret
  • Test "Sign in with Optare" flow

📊 Recommended Setup

Database: Neon

Hosting: Vercel

Email: Resend

Redis: Upstash

Total Cost: $0-65/month (free tier) or $45-100/month (production)


🎯 Deployment Decision Tree

Do you want the easiest setup?
├─ YES → Use Vercel (5 minutes)
└─ NO → Continue

Do you want full control?
├─ YES → Use AWS (30 minutes)
└─ NO → Use DigitalOcean (15 minutes)

📞 Common Issues & Fixes

"Database connection failed"

  • Check DATABASE_URL is correct
  • Verify database is running
  • Check firewall allows connections
  • Test with: psql $DATABASE_URL

"Build failed"

  • Run pnpm build locally
  • Check for TypeScript errors
  • Verify all dependencies installed
  • Check Node.js version (18+)

"App won't start"

  • Check environment variables set
  • Check port 3000 is available
  • Check logs: pm2 logs optare
  • Verify BETTER_AUTH_SECRET is set

"SSL certificate error"

  • Verify domain DNS points to server
  • Wait for DNS propagation (5-30 min)
  • Renew certificate: certbot renew
  • Check certificate: openssl s_client -connect optare.one:443

🎉 Success Indicators

✅ App loads at https://optare.one (opens in a new tab) ✅ Login page displays ✅ Can sign up new user ✅ Can log in ✅ Can access admin dashboard ✅ Can access portal ✅ Can create OAuth client ✅ OAuth flow works


📈 Next Steps

  1. Deploy using your chosen platform
  2. Create admin user with pnpm tsx create-admin.ts
  3. Test login/logout flows
  4. Create test product in admin
  5. Test OAuth integration
  6. Monitor application performance
  7. Set up backups and monitoring
  8. Document your setup

💡 Pro Tips

  1. Use environment variables - Never hardcode secrets
  2. Enable backups - Automate daily database backups
  3. Monitor errors - Set up Sentry or similar
  4. Track performance - Use New Relic or similar
  5. Test thoroughly - Test all flows before going live
  6. Have a rollback plan - Know how to revert if needed
  7. Document everything - Keep setup notes for team

🚀 Ready to Deploy?

Choose your platform and follow the guide in PRODUCTION_DEPLOYMENT.md

Questions? Check the troubleshooting section or review the detailed deployment guide.

Good luck! 🎯