- DigitalOcean account
- GitHub repository connected to DigitalOcean App Platform
- Environment variables configured
git add .
git commit -m "Add deployment configuration"
git push origin main- Go to DigitalOcean App Platform
- Click "Create App"
- Connect your GitHub repository
- Select the
quickshift-apirepository - Choose the
mainbranch
- Build Command:
npm install && npm run build - Run Command:
npm start - Environment: Node.js
- Node.js Version: 18.x
In the DigitalOcean App Platform console, add these environment variables:
NODE_ENV=production
PORT=8080
MONGODB_URI=your-mongodb-connection-string
JWT_SECRET=your-jwt-secret-key
JWT_REFRESH_SECRET=your-jwt-refresh-secret
SENDGRID_API_KEY=your-sendgrid-api-key
SENDGRID_FROM_EMAIL=noreply@yourdomain.com
STRIPE_SECRET_KEY=your-stripe-secret-key
STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret
FRONTEND_URL=https://your-frontend-domain.com
- In the App settings, go to "Database"
- Create a new MongoDB database
- Note the connection string and add it to MONGODB_URI
# Build the Docker image
docker build -t quickshift-api .
# Run locally for testing
docker run -p 8080:8080 --env-file .env quickshift-api
# Push to DigitalOcean Container Registry
doctl registry login
docker tag quickshift-api registry.digitalocean.com/your-registry/quickshift-api
docker push registry.digitalocean.com/your-registry/quickshift-apiCreate these environment variables in DigitalOcean:
MONGODB_URI: MongoDB connection stringDB_NAME: Database name (optional, can be included in URI)
JWT_SECRET: Secret key for JWT tokensJWT_REFRESH_SECRET: Secret key for refresh tokens
SENDGRID_API_KEY: SendGrid API key for email notificationsSENDGRID_FROM_EMAIL: Email address for sending emails
STRIPE_SECRET_KEY: Stripe secret keySTRIPE_WEBHOOK_SECRET: Stripe webhook endpoint secret
NODE_ENV: Set to "production"PORT: Set to "8080" (DigitalOcean default)FRONTEND_URL: Your frontend application URL
- Create a MongoDB database in DigitalOcean
- Use the provided connection string
- Add your app's IP to trusted sources
- Create a cluster on MongoDB Atlas
- Whitelist DigitalOcean IPs:
0.0.0.0/0(or specific ranges) - Get connection string and add to environment variables
-
Test the API endpoints:
curl https://your-app-name.ondigitalocean.app/api/health
-
Create Super Admin (if needed): Access the console and run:
npm run create-super-admin
-
Set up webhooks:
- Configure Stripe webhooks to point to:
https://your-app-name.ondigitalocean.app/api/webhooks/stripe
- Configure Stripe webhooks to point to:
-
Node.js Version Mismatch:
- Ensure
.nvmrcfile specifies Node.js 18.x - Check
enginesin package.json
- Ensure
-
Missing Environment Variables:
- Verify all required environment variables are set
- Check for typos in variable names
-
Database Connection Issues:
- Verify MongoDB URI is correct
- Check database user permissions
- Ensure IP whitelist includes DigitalOcean ranges
-
Build Command Failures:
- Check that all dependencies are listed in package.json
- Ensure build script runs successfully locally
-
View Application Logs:
- Go to DigitalOcean App Platform dashboard
- Click on your app → Runtime Logs
-
Health Monitoring:
- Health check endpoint:
/api/health - Monitor response times and error rates
- Health check endpoint:
- Horizontal Scaling: Increase instance count in App Platform
- Vertical Scaling: Upgrade instance size (basic-xxs → basic-xs → basic-s)
- All sensitive data in environment variables
- JWT secrets are strong and unique
- Database has proper authentication
- CORS is configured for production domains
- Rate limiting implemented (if needed)
- HTTPS enforced (automatic with DigitalOcean App Platform)
- Start with
basic-xxsinstances - Use managed database for easier maintenance
- Monitor resource usage and scale as needed
- Consider using DigitalOcean Spaces for file storage if needed
For more help, check the DigitalOcean App Platform documentation or contact support.