Skip to main content

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

ServicePurposeURL
MongoDB AtlasManaged databasehttps://cloud.mongodb.com
Fly.ioBackend hostinghttps://fly.io
Cloudflare PagesFrontend hosting (CDN)https://pages.cloudflare.com
GitHubRepo + Actions CI/CD

CLI tools

brew install flyctl
npm install -g wrangler

fly version
wrangler --version

GitHub Secrets

SecretDescription
FLY_API_TOKENFly.io deploy token
CLOUDFLARE_API_TOKENCloudflare API token
CLOUDFLARE_ACCOUNT_IDCloudflare account ID
NPM_TOKENnpm publish token (for SDK)

1. MongoDB Atlas

Create cluster

  1. Go to https://cloud.mongodb.com
  2. Create a New Cluster > M0 (Free Forever)
  3. Provider: AWS, Region: eu-west-1 (Ireland)
  4. Cluster Name: sequenceware-prod

Create database user

  1. Security > Database Access > Add New Database User
  2. Username: sequenceware-app
  3. Password: generate and save
  4. Privileges: Read and write to any database

Configure network access

  1. Security > Network Access > Add IP Address
  2. 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

  1. Go to Cloudflare Dashboard > Workers & Pages > Create
  2. Connect to Git > select the repo
  3. Configure:
    • Build command: cd frontend && npm ci && npx ng build --configuration production
    • Build output directory: frontend/dist/frontend/browser
    • Root directory: /
  4. 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

ComponentPlanCost
MongoDB Atlas M0Free$0/month
Fly.io (1 shared-cpu, 256MB)Free tier$0/month
Cloudflare PagesFree$0/month
GitHub ActionsFree (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