Self-Hosted Deployment
Deploy Sequenceware to production with a fully automated CI/CD pipeline.
Architecture
GitHub (push tag v*) → GitHub Actions CI → Build & Push images
→ Deploy backend to Fly.io
→ Deploy frontend to Cloudflare Pages
MongoDB Atlas (managed) ← Backend (Fly.io)
Prerequisites
Accounts
| Service | Purpose | URL |
|---|---|---|
| MongoDB Atlas | Managed database | https://cloud.mongodb.com |
| Fly.io | Backend hosting | https://fly.io |
| Cloudflare Pages | Frontend hosting (CDN) | https://pages.cloudflare.com |
| GitHub | Repo + Actions CI/CD | — |
CLI tools
brew install flyctl
npm install -g wrangler
fly version
wrangler --version
GitHub Secrets
| Secret | Description |
|---|---|
FLY_API_TOKEN | Fly.io deploy token |
CLOUDFLARE_API_TOKEN | Cloudflare API token |
CLOUDFLARE_ACCOUNT_ID | Cloudflare account ID |
NPM_TOKEN | npm publish token (for SDK) |
1. MongoDB Atlas
Create cluster
- Go to https://cloud.mongodb.com
- Create a New Cluster > M0 (Free Forever)
- Provider: AWS, Region: eu-west-1 (Ireland)
- Cluster Name:
sequenceware-prod
Create database user
- Security > Database Access > Add New Database User
- Username:
sequenceware-app - Password: generate and save
- Privileges: Read and write to any database
Configure network access
- Security > Network Access > Add IP Address
- Add
0.0.0.0/0(Fly.io uses dynamic IPs)
Get connection string
mongodb+srv://sequenceware-app:<password>@sequenceware-prod.xxxxx.mongodb.net/sequenceware?retryWrites=true&w=majority
2. Backend on Fly.io
Create app and set secrets
fly auth login
fly apps create sequenceware-demo --org personal
# Required secrets
fly secrets set MONGODB_URI="mongodb+srv://..." --app sequenceware-demo
fly secrets set JWT_SECRET="$(openssl rand -hex 32)" --app sequenceware-demo
# Optional
fly secrets set ADMIN_EMAIL="admin@yourdomain.com" --app sequenceware-demo
fly secrets set ADMIN_PASSWORD="$(openssl rand -base64 16)" --app sequenceware-demo
fly secrets set FRONTEND_BASE_URL="https://sequenceware.pages.dev" --app sequenceware-demo
fly secrets set CORS_ORIGINS="https://sequenceware.pages.dev" --app sequenceware-demo
Deploy
fly deploy --config deploy/fly.toml --dockerfile backend/Dockerfile
Verify
curl https://sequenceware-demo.fly.dev/health
# {"status":"ok","uptime":12.34,"version":"0.1.0","mongo":"connected"}
Get deploy token for CI
fly tokens create deploy --app sequenceware-demo
# Save as GitHub Secret: FLY_API_TOKEN
3. Frontend on Cloudflare Pages
Option A: Connect repo directly (recommended)
- Go to Cloudflare Dashboard > Workers & Pages > Create
- Connect to Git > select the repo
- Configure:
- Build command:
cd frontend && npm ci && npx ng build --configuration production - Build output directory:
frontend/dist/frontend/browser - Root directory:
/
- Build command:
- Environment variables:
NODE_VERSION:20
Option B: Deploy via GitHub Actions
wrangler pages project create sequenceware
Configure API proxy
Create frontend/src/_redirects:
/api/* https://sequenceware-demo.fly.dev/:splat 200
Add to angular.json assets:
{ "glob": "_redirects", "input": "src", "output": "/" }
4. CI/CD Pipeline
How to release
# Ensure main is clean and tests pass
git checkout main && git pull
# Create and push a tag
git tag v1.0.0
git push origin v1.0.0
# GitHub Actions handles the rest:
# 1. CI: lint, typecheck, tests
# 2. Deploy backend to Fly.io
# 3. Deploy frontend to Cloudflare Pages
# 4. Build + push Docker images
# For SDK releases (independent):
git tag sdk-v1.0.0
git push origin sdk-v1.0.0
5. Post-deploy verification
# Backend health
curl https://sequenceware-demo.fly.dev/health
# Frontend loads
curl -I https://sequenceware.pages.dev
# API proxy works
curl https://sequenceware.pages.dev/api/health
# Swagger docs accessible
open https://sequenceware-demo.fly.dev/api/docs
# Login works
curl -X POST https://sequenceware-demo.fly.dev/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@yourdomain.com","password":"your-password"}'
Cost summary
| Component | Plan | Cost |
|---|---|---|
| MongoDB Atlas M0 | Free | $0/month |
| Fly.io (1 shared-cpu, 256MB) | Free tier | $0/month |
| Cloudflare Pages | Free | $0/month |
| GitHub Actions | Free (2000 min/month) | $0/month |
| Total | $0/month |
Next level
Staging environment
fly apps create sequenceware-staging
fly secrets set MONGODB_URI="<staging-uri>" --app sequenceware-staging
fly secrets set JWT_SECRET="$(openssl rand -hex 32)" --app sequenceware-staging
Custom domain
# Backend
fly certs create api.yourdomain.com --app sequenceware-demo
# DNS: CNAME api.yourdomain.com → sequenceware-demo.fly.dev
# Frontend: Cloudflare Dashboard > Custom domains
Monitoring
- Fly.io:
fly dashboard --app sequenceware-demo - MongoDB Atlas: Built-in monitoring dashboard
- Uptime: UptimeRobot pinging
/health