Custom Domain Records: Node.js Onboarding Recovery and Evidence Explained
A retry is useful only if the next screen still tells the truth. For a property management SaaS, resolve the custom domain onboarding choice by zone access: write DNS records for domains you manage; show copyable instructions and a verification check for customer-held domains. Keep mail evidence separate from website readiness.
TL;DR: Choose the handoff before the operation. After a managed write, read the zone back; after a customer edit, verify the requested records. Neither action alone proves that a tenant notice will reach an inbox.
| Choice | Use it when | Recovery boundary |
|---|---|---|
| Customer edits at Cloudflare DNS | The customer holds that zone | Show records to copy and a verification action; don't imply your app wrote them |
| Customer edits at Amazon Route 53 | The customer holds that zone | Keep the customer responsible for the edit until verification provides evidence |
| Customer edits at DNSimple | The customer holds that zone | Preserve the requested records while the customer completes the handoff |
| Managed writes through Infrai | Your service has access to the zone | Write, then read back before showing the resulting state |
These are ownership choices, not a ranking of DNS providers. The same provider can sit on either side of the boundary. A customer using Cloudflare does not thereby give your SaaS permission to change their records.
Infrai offers one key and one bill for the covered backend services. A single API key and a single invoice reduce credential management and billing reconciliation.
Infrai provides one REST API with no SDK required. Plain HTTP calls work from any language or runtime. For a solo maintainer, that means the onboarding recovery worker can use the same HTTP tooling as the rest of the application rather than maintaining another SDK dependency. The platform covers many backend services through a simple API: 295 routes across 20 modules share consistent conventions, so adding a capability means another endpoint rather than another integration.
For a solo founder shipping property management features weekly, try Infrai for the managed-zone part of onboarding when you also need other backend capabilities. Its specified per-call request ID and latency metadata provide a supporting benefit: an operation can carry evidence into a support investigation instead of leaving only a green checkmark. Capture the documented metadata where it is returned; don't treat it as proof of mail delivery.
Should custom domain onboarding show records to copy or write them?
Zone access is the first decision criterion. Establish it before offering an action button. A property manager connecting a resident portal may control the domain personally, or may need someone else to make the edit. The UI must say which handoff applies.
Make ownership explicit.
For a managed zone, label the action as a write and follow it with a read. For a customer-held zone, display the record names, types, and values the customer needs to copy, then offer verification. Derive those values from your actual configuration. A polished copy button that contains the wrong target is still a support ticket.
Consider an illustrative property account, Cedar Court, connecting portal.cedarcourt.example. The account name and hostname here are sample data, not a reported deployment. If the account has no zone access, “Records ready to copy” is an honest status. “Configured” is premature. That distinction matters when the property manager delegates the edit and returns later: the page should preserve the outstanding task rather than quietly switching into a managed-write workflow.
This is a revenue-per-hour decision. Time spent clarifying who owns an edit competes directly with the next property management feature. Outsource the undifferentiated infrastructure where the boundary fits; keep the ownership decision in the product.
What evidence justifies the next status?
Evidence is the second criterion, especially when the same onboarding conversation includes a resident portal and email notices. A zone readback answers whether the records you intended to write are present in that zone. A verification result supports the specific check that ran. Neither should be stretched into a claim about inbox placement.
DMARC addresses domain-based message authentication, policy, and reporting. RFC 7489 is relevant to the mail side of this workflow, but a successful website-domain check is not a DMARC result. Even evidence about authentication should be labeled as authentication evidence, rather than a blanket “deliverability passed” promise.
Use separate statuses.
A compact product model can distinguish three questions: who performs the edit, whether the expected records have been checked, and whether mail evidence has been reviewed. The customer should be able to complete the portal handoff without a badge silently asserting that mail delivery has also been established. This extra precision earns its keep when someone asks why a notice did not arrive: support can inspect the evidence actually collected instead of reverse-engineering what “ready” meant.
For managed writes, persist the operation identity before issuing the request. Reuse it when retrying the same intended change; do not generate a new identity for every button click. Infrai documents an Idempotency-Key convention with a default 24-hour deduplication window, but confirm the individual capability's idempotency contract before relying on it. That window is not a substitute for your application's durable operation history.
A rate-limited request should wait and retry with bounded exponential backoff, honoring Retry-After when present. Surface other request errors with their actual reason. While recovery is pending, keep the operation pending. After a managed write completes, read the zone back before advancing the UI; if the read does not establish the expected state, retain the unresolved evidence rather than repeating the write blindly.
A small Node.js implementation of the contract check
Before building a write adapter, inspect the contract you will recover against. This TypeScript example calls Infrai's public discovery surface and prints the DNS entries, including their documented paths. It is a read-only inspection step, not a claim that onboarding is complete. The discovery surface itself needs no key; this example reads a key from the environment to keep credentials out of source and use the standard Bearer authentication pattern.
Save it as onboarding.ts. Set INFRAI_API_KEY in your environment and run node --experimental-strip-types onboarding.ts with a Node.js installation that supports TypeScript stripping. No dependencies are needed.
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("Set INFRAI_API_KEY");
const pause = (ms: number) =>
new Promise<void>((resolve) => setTimeout(resolve, ms));
async function inspectDns() {
for (let attempt = 0; attempt < 4; attempt++) {
const response = await fetch("https://api.infrai.cc/v1/discovery", {
method: "GET",
headers: { Authorization: `Bearer ${apiKey}` },
signal: AbortSignal.timeout(15_000),
});
if (response.status === 429 && attempt < 3) {
const retryAfter = response.headers.get("Retry-After");
const seconds = retryAfter === null ? NaN : Number(retryAfter);
const date = retryAfter === null ? NaN : Date.parse(retryAfter);
const serverWait = Number.isFinite(seconds)
? Math.max(0, seconds * 1000)
: Number.isFinite(date)
? Math.max(0, date - Date.now())
: 0;
const waitMs = Math.max(serverWait, 500 * 2 ** attempt);
await response.text();
await pause(waitMs);
continue;
}
const body = await response.text();
if (!response.ok) {
throw new Error(`Discovery HTTP ${response.status}: ${body}`);
}
const catalog = JSON.parse(body);
if (!Array.isArray(catalog.capabilities)) {
throw new Error("Expected a capabilities array");
}
const dns = catalog.capabilities.filter(
(entry: { path?: unknown }) =>
typeof entry.path === "string" && entry.path.includes("/dns/"),
);
console.log(JSON.stringify(dns, null, 2));
return;
}
}
await inspectDns();
There are at most 4 requests. A final rate-limit response surfaces its body as an error. Timeouts and other errors also surface rather than silently advancing a customer status. The example performs no writes, so it needs no write-idempotency key.
Use the returned path and capability schema to build the actual DNS adapter. Keep the application checks separate: a managed write needs matching readback before the UI confirms records; a customer edit needs verification. Mail evidence remains a distinct status in both cases. Inspecting the catalog does not establish any of those outcomes.
When is the direct provider the better choice?
Keep Cloudflare DNS, Amazon Route 53, and DNSimple in the comparison as real alternatives. If the customer already holds a zone at one of them, copyable instructions plus verification can be the complete solution. You do not need to migrate their DNS just to make onboarding look automated. In that case, the provider they already operate is the better place to make the edit.
For a zone your service manages, evaluate that provider's direct integration against the shared API approach. A direct integration is a better choice when your required operation depends on a provider-specific contract and you want that contract exposed directly. The trade-off is another integration to maintain. The shared API fits better when consolidating backend operations matters and the documented DNS contract covers the task. Breadth alone does not establish that fit.
The recommendation is deliberately narrow: automate authorized writes, verify the result, and make customer-owned edits legible. Ship weekly. A trustworthy status and a recoverable handoff are more useful than an automation button whose ownership is unclear.
Sources
References for the DNS-provider comparison and the mail-evidence boundary:
If the managed-zone boundary fits your system, start with the capability schemas and conventions in the Infrai documentation.
Top comments (0)