14 KiB
ShopList Deployment Checklist & Guide
Overview
This guide walks you through deploying ShopList backend to AWS and frontend to your family's devices.
Time estimate: 1-2 hours for backend, 30-45 min per platform for frontend
Phase 1: Pre-Deployment Setup (15 min)
Prerequisites
- AWS account created (https://aws.amazon.com)
- AWS credentials configured locally (
aws configure) - Git repository initialized and pushed to GitHub
- Node.js/bun installed
- Docker installed (for local database testing)
Create AWS IAM User
# AWS Console Steps:
1. Go to AWS Console → IAM → Users
2. Create new user "shoplist-deployer"
3. Attach policies:
- AmazonEC2FullAccess
- AWSLambdaFullAccess
- AmazonRDSFullAccess
- AmazonElastiCacheFullAccess
- IAMFullAccess
- CloudWatchFullAccess
4. Generate access key
5. Run: aws configure
6. Enter credentials
Optional: Get API Keys
- OpenRouter account (for AI suggestions)
- Sign up: https://openrouter.ai
- Create API key (free tier available)
- Save for later
Phase 2: Backend Deployment (45 min)
Step 1: Start Deployment Wizard
bun run deploy
This will prompt you for:
- Environment (development/staging/production)
- AWS region
- Custom domain (or skip for auto-generated)
- Whether to enable Redis caching
- Database name
Step 2: Set Up Secrets
The wizard will ask for:
- Generate new
BETTER_AUTH_SECRET(auto-generated) - OpenRouter API key (optional, can add later)
Step 3: Review Pre-Deployment Checklist
# Files created by wizard:
cat .deployment/config.json # Your configuration
cat apps/api/.env.production # Backend environment
cat .deployment/CHECKLIST.md # Full checklist
Step 4: Deploy to AWS
# Wizard will run this automatically
bunx sst deploy --stage prod
What this does:
- Creates VPC for network isolation
- Spins up PostgreSQL database
- Creates Redis cache cluster
- Sets up S3 bucket
- Deploys Next.js API to Lambda
- Sets up API Gateway
- Configures CloudWatch logging
Expected output:
Outputs:
api:
url: https://abc123.lambda-url.us-east-1.on.aws
domain: api.shoplist.yourdomain.com (if configured)
database:
host: shoplist-db-prod.xxxxx.us-east-1.rds.amazonaws.com
port: 5432
name: shoplist
Step 5: Save Deployment Outputs
# Outputs are saved to:
cat .deployment/outputs.txt
# Also check CloudFormation stack:
aws cloudformation describe-stacks --stack-name shoplist-prod
Step 6: Test Backend API
# Get your API URL from outputs above
API_URL="https://your-api-url"
# Test health endpoint
curl $API_URL/api/health
# Test auth endpoint
curl -X POST $API_URL/api/auth/sign-in/email \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123"}'
# Test WebSocket (requires wscat)
npm install -g wscat
wscat -c ws://your-api-url/api/ws?userId=test&householdId=test
Step 7: Monitor Logs
# View Lambda logs
bunx sst logs --stage prod
# Or use AWS CLI
aws logs tail /aws/lambda/shoplist-prod-ShopListAPI --follow
# View database logs
aws rds describe-db-logs --db-instance-identifier shoplist-prod
# View CloudWatch metrics
aws cloudwatch get-metric-statistics \
--namespace AWS/Lambda \
--metric-name Duration \
--statistics Average \
--start-time 2024-01-01T00:00:00Z \
--end-time 2024-01-01T23:59:59Z \
--period 3600
Troubleshooting Backend Deployment
"Insufficient IAM permissions"
- Add more permissions to IAM user
- Check
~/.aws/credentialsfor right profile
"Database connection failed"
- Check security group allows inbound 5432
- Verify VPC configuration
- Check
.envDATABASE_URL is correct
"API not responding"
- Check CloudWatch logs for errors
- Verify API Gateway is created
- Check Lambda role has VPC access
Phase 3: Frontend Deployment - iOS (30-45 min)
Step 1: Install EAS CLI
npm install -g eas-cli
# or
brew install eas-cli
Step 2: Create Apple ID (if needed)
- Go to appleid.apple.com
- Create free Apple ID
- Note: No $99 developer account needed!
Step 3: Link EAS Project
cd apps/mobile
eas init --id your-unique-project-id
Step 4: Build for TestFlight (Recommended)
bun run build:ios
# Or manually:
eas build --platform ios --testflight
Build options:
bun run build:ios # Build & submit to TestFlight
bun run build:ios:dev # Development build for simulator
bun run scripts/build-ios.ts --preview # Preview build
Step 5: Submit to TestFlight
The build script will guide you through App Store Connect:
- Go to appstoreconnect.apple.com
- Select ShopList app
- Go to TestFlight tab
- Find your build (v1.0.1, v1.0.2, etc.)
- Fill in "What to Test" section
- Click "Send for Review"
Step 6: Invite Family to TestFlight
Once build is approved (24-48 hours):
- In TestFlight tab, create a group
- Add family members' email addresses
- They receive invite link
- They tap link → Open in TestFlight → Install
Step 7: Share TestFlight Link
After family installs once:
- Option 1: Use public TestFlight link for future builds
- Option 2: Continue sending email invites
- Builds auto-refresh for existing testers
Phase 4: Frontend Deployment - Android (30-45 min)
Step 1: Build APK
bun run build:android
# Or manually:
eas build --platform android
Step 2: Get Download Link
After build completes, you'll receive:
- Direct APK download link
- Or QR code to scan
Step 3: Share with Family
Choose distribution method:
Option A: Direct Link
Share link via:
- Email
- Text message
- WhatsApp
- Family chat app
Option B: File Upload Service
Upload APK to:
- Google Drive (share link)
- Dropbox (share link)
- GitHub Releases (attach file)
- Your own server
Option C: QR Code
- Take screenshot of QR code
- Share via messaging
- Family scans with phone camera
- Opens download link
Step 4: Family Installation Steps
Send family these instructions:
1. Download APK from link
2. On your phone, go to Settings → Security
3. Find "Unknown sources" or "Install from unknown sources"
4. Tap ON (allow installation from unknown apps)
5. Go to Downloads folder
6. Tap the APK file
7. Tap "Install"
8. Done! App appears on home screen
Step 5: Updates
For future updates:
# Make code changes
bun run build:android
# Share new APK link
# Family repeats steps 1-7 above
Or implement in-app updates:
- Check for new version on startup
- Download and prompt user
- Auto-install on next launch
Phase 5: Post-Deployment Setup (15 min)
Step 1: Configure Custom Domain (Optional)
# If you have a domain (e.g., api.shoplist.com):
# Update Route 53 DNS records
aws route53 change-resource-record-sets \
--hosted-zone-id YOUR_ZONE_ID \
--change-batch file://dns-changes.json
# Update backend environment
export BETTER_AUTH_URL=https://api.shoplist.com
bunx sst deploy --stage prod
Step 2: Set Up Monitoring
# Create CloudWatch alarms
aws cloudwatch put-metric-alarm \
--alarm-name shoplist-api-errors \
--alarm-description "Alert on API errors" \
--metric-name Errors \
--namespace AWS/Lambda \
--statistic Sum \
--period 300 \
--threshold 10 \
--comparison-operator GreaterThanThreshold
# Set up email notifications
aws sns create-topic --name shoplist-alerts
aws sns subscribe --topic-arn arn:aws:sns:us-east-1:xxx:shoplist-alerts \
--protocol email \
--notification-endpoint your-email@example.com
Step 3: Enable Database Backups
# Automated backups (AWS RDS)
aws rds modify-db-instance \
--db-instance-identifier shoplist-prod \
--backup-retention-period 7 \
--apply-immediately
# Manual backup
aws rds create-db-snapshot \
--db-instance-identifier shoplist-prod \
--db-snapshot-identifier shoplist-backup-$(date +%Y%m%d)
Step 4: Set Up Application Logs
# Create CloudWatch log group
aws logs create-log-group --log-group-name /shoplist/api
# Set retention policy
aws logs put-retention-policy \
--log-group-name /shoplist/api \
--retention-in-days 30
Step 5: Configure CORS (if needed)
Update apps/api/lib/middleware.ts:
const allowedOrigins = ['https://yourfamily.com', 'https://app.shoplist.com'];
app.use(
cors({
origin: allowedOrigins,
credentials: true,
})
);
Phase 6: Testing (30 min)
Backend Testing
# Test database connection
curl -X POST https://your-api-url/api/auth/sign-up \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "TestPassword123!",
"name": "Test User"
}'
# Test WebSocket
wscat -c wss://your-api-url/api/ws?userId=user1&householdId=household1
# Test AI suggestions
curl -X POST https://your-api-url/api/ai/suggest \
-H "Content-Type: application/json" \
-d '{"itemName": "Milk"}'
Mobile Testing - iOS
# On your iPhone:
1. Install from TestFlight
2. Sign in with test account
3. Create test household
4. Add test items
5. Check item off
6. On another device, verify sync works
Mobile Testing - Android
# On your Android phone:
1. Install APK
2. Sign in with test account
3. Create test household
4. Add test items
5. Check item off
6. On another device, verify sync works
Real-Time Sync Testing
# Open list on 2+ devices
# Device A: Check item → Should appear checked on Device B instantly
# Device B: Add item → Should appear on Device A instantly
# Disconnect WiFi on Device A → Reconnect → Verify sync catches up
Phase 7: Launch to Family (10 min)
Send Launch Email
Subject: ShopList is Ready - Install Now!
Hi Family,
ShopList is ready to use! Here's how to install:
For iPhone:
1. Click this link: [TestFlight Link]
2. Tap "Open in TestFlight"
3. Tap "Install"
For Android:
1. Download: [APK Download Link]
2. Open Settings → Security → Unknown sources ON
3. Tap the APK file
4. Tap Install
Questions? See: [DEPLOYMENT_GUIDE.md Link]
Let me know if you have any issues!
Family Onboarding
- Test with first family member
- Gather feedback
- Fix any issues
- Roll out to rest of family
Phase 8: Maintenance & Updates
Weekly
# Check logs for errors
bunx sst logs --stage prod --since 7d
# Monitor database size
aws rds describe-db-instances \
--db-instance-identifier shoplist-prod
# Check API response times
# In AWS CloudWatch dashboard
Monthly
# Create database backup
aws rds create-db-snapshot \
--db-instance-identifier shoplist-prod \
--db-snapshot-identifier shoplist-backup-$(date +%Y%m%d)
# Review and trim logs
aws logs put-retention-policy \
--log-group-name /shoplist/api \
--retention-in-days 30
# Check costs
aws ce get-cost-and-usage \
--time-period Start=$(date -u -d '-30 days' +%Y-%m-%d),End=$(date -u +%Y-%m-%d) \
--granularity MONTHLY \
--metrics BlendedCost
As Needed - Deploy Updates
# Make code changes
git commit -m "feat: add new feature"
git push
# Deploy backend
bun run deploy
# Build and deploy iOS
bun run build:ios
# Build and deploy Android
bun run build:android
# Notify family of updates
Troubleshooting Guide
Backend Issues
"WebSocket connection refused"
- Check API Gateway WebSocket route configured
- Verify Lambda has VPC security group permissions
- Check client URL is correct (wss:// not ws://)
"Database connection timeout"
- Verify RDS security group allows 5432
- Check DATABASE_URL environment variable
- Test connection:
psql -h $DATABASE_URL
"Lambda timeout after 30 seconds"
- Check for slow database queries
- Increase Lambda timeout in sst.config.ts
- Profile with CloudWatch X-Ray
Mobile Issues
"Cannot install iOS build"
- Verify Apple ID is correct
- Check device OS version ≥ iOS 14
- Force restart TestFlight app
"Cannot install Android APK"
- Check "Unknown sources" is enabled in Security
- Verify APK downloaded completely
- Try downloading again if corrupted
"Real-time sync not working"
- Check WebSocket URL is correct
- Verify EXPO_PUBLIC_API_URL in .env
- Check browser console for errors
- Test with:
wscat -c $YOUR_WS_URL
Quick Reference Commands
# Deployment
bun run deploy # Start wizard
bunx sst deploy --stage prod # Deploy backend
bunx sst logs --stage prod # View logs
# iOS
bun run build:ios # Build for TestFlight
bun run build:ios:dev # Dev build
# Android
bun run build:android # Build APK
bun run build:android:play # Build for Play Store
# Testing
curl https://api.shoplist.com/api/health
wscat -c wss://api.shoplist.com/api/ws?userId=test&householdId=test
# Monitoring
aws logs tail /aws/lambda/shoplist-prod-ShopListAPI --follow
aws cloudwatch get-metric-statistics --namespace AWS/Lambda
# Database
aws rds describe-db-instances --db-instance-identifier shoplist-prod
aws rds create-db-snapshot --db-instance-identifier shoplist-prod
Success Criteria
✅ Backend deployed and API responding
✅ Database connected and accepting queries
✅ WebSocket endpoint accessible
✅ iOS app installed on at least 1 device
✅ Android app installed on at least 1 device
✅ Real-time sync working between devices
✅ Family members can sign in
✅ Family members can add items
✅ Family members can check off items
✅ Changes sync in real-time across devices
✅ App works offline (with sync on reconnect)
✅ Monitoring and logs configured
Support & Resources
- Documentation:
/docsfolder - Issue Tracking: GitHub Issues
- AWS Support: AWS Management Console
- Expo Support: https://docs.expo.dev
- SST Docs: https://docs.sst.dev
Estimated Costs (AWS)
| Service | Monthly |
|---|---|
| Lambda (API) | $1-5 |
| RDS (t3.micro) | $15-30 |
| Redis (cache.t3.micro) | $15-25 |
| NAT Gateway | $32 |
| Data transfer | $0-10 |
| Total | ~$63-102 |
Prices estimated for family use. May vary by region.
🎉 You're ready to deploy! Start with bun run deploy