This checklist ensures a safe and successful deployment of the Campaign Architecture Redesign (v2.0) to production.
Pre-Deployment Phase
1. Code Review & Testing
- [ ] All Phase 1-9 tasks completed (verify in
TendSocial_Implementation_Checklist.md) - [ ] Full test suite passesbash
cd apps/backend pnpm test - [ ] TypeScript compilation succeedsbash
cd apps/backend pnpm build - [ ] No linting errorsbash
cd apps/backend pnpm lint
2. Database Migration Review
[ ] Review all pending migrations
bashcd apps/backend ls -la prisma/migrations[ ] Verify migration SQL correctness
- Check latest migration:
20251130034654_tend_social_campaign_architecture_plan_v2 - Ensure all tables, indexes, and foreign keys are correct
- Verify no destructive operations without proper safeguards
- Check latest migration:
[ ] Test migration on development database
bashpnpm db:migrate[ ] Verify Prisma client generation
bashpnpm generate
3. Environment & Configuration
[ ] Verify production environment variables
DATABASE_URL(Neon/Postgres connection string)AI_GATEWAY_ADAPTER(default:vercel-ai-sdk)ANTHROPIC_API_KEYGOOGLE_AI_API_KEYOPENAI_API_KEYAI_CONFIG_CACHE_TTL(default:60)AI_GATEWAY_CACHE_TTL(default:300)JOBS_ENABLED(default:true)
[ ] Verify Google Cloud configuration
- Cloud Run service:
tendsocial-api - Region:
us-central1 - Cloud Tasks queue:
tendsocial-tasks
- Cloud Run service:
[ ] Verify Vercel configuration
- Dashboard app:
apps/frontend - Marketing site:
apps/marketing VITE_API_URLpoints to Cloud Run URL
- Dashboard app:
4. Backup & Rollback Preparation
[ ] Create production database backup
bash# Neon database backup via dashboard or CLI # Or use pg_dump if direct access pg_dump $DATABASE_URL > backup_$(date +%Y%m%d_%H%M%S).sql[ ] Verify backup integrity
- Download backup file
- Check file size > 0
- Optionally test restore on staging
[ ] Review rollback plan (
rollback-plan.md)[ ] Tag current production release
bashgit tag -a v2.0-pre-campaign-arch -m "Pre-Campaign Architecture Deployment" git push origin v2.0-pre-campaign-arch
5. Communication
[ ] Schedule maintenance window (if needed)
- Most migrations are non-blocking
- Consider off-peak hours for safety
[ ] Notify team of deployment
- Engineering team
- Support team
- Stakeholders
Deployment Phase
6. Database Migration
[ ] Run migration deployment script
bashcd scripts bash deploy-migrations.sh[ ] Verify migration success
- Check for error messages
- Verify all migrations applied
[ ] Seed AI Model Configurations
bashcd apps/backend pnpm db:seed[ ] Verify seed data
sqlSELECT task, provider, model FROM "AIModelConfig";Expected: 7 rows (campaign_planning, social_posts, blog_writing, video_script, image_generation, profile_analysis, performance_analysis)
7. Application Deployment
[ ] Build and push API container
bash# From root directory gcloud auth configure-docker gcr.io docker build -f apps/backend/Dockerfile -t gcr.io/tendsocial/tendsocial-api:v2.0 . docker push gcr.io/tendsocial/tendsocial-api:v2.0[ ] Deploy to Cloud Run
bashgcloud run deploy tendsocial-api \ --image gcr.io/tendsocial/tendsocial-api:v2.0 \ --region us-central1 \ --platform managed \ --allow-unauthenticated[ ] Deploy frontend apps
bash# Dashboard pnpm --filter @tendsocial/frontend exec vercel deploy --prod # Marketing site pnpm --filter @tendsocial/marketing exec vercel deploy --prod
8. Post-Deployment Verification
[ ] Run deployment verification script
bashcd apps/backend tsx src/scripts/verify-deployment.ts[ ] Run smoke tests
bashtsx src/scripts/smoke-tests.ts[ ] Manual verification
- [ ] Health check:
https://tendsocial-api-xyz.run.app/health - [ ] Admin UI: Login and verify AI Config page loads
- [ ] Create test campaign
- [ ] Generate test social post with campaign context
- [ ] Verify post has
campaignIdandgenerationContext
- [ ] Health check:
Post-Deployment Phase
9. Monitoring Setup
[ ] Verify error logging
bashgcloud logging read "resource.type=cloud_run_revision AND resource.labels.service_name=tendsocial-api AND severity>=ERROR" --limit 10[ ] Monitor AI costs
sqlSELECT DATE(created_at) as date, SUM(total_cost_cents) / 100 as cost_usd FROM "AIUsageLog" WHERE created_at >= NOW() - INTERVAL '1 day' GROUP BY date;[ ] Monitor job execution
sqlSELECT status, COUNT(*) FROM "ProfileAnalysisJob" WHERE "createdAt" >= NOW() - INTERVAL '1 day' GROUP BY status; SELECT status, COUNT(*) FROM "PerformanceSyncJob" WHERE "createdAt" >= NOW() - INTERVAL '1 day' GROUP BY status;[ ] Set up cost alerts (run
tsx src/scripts/cost-alerts.ts)[ ] Configure monitoring alerts
- Error rate > 5% over 5 minutes
- Latency p99 > 5 seconds
- Daily AI cost > $50
10. Team Notification
- [ ] Announce successful deployment to team
- [ ] Share monitoring dashboard links
- [ ] Review training guide with support team
- [ ] Schedule follow-up review (1 week post-deployment)
Beta Period Setup
11. Feature Flags & A/B Testing
- [ ] Enable campaign-centric features
- [ ] Create first A/B testbash
tsx src/scripts/create-ab-test.ts - [ ] Verify A/B test assignmentssql
SELECT "variantName", COUNT(*) FROM "AIABAssignment" WHERE "testId" = '<test-id>' GROUP BY "variantName";
12. Support Team Readiness
- [ ] Conduct training session (use
training-guide.md) - [ ] Provide admin dashboard access
- [ ] Review common troubleshooting scenarios
- [ ] Schedule follow-up training (2 weeks)
Rollback Criteria
If any of the following occur, execute the rollback plan immediately:
- ❌ Error rate exceeds 10%
- ❌ Critical functionality broken (auth, content generation, publishing)
- ❌ Database corruption detected
- ❌ AI costs spike unexpectedly (>200% of baseline)
- ❌ Job processing completely fails
See rollback-plan.md for detailed rollback procedures.
Checklist Owner: _____________________
Deployment Date: _____________________
Sign-off: _____________________