Skip to Content
PlatformDomains

Domains

Domains let a StackMachine app answer from your own hostname. Add the hostname to an app, configure the expected DNS records, verify propagation, and optionally mark the hostname as the default app URL.

Features

Custom hostnames

Attach production, staging, or preview hostnames to the app record that serves your workload.

DNS verification

StackMachine returns the records it expects. Add them at your DNS provider, then call verify once propagation is complete.

Default domain selection

Use isDefault when a hostname should be treated as the primary URL for the app.

Common workflow

  1. Create the domain with the app ID and hostname.
  2. Copy the returned DNS records into your DNS provider.
  3. Call client.apps.domains.verify after propagation.
  4. List domains to show the current set of attached hostnames.

SDK examples

Attach and verify a domain

Create a hostname, print the expected DNS records, verify the domain, and list attached hostnames.

domains.js
1
const domain = await client.apps.domains.create({
2
  app: "da_XYZ",
3
  hostname: "www.example.com",
4
  isDefault: true,
5
});
6
 
7
for (const record of domain.expectedDnsRecords) {
8
  console.log(record.host, record.recordType, record.value);
9
}
10
 
11
// Run this after the DNS records have propagated.
12
const verified = await client.apps.domains.verify(domain.id);
13
console.log(domain.hostname, verified);
14
 
15
const domains = await client.apps.domains
16
  .list({ app: "da_XYZ", limit: 10 })
17
  .autoPagingToArray({ limit: 25 });
18
console.log(domains.map((item) => item.hostname));

Source: stackmachine/sdks  JavaScript examples.