operations

Deployment Guide

This guide covers deploying HiveJournal to production.

Prerequisites

  1. GitHub repository set up
  2. Vercel account
  3. Railway account
  4. Supabase project
  5. Stripe account
  6. Resend account

Frontend Deployment (Vercel)

1. Connect Repository

  1. Go to Vercel Dashboard
  2. Click "Add New Project"
  3. Import your GitHub repository
  4. Select the apps/frontend directory as the root directory

2. Configure Build Settings

  • Framework Preset: Next.js
  • Root Directory: apps/frontend
  • Build Command: npm run build (or cd apps/frontend && npm run build)
  • Output Directory: .next
  • Install Command: npm install (or cd apps/frontend && npm install)

3. Environment Variables

Add these environment variables in Vercel:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
NEXT_PUBLIC_API_URL=https://your-railway-backend-url.railway.app
RESEND_API_KEY=your_resend_api_key

4. Custom Domain

  1. Go to Project Settings > Domains
  2. Add hivejournal.com and www.hivejournal.com
  3. Follow DNS configuration instructions

Backend Deployment (Railway)

1. Connect Repository

  1. Go to Railway Dashboard
  2. Click "New Project"
  3. Select "Deploy from GitHub repo"
  4. Choose your repository

2. Configure Service

  1. Railway should auto-detect the backend
  2. If not, set the root directory to apps/backend
  3. Railway will use the railway.json configuration

3. Environment Variables

Add these environment variables in Railway:

PORT=3001
NODE_ENV=production
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
RESEND_API_KEY=your_resend_api_key
RESEND_FROM_EMAIL=noreply@hivejournal.com
ALLOWED_ORIGINS=https://hivejournal.com,https://www.hivejournal.com
JWT_SECRET=your_jwt_secret_key

4. Custom Domain

  1. Go to Settings > Networking
  2. Generate a domain or add a custom domain
  3. Update ALLOWED_ORIGINS to include your backend domain

5. Webhook URLs

After deployment, configure webhooks:

Stripe Webhook:

  • URL: https://your-railway-backend-url.railway.app/api/payment/webhook
  • Events: checkout.session.completed, customer.subscription.updated, customer.subscription.deleted

Resend Webhook:

  • URL: https://your-railway-backend-url.railway.app/api/email/webhook
  • Event: email.received

Supabase Setup

1. Create Project

  1. Go to Supabase Dashboard
  2. Create a new project
  3. Note your project URL and API keys

2. Run Migrations

  1. Go to SQL Editor in Supabase
  2. Copy and run the SQL from supabase/migrations/001_initial_schema.sql
  3. Verify tables are created

3. Configure Authentication

  1. Go to Authentication > Settings
  2. Configure email templates
  3. Set up OAuth providers if needed
  4. Configure redirect URLs:
    • https://hivejournal.com/auth/callback
    • https://www.hivejournal.com/auth/callback

Stripe Setup

1. Create Products

  1. Go to Stripe Dashboard > Products
  2. Create subscription products
  3. Note the Price IDs

2. Configure Webhooks

  1. Go to Developers > Webhooks
  2. Add endpoint: https://your-railway-backend-url.railway.app/api/payment/webhook
  3. Select events:
    • checkout.session.completed
    • customer.subscription.updated
    • customer.subscription.deleted
  4. Copy the webhook signing secret

Resend Setup

1. Create API Key

  1. Go to Resend Dashboard > API Keys
  2. Create a new API key
  3. Copy the key

2. Verify Domain

  1. Go to Domains
  2. Add hivejournal.com
  3. Follow DNS verification steps

3. Configure Webhook (for incoming emails)

  1. Go to Webhooks
  2. Add endpoint: https://your-railway-backend-url.railway.app/api/email/webhook
  3. Select email.received event

DNS Configuration

For hivejournal.com:

Vercel (Frontend)

  • A record or CNAME pointing to Vercel's servers
  • Follow Vercel's DNS instructions

Resend (Email)

  • Add MX records for email receiving
  • Add SPF, DKIM, and DMARC records

Testing Deployment

  1. Frontend: Visit https://hivejournal.com
  2. Backend: Test health endpoint https://your-railway-backend-url.railway.app/health
  3. Authentication: Test sign up/sign in flow
  4. Payments: Test checkout flow (use Stripe test mode)
  5. Webhooks: Test with Stripe CLI and Resend test events

Monitoring

Vercel

  • Monitor deployments in Vercel dashboard
  • Check function logs for serverless functions

Railway

  • Monitor deployments in Railway dashboard
  • Check logs for errors
  • Set up alerts for downtime

Supabase

  • Monitor database usage
  • Check authentication logs
  • Set up database backups

CI/CD

GitHub Actions workflows are configured for:

  • Frontend deployment to Vercel (on push to main)
  • Backend build verification (on push to main)

Railway and Vercel will auto-deploy on push to main branch.

Troubleshooting

Frontend Issues

  • Check Vercel build logs
  • Verify environment variables are set
  • Check Next.js build errors

Backend Issues

  • Check Railway logs
  • Verify environment variables
  • Test API endpoints with curl/Postman
  • Check CORS configuration

Database Issues

  • Check Supabase logs
  • Verify RLS policies
  • Test queries in Supabase SQL editor

Payment Issues

  • Check Stripe webhook logs
  • Verify webhook secret
  • Test with Stripe CLI

Email Issues

  • Check Resend dashboard for delivery status
  • Verify domain is verified
  • Check webhook configuration
DEPLOYMENT — Docs | HiveJournal