Skip to content

Modal.Domain reference

Source: packages/modal/src/Domain.ts

A custom domain for Modal web endpoints, sandbox tunnels (customDomain on create) and model endpoints. Create the records in dnsRecords at your DNS provider; Modal issues the certificate once they resolve.

alchemy.run.ts
import * as Modal from "@alchemy.run/modal";
import * as Alchemy from "alchemy";
import * as Effect from "effect/Effect";
export default Alchemy.Stack(
"Agents",
{ providers: Modal.providers() },
Effect.gen(function* () {
const agents = yield* Modal.Domain("Agents", { domainName: "agents.example.com" });
return { records: agents.dnsRecords, certificate: agents.certificateStatus };
}),
);
const sandbox = yield* sandboxes.create({
encryptedPorts: [3000],
customDomain: "agents.example.com",
});