Deployment Guide
Deploy the Green Monkey Dashboard to production.
Prerequisites
- Stripe Account β stripe.comΒ
- Email Service β SendGrid, Mailgun, or AWS SES
- Database β Vercel Postgres, Supabase, or any PostgreSQL host
- GitHub Account β For deployment via Vercel
Deploy to Vercel
Step 1: Stripe Setup
- Create an account at dashboard.stripe.comΒ
- Go to Developers β API keys, copy your Secret key and Publishable key
- Set up a webhook:
- Go to Developers β Webhooks β Add endpoint
- URL:
https://your-domain.vercel.app/api/stripe/webhook - Events:
checkout.session.completed - Copy the webhook signing secret
Step 2: Email Service
SendGrid (Recommended β free tier: 100 emails/day)
- Sign up at sendgrid.comΒ
- Create an API key in Settings β API Keys
- Verify your sender email/domain
- Set
SENDGRID_API_KEYin environment variables
Mailgun
- Sign up at mailgun.comΒ
- Get API key from Settings β API Security
- Set
MAILGUN_API_KEYandMAILGUN_DOMAIN
AWS SES
- Set up SES and verify your domain
- Set
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION
Step 3: Database
Vercel Postgres (Recommended)
- Go to Vercel Dashboard β Storage β Create Database β Postgres
- Copy the
POSTGRES_URLconnection string - Vercel automatically sets this as
DATABASE_URL
Supabase
- Create a project at supabase.comΒ
- Go to Project Settings β Database
- Copy the connection string and set as
DATABASE_URL
Railway / Render
- Create a PostgreSQL database
- Copy the connection string
- Set as
DATABASE_URL
Step 4: Deploy
Via GitHub (Recommended)
- Push your code to GitHub
- Go to vercel.comΒ
- Click Import Project
- Select your repository
- Set environment variables (see Step 5)
- Click Deploy
Via Vercel CLI
npm install -g vercel
vercel login
cd greenmonkey-dashboard
vercelStep 5: Environment Variables
Set these in Vercel Dashboard β Settings β Environment Variables:
SECRET_KEY=<generate-random-64-char-string>
BASE_URL=https://your-domain.vercel.app
DATABASE_URL=<your-postgres-connection-string>
STRIPE_SECRET_KEY=sk_live_...
STRIPE_PUBLISHABLE_KEY=pk_live_...
STRIPE_WEBHOOK_SECRET=whsec_...
SENDGRID_API_KEY=SG...Generate a secret key:
import secrets
print(secrets.token_hex(32))Step 6: Initialize Database
After the first deployment:
curl https://your-domain.vercel.app/api/admin/init-dbStep 7: Verify
- Visit your deployed dashboard
- Test login with magic link
- Test buying credits with Stripe test card
4242 4242 4242 4242 - Verify credits are added
Deploy to Heroku
# Install CLI
brew install heroku/brew/heroku
# Login and create app
heroku login
heroku create greenmonkey-dashboard
# Add PostgreSQL
heroku addons:create heroku-postgresql:mini
# Set environment variables
heroku config:set SECRET_KEY=$(python -c 'import secrets; print(secrets.token_hex(32))')
heroku config:set STRIPE_SECRET_KEY=sk_live_...
heroku config:set STRIPE_WEBHOOK_SECRET=whsec_...
heroku config:set SENDGRID_API_KEY=SG...
# Deploy
git push heroku main
# Initialize database
heroku run python init_db.py
# Open
heroku openGoing Live
When youβre ready for production:
- Stripe β Switch from
sk_test_tosk_live_keys. Update webhook endpoint. - Email β Verify sender domain. Remove sandbox mode.
- Database β Upgrade to a paid plan. Set up backups. Enable connection pooling.
- Monitoring β Set up Sentry or similar for error tracking.
Troubleshooting
Magic links not sending
- Check email service API key
- Verify sender email is verified
- Review server logs
Stripe webhooks failing
- Verify webhook secret is correct
- Check webhook URL is accessible
- Review Stripe webhook logs
Database connection errors
- Verify
DATABASE_URLis correct - Check if the database is running
- Ensure firewall allows connections
Credits not added after payment
- Check Stripe webhook logs
- Verify webhook endpoint is working
- Check database for transaction records
Last updated on