Deployment Guide
This guide covers deploying HiveJournal to production.
Prerequisites
- GitHub repository set up
- Vercel account
- Railway account
- Supabase project
- Stripe account
- Resend account
Frontend Deployment (Vercel)
1. Connect Repository
- Go to Vercel Dashboard
- Click "Add New Project"
- Import your GitHub repository
- Select the
apps/frontenddirectory as the root directory
2. Configure Build Settings
- Framework Preset: Next.js
- Root Directory:
apps/frontend - Build Command:
npm run build(orcd apps/frontend && npm run build) - Output Directory:
.next - Install Command:
npm install(orcd 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
- Go to Project Settings > Domains
- Add
hivejournal.comandwww.hivejournal.com - Follow DNS configuration instructions
Backend Deployment (Railway)
1. Connect Repository
- Go to Railway Dashboard
- Click "New Project"
- Select "Deploy from GitHub repo"
- Choose your repository
2. Configure Service
- Railway should auto-detect the backend
- If not, set the root directory to
apps/backend - Railway will use the
railway.jsonconfiguration
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
- Go to Settings > Networking
- Generate a domain or add a custom domain
- Update
ALLOWED_ORIGINSto 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
- Go to Supabase Dashboard
- Create a new project
- Note your project URL and API keys
2. Run Migrations
- Go to SQL Editor in Supabase
- Copy and run the SQL from
supabase/migrations/001_initial_schema.sql - Verify tables are created
3. Configure Authentication
- Go to Authentication > Settings
- Configure email templates
- Set up OAuth providers if needed
- Configure redirect URLs:
https://hivejournal.com/auth/callbackhttps://www.hivejournal.com/auth/callback
Stripe Setup
1. Create Products
- Go to Stripe Dashboard > Products
- Create subscription products
- Note the Price IDs
2. Configure Webhooks
- Go to Developers > Webhooks
- Add endpoint:
https://your-railway-backend-url.railway.app/api/payment/webhook - Select events:
checkout.session.completedcustomer.subscription.updatedcustomer.subscription.deleted
- Copy the webhook signing secret
Resend Setup
1. Create API Key
- Go to Resend Dashboard > API Keys
- Create a new API key
- Copy the key
2. Verify Domain
- Go to Domains
- Add
hivejournal.com - Follow DNS verification steps
3. Configure Webhook (for incoming emails)
- Go to Webhooks
- Add endpoint:
https://your-railway-backend-url.railway.app/api/email/webhook - Select
email.receivedevent
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
- Frontend: Visit
https://hivejournal.com - Backend: Test health endpoint
https://your-railway-backend-url.railway.app/health - Authentication: Test sign up/sign in flow
- Payments: Test checkout flow (use Stripe test mode)
- 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