# 1. Push code to GitHub
cd server
git add .
git commit -m "CivicStreak backend ready for deployment"
git push origin main
# 2. Go to https://railway.app
# 3. Click "New Project" → "Deploy from GitHub repo"
# 4. Select your repository → select the /server folder
# 5. Add environment variables (copy from .env):PORT=5000
NODE_ENV=production
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
JWT_SECRET=your_jwt_secret
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
GEMINI_API_KEY=your_gemini_key
CLIENT_URL=https://CivicStreak.vercel.app
Add Procfile in server root:
web: node server.js
Add railway.json:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"startCommand": "node server.js",
"healthcheckPath": "/api/health",
"restartPolicyType": "ON_FAILURE"
}
}# 1. Go to https://vercel.com
# 2. Click "New Project" → "Import Git Repository"
# 3. Select your repository
# 4. Set Framework Preset: Next.js
# 5. Set Root Directory: client
# 6. Add environment variables:NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_API_URL=https://your-railway-app.railway.app/api
NEXT_PUBLIC_APP_NAME=CivicStreak
Add client/vercel.json:
{
"framework": "nextjs",
"buildCommand": "npm run build",
"outputDirectory": ".next"
}After deployment, update Twilio webhook URL:
Twilio Console → Messaging → WhatsApp Sandbox → Configuration
WHEN A MESSAGE COMES IN: https://your-railway-app.railway.app/api/whatsapp/webhook
Method: POST
1. Go to Supabase Dashboard → Authentication → URL Configuration
2. Set Site URL: https://CivicStreak.vercel.app
3. Add Redirect URLs:
- https://CivicStreak.vercel.app/**
- http://localhost:3000/**
4. Go to Authentication → Providers → Enable Email
5. (Optional) Enable Phone Auth for OTP login
# Test API health
curl https://your-railway-app.railway.app/api/health
# Expected response:
# {
# "status": "OK",
# "message": "CivicStreak API is running 🏙️",
# "timestamp": "...",
# "version": "1.0.0"
# }
# Test frontend
# Visit: https://CivicStreak.vercel.app
# → Should see landing page
# → Register a new account
# → Complete onboarding
# → Access dashboard
# Test WhatsApp
# Send "Hi" to your Twilio WhatsApp number
# → Should receive daily brief