Preview and staging environments on xhostd
A preview or staging environment lets you test a web app change at its own URL before production. On xhostd each one is a channel with its own database.
A preview environment lets you deploy and test a change at a separate URL before it reaches production. In xhostd, each preview or staging environment is called a channel.
A channel is a complete, always-running copy of your app. It has its own address, database, file storage, and domains. You can test a change in a channel, check the result, and then deploy the same commit to production. This article explains what a channel contains, what it does not copy from production, and how to use one to test before production.
What a channel contains
Every app starts with one channel named prod. Each channel is a standalone
container that runs at all times, and it has its own:
- HTTPS address, in the form
<app>-<user>.xhostd.appforprodand<channel>-<app>-<user>.xhostd.appfor every other channel; - S3-compatible file storage;
- custom domains, up to five;
- Postgres database, unless the app is a static site.
Data and files belong to one channel. Because each channel owns its database and its file storage, a preview cannot change production data.
Environment values work differently. A value set for the whole app is a default that every channel shares, previews included. A value set on one channel overrides the default on that channel only.
A preview does not hold a copy of production data. Its database starts empty and runs your migrations. Check the data setup of a preview before you judge a change by what it shows.
Channels are always on
Every channel runs on every plan, with no sleep mode, no scale-to-zero, and no cold start. A reviewer can open a preview link days later and find it running. A background worker in a staging environment keeps working between your visits.
Test a change before production
- Create a channel. Ask your AI coding agent for a channel named after the
change, such as
try-checkout. The channel API documents the call. - Deploy a specific commit. A full commit SHA points at the same code during review and deploy. A branch name resolves when you deploy.
- Test at the returned URL. Check the environment values, the migrations, and the data.
- Deploy the same commit to
prod. - Delete the channel. Deleting it frees a slot in your quota.
This loop suits AI-generated code in particular. An agent can produce a large change quickly, and a preview shows how the app behaves, which a diff does not.
Creating a channel and deploying code are separate operations. For the first deploy of an app, see Deploy a Claude Code app to a live HTTPS URL.
Domains per channel
A channel can carry real domains of its own. Attach staging.example.com to a
staging environment and example.com to prod, and each gets its own
certificate. A hostname belongs to one channel at a time across xhostd. The
custom domains page lists the DNS records.
How many channels you get
Your plan sets one channel quota for the whole account. Every app counts its
prod channel against it, and each extra channel counts too. Three channels can
be three apps, or one app with a production channel and two previews.
| Plan | Channels |
|---|---|
| Basic (free) | 3 |
| Builder | 10 |
| Indie | 20 |
| Studio | 40 |
| Pro | 80 |
The pricing page is the source of truth for these figures. A preview is not a separate billing item. CPU, memory, database storage, and file storage are account totals, so a new channel does not multiply them.
Backups are per channel
Each database-backed channel has its own nightly snapshot and its own snapshot before each deploy, and a restore of one channel never touches another. See Postgres backups and recovery for retention and limits.
Common questions
What is the difference between a preview and a staging environment? In xhostd, none in kind. Both are channels. A staging environment is a long-lived channel that mirrors production, and a preview is a short-lived channel for one change.
Is a channel a real machine? It behaves like one, with its own filesystem, process, storage, and database. It is a container, not a dedicated server.
Does an idle preview cost extra? No. A channel is a quota entry, not a new bill.
Can my coding agent create channels? Yes. Claude Code, Codex, Cursor, and other agents create and deploy to channels through MCP tools or the HTTP API.
For how this compares with running your own servers, see VPS vs. managed application hosting.