Skip to content

DigitalOcean.Domains reference

Source: packages/digitalocean/src/Domain.ts

A domain hosted on DigitalOcean DNS. DigitalOcean creates its SOA and NS records; add the rest with DomainRecord. Destroying the domain deletes every record in it.

A domain has no tags. Alchemy owns a domain it recorded; one that already exists on the team is Unowned and needs --adopt.

const domain = yield* DigitalOcean.Domain("example", { name: "example.com" });
const host = yield* DigitalOcean.Droplet("app", {
region: "sfo3",
size: "s-1vcpu-1gb",
image: "ubuntu-24-04-x64",
});
yield* DigitalOcean.DomainRecord("apex", {
domain: domain.name,
type: "A",
name: "@",
data: host.ipv4,
});

Source: packages/digitalocean/src/DomainRecord.ts

A DNS record in a domain hosted on DigitalOcean. name, data, ttl and the type-specific fields update in place; domain and type replace the record.

A record has no tags. Alchemy finds a record it recorded by id, and after a lost deploy by an exact match of name, type and value.

const domain = yield* DigitalOcean.Domain("example", { name: "example.com" });
const host = yield* DigitalOcean.Droplet("app", {
region: "sfo3",
size: "s-1vcpu-1gb",
image: "ubuntu-24-04-x64",
});
yield* DigitalOcean.DomainRecord("www", {
domain: domain.name,
type: "A",
name: "www",
data: host.ipv4,
ttl: 300,
});

DomainRecord: Mail and Verification Records

Section titled “DomainRecord: Mail and Verification Records”
const domain = yield* DigitalOcean.Domain("example", { name: "example.com" });
yield* DigitalOcean.DomainRecord("mx", {
domain: domain.name,
type: "MX",
name: "@",
data: "mail.example.com.",
priority: 10,
});
yield* DigitalOcean.DomainRecord("spf", {
domain: domain.name,
type: "TXT",
name: "@",
data: "v=spf1 include:_spf.example.com ~all",
});