Guides/Production, staging, and preview environments with subdomains

Production, staging, and preview environments with subdomains

Ship confidently. Preview before you publish. One account, multiple environments.

Updated March 2026

Use Sutrena subdomains as separate environments for your site. Deploy to a staging subdomain, preview changes, then promote to production by switching your custom domain u2014 no DNS changes, no downtime. This pattern works for any static site, landing page, or form-backed app.

1. Create subdomains for each environment

Create separate subdomains for production, staging, and preview. Each subdomain is an independent site with its own pages. Subdomain limits vary by plan: Free gets 1, Pro 10, Scale unlimited.

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

# 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"}'

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

2. Deploy pages to your staging subdomain

Build and test on staging first. Deploy pages using the subdomainId from the staging subdomain. Your staging site is immediately live at myapp-staging.sutrena.com.

# Get your subdomain IDs
curl https://sutrena.com/api/account/subdomains \
  -H "Authorization: Bearer $KEY"

# 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>Welcome to My App</h1><p>New feature goes here</p>",
    "subdomainId": "STAGING_SUBDOMAIN_ID"
  }'

3. Preview and verify at the staging URL

Visit myapp-staging.sutrena.com to review your changes. Share the staging URL with teammates for review. Each environment is fully isolated u2014 changes to staging never affect production.

4. Promote to production

When you are ready, deploy the same pages to your production subdomain. You can copy pages between subdomains, or redeploy from your build pipeline targeting the production subdomainId.

# Deploy the same content to production
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>Welcome to My App</h1><p>New feature goes here</p>",
    "subdomainId": "PROD_SUBDOMAIN_ID"
  }'

5. Point your custom domain to the production subdomain

Add your custom domain and link it to the production subdomain. Your site is now live at both myapp.sutrena.com and myapp.com. The CNAME only needs to be set up once u2014 after that, switching environments is instant via the API.

# Add custom domain linked to production subdomain
curl -X POST https://sutrena.com/api/account/domains \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "myapp.com",
    "subdomainId": "PROD_SUBDOMAIN_ID"
  }'

# Add staging custom domain (optional)
curl -X POST https://sutrena.com/api/account/domains \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "staging.myapp.com",
    "subdomainId": "STAGING_SUBDOMAIN_ID"
  }'

6. Instant rollback or environment switching

The real power: switch which subdomain a custom domain serves from with one API call. No DNS changes, no propagation wait. Point myapp.com to your staging subdomain for a canary deploy, or back to production for an instant rollback. For individual page safety, Sutrena also creates automatic snapshots on every content update. Call POST /api/pages/:id/rollback to revert a single page instantly without switching environments.

# Switch myapp.com to serve from staging (canary deploy)
curl -X PATCH https://sutrena.com/api/account/domains/DOMAIN_ID \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"subdomainId": "STAGING_SUBDOMAIN_ID"}'

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

FAQ

Is there a limit on subdomains?

Yes. Free: 1 subdomain. Pro ($29/mo): unlimited. Scale ($99/mo): unlimited. A typical environment setup (production, staging, preview) uses 3 subdomains, which fits comfortably on the Pro plan.

Do I need separate custom domains for each environment?

No. You can use the free subdomain URLs (myapp-staging.sutrena.com) for non-production environments. Custom domains are optional and primarily useful for your production site. If you want staging.myapp.com, that counts toward your domain quota.

How fast is environment switching?

Instant. PATCH /api/account/domains/:id changes the subdomain association immediately. No DNS propagation, no SSL re-provisioning. The next request to your domain serves from the new subdomain.

Can I use this with AI agents or CI/CD?

Yes. Agents can use sutrena_create_subdomain, sutrena_create_page, and sutrena_update_custom_domain to build a full deploy pipeline. Deploy to a preview subdomain, verify, then switch the production domain u2014 all via API or MCP tools.

What happens to forms across environments?

Forms are account-level, not subdomain-level. If you embed a form on pages across different subdomains, they all submit to the same form and share the same submissions. Use separate forms per environment if you need isolated test data.

What is Sutrena?

Sutrena is the web runtime for AI agents. Forms, Pages, Analytics, Webhooks, Automations — all through 67 MCP tools and one REST API. Your agent creates web artifacts, humans interact with them, and your agent gets the data back. Use any one feature or all of them together.

Pages

Deploy HTML instantly

Forms

Collect structured data

Automations

DSL-based pipelines with 14 step types

Analytics

Privacy-first, no cookies

Webhooks

Slack, Discord, Telegram

Get started in two API calls

1. Get a trial key (no auth, no signup)

curl -X POST https://sutrena.com/api/trial

2. Create anything — a page, form, automation, or analytics site

# Create a form
curl -X POST https://sutrena.com/api/forms \
  -H "Authorization: Bearer st_trial_xxx" \
  -H "Content-Type: application/json" \
  -d '{"name": "waitlist", "fields": [{"name": "email", "label": "Email", "type": "email", "required": true}]}'

# Or deploy a page
curl -X POST https://sutrena.com/api/pages \
  -H "Authorization: Bearer st_trial_xxx" \
  -H "Content-Type: application/json" \
  -d '{"slug": "index", "title": "My Site", "html": "<h1>Live</h1>"}'

Ready to build?

Get a trial API key instantly with no signup, or create an account for the full experience.

Production, Staging & Preview Environments with Subdomains | Sutrena | Sutrena