Answers/How do I set up staging and production environments?

How do I set up staging and production environments?

Updated March 2026

Use multiple subdomains as separate environments. Create myapp.sutrena.com for production and myapp-staging.sutrena.com for staging. Deploy and test on the staging subdomain first, then promote to production.

Subdomains are unlimited on all plans, so you can create as many environments as you need: production, staging, preview, QA, demo.

The key feature: custom domains can be re-pointed between subdomains instantly with PATCH /api/account/domains/:id. Point myapp.com at your production subdomain. When you want to do a canary deploy, switch it to staging. Need to rollback? Switch it back. No DNS changes, no SSL re-provisioning, no propagation wait. The switch is instant.

Workflow: 1. Create subdomains: myapp (prod), myapp-staging (staging) 2. Deploy pages to myapp-staging.sutrena.com 3. Preview and verify at the staging URL 4. Deploy the same content to myapp.sutrena.com (or switch the domain) 5. Point myapp.com at the production subdomain

This works with the REST API, MCP tools, and CI/CD pipelines. Agents can automate the entire flow.

# Create staging subdomain
curl -X POST https://sutrena.com/api/account/subdomains \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "myapp-staging"}'

# Deploy to staging
curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug": "index", "title": "My App", "html": "<h1>New version</h1>", "subdomainId": "STAGING_ID"}'

# Switch custom domain from prod to staging (instant)
curl -X PATCH https://sutrena.com/api/account/domains/DOMAIN_ID \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"subdomainId": "STAGING_ID"}'

# Rollback to production (instant)
curl -X PATCH https://sutrena.com/api/account/domains/DOMAIN_ID \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"subdomainId": "PROD_ID"}'

Ready to build?

Get a trial API key instantly — no signup required.

How to set up staging and production environments — Sutrena | Sutrena