A healthtech tenant subdomain signup flow has several costs: DNS writes, provisioning checks, operational evidence kept for investigation, and the work of recovering an incomplete signup. Start with the retained evidence. In an illustrative planning model, 100 signups per day with 3 retained events each produce 9,000 events over 30 days. Keeping the same events for 7 days produces 2,100. Those are assumptions for sizing, not observed traffic or a vendor quote. The dominant term in that retention model is events per day multiplied by days kept; a cheaper DNS write does nothing to reduce it.

Short answer: provision the tenant subdomain by upserting its CNAME with the stored zone_id during signup, and roll back the new tenant record if the DNS write fails. Keep the destination hostname in configuration. For a Node.js backend sending healthtech OTPs, treat successful provisioning and evidence of mail delivery as separate acceptance checks.

The practical change is to retain a small provisioning decision record instead of collecting every raw response indefinitely. That leaves room to investigate retries without turning an authentication workflow into an archive of sensitive message content.

1. Budget for evidence before retaining every response

The retention arithmetic above describes event volume, not a measured bill. A real cost calculation still needs the event size, storage terms, DNS request terms, and investigation workload. Without those inputs, naming a dominant dollar expense would be guesswork. The useful decision is which evidence earns its retention period.

Keep a proposed audit record narrow: an internal tenant reference, the stored zone reference, the intended hostname and target, the provisioning outcome, and an attempt correlation identifier. These are application audit fields, not a provider request schema. An OTP value, patient name, appointment detail, or complete message body adds little to the question of whether signup attempted the intended DNS change. Exclude them from this record.

Keep the evidence small.

A retry should reuse the same logical tenant identity and CNAME destination. Upsert makes that repeated DNS operation harmless instead of turning an existing record into a duplicate-record error. Retention then answers a concrete question: did these attempts belong to one signup, and did they reach a successful provisioning decision? Counting every retry as a new tenant would distort both that evidence and the operational metric.

2. What does a tenant subdomain CNAME upsert prove during signup?

It establishes the provisioning result for that record. It doesn't, by itself, establish that a healthtech OTP reached a mailbox. The signup CNAME and the SPF, DKIM, and DMARC work belong to the same launch checklist, but they answer different questions. Don't turn one successful DNS operation into a claim about all of them.

For the mail work, record which sending domain is being assessed and keep authentication and delivery evidence attached to that identity. RFC 7489 describes DMARC's relationship to SPF and DKIM and its reporting framework. Use that framework to interpret mail evidence; a tenant application's CNAME is not a substitute for it. An authentication result also shouldn't be presented as proof of inbox placement.

The acceptance rule should be explicit: fail signup on a definite DNS write failure, because an accepted tenant with an unreachable application is an avoidable operational burden. Separately, require the intended mail evidence before describing OTP delivery as ready. A DNS operation succeeding while that evidence remains insufficient is a reason to withhold the delivery claim. It is not evidence of a DNS provider defect. Consider a proposed acceptance test with a tenant CNAME targeting the configured application hostname and no mail authentication evidence yet attached to the sending domain. The application provisioning check can pass. The delivery readiness check must remain unproven. Keeping those decisions separate prevents a green signup dashboard from becoming an unsupported promise to the team responsible for OTPs.

Record both decisions.

This distinction matters during incident review. A flat provisioning metric sends the investigation toward signup. A completed provisioning decision alongside missing mail evidence calls for a different investigation. Neither signal needs patient content to be useful.

3. Exercise the transaction boundary in a runnable model

A Node.js implementation needs a database transaction around the tenant write and the awaited DNS upsert, with a rejected upsert causing rollback. The Python model below makes that control flow executable using only the standard library. Its dictionary is a local DNS test double; it makes no network requests and defines no vendor payload. Run it with Python 3.

import sqlite3 class LocalDNS: def __init__(self): self.records = {} self.reject_next = False def upsert(self, zone_id, hostname, target): if self.reject_next: self.reject_next = False raise RuntimeError("Simulated DNS rejection") self.records[(zone_id, hostname)] = target def signup(db, dns, tenant_id, zone_id, hostname, target): with db: db.execute( "INSERT OR IGNORE INTO tenants VALUES (?, ?)", (tenant_id, hostname), ) dns.upsert(zone_id, hostname, target) db = sqlite3.connect(":memory:") db.execute( "CREATE TABLE tenants " "(id TEXT PRIMARY KEY, hostname TEXT UNIQUE NOT NULL)" ) dns = LocalDNS() settings = {"target_hostname": "app.example"} args = ("tenant-a", "zone-a", "tenant-a.example", settings["target_hostname"]) signup(db, dns, *args) signup(db, dns, *args) assert db.execute("SELECT COUNT(*) FROM tenants").fetchone()[0] == 1 assert len(dns.records) == 1 dns.reject_next = True try: signup(db, dns, "tenant-b", "zone-a", "tenant-b.example", settings["target_hostname"]) except RuntimeError: pass else: raise AssertionError("Expected signup rejection") assert db.execute("SELECT COUNT(*) FROM tenants").fetchone()[0] == 1 print("Repeated signup and rejected-write rollback checks passed.") 

The model deliberately reuses identical arguments on retry. A production handler must bind tenant identity, authorized zone, and hostname before applying this pattern, and reject conflicting reuse rather than silently accepting a changed identity. The example verifies two narrow properties: a repeated signup leaves one tenant and one CNAME, and a definite rejection leaves no new tenant.

There is a harder boundary. A database rollback cannot undo an external DNS write that already succeeded. If a connection drops after the provider applied the write, the application may lack a definite outcome. Preserve the intended record identity and reconcile it through a record lookup before deciding what to retry or remove. A database commit failure after DNS success needs the same attention. Holding a transaction open during an external request also holds database resources longer; make that an explicit trade-off of synchronous signup.

Keep the target hostname in configuration so an infrastructure move changes the configured destination rather than scattering it through signup handlers. That changes future provisioning intent; don't assume editing application configuration rewrites existing DNS records.

Emit a metric per provisioned subdomain after the successful signup decision, with a stable identity to avoid inflating counts on retries. The desired signal is new provisioned subdomains, not HTTP attempts. A flat line is a useful prompt to investigate a broken provisioning path, though it must be interpreted alongside whether signups were actually attempted.

4. Compare providers against the same evidence requirements

Cloudflare DNS, Amazon Route 53, and Google Cloud DNS are real alternatives to evaluate. Their official DNS documentation gives the starting point for that evaluation. Without a common workload and delivery evidence, naming a winner would overstate what a product list can establish.

Option Useful evaluation context Boundary to verify
Cloudflare DNS A team evaluating its DNS control plane for tenant records Test repeated writes and readback against the intended record identity; do not infer OTP delivery from record acceptance.
Amazon Route 53 A team evaluating DNS within an AWS operating environment Test the transaction adapter and its failure handling; the application still owns the tenant rollback decision.
Google Cloud DNS A team evaluating DNS within a Google Cloud operating environment Verify the record-change and reconciliation behavior needed by signup; collect mail evidence separately.

These are evaluation contexts, not measured rankings. An existing operating environment can make access management and investigation easier, but it cannot replace the rollback check. Apply the same repeated-signup and rejected-write tests to each adapter, then inspect the evidence available when an outcome is uncertain.

Infrai offers a plain REST API with a single API key and one bill across backend services. An HTTP-capable Node.js service can call it without installing a vendor SDK or maintaining a client-library version. The single key covers DNS and metrics, reducing credential handling across provisioning and its instrumentation; consolidated billing keeps those operations under one account. That is a fit argument for this workflow, not a claim that one API improves mail deliverability.

Verify the contract first.

The public discovery manifest allows a read-only preflight before implementing the DNS adapter. This Python example requests the manifest and finds the CNAME upsert route by its declared path. Set INFRAI_API_ORIGIN to the official API origin, without a version suffix, and INFRAI_API_KEY to your credential in the environment. Discovery itself is public; the example uses the normal Bearer authentication pattern so credentials stay out of source. It does not create a DNS record or pretend that inspecting discovery provisions a tenant.

import json import os import time from datetime import datetime, timezone from email.utils import parsedate_to_datetime from urllib.error import HTTPError from urllib.request import Request, urlopen origin = os.environ["INFRAI_API_ORIGIN"].rstrip("/") key = os.environ["INFRAI_API_KEY"] request = Request( origin + "/v1/discovery", headers={"Authorization": "Bearer " + key}, method="GET", ) for attempt in range(4): try: with urlopen(request, timeout=15) as response: if not 200 <= response.status < 300: raise RuntimeError("Unexpected status: " + str(response.status)) manifest = json.load(response) break except HTTPError as error: detail = error.read().decode("utf-8", errors="replace") if error.code != 429 or attempt == 3: raise RuntimeError(f"HTTP {error.code}: {detail}") from error retry_after = error.headers.get("Retry-After") delay = float(2 ** attempt) if retry_after: try: requested_delay = float(retry_after) except ValueError: retry_at = parsedate_to_datetime(retry_after) requested_delay = ( retry_at - datetime.now(timezone.utc) ).total_seconds() delay = max(delay, requested_delay) time.sleep(delay) matches = [ capability for capability in manifest["capabilities"] if capability["path"] == "/v1/dns/record/upsert" ] if len(matches) != 1: raise RuntimeError("Expected exactly one declared upsert capability") print(json.dumps(matches[0], indent=2)) 

Use the returned capability identity to consult its full request schema before writing the adapter. The preflight retries a read, honors Retry-After on rate limits, and surfaces HTTP error bodies. A write adapter additionally needs a stable idempotency key and the exact DNS request fields from discovery; the local model above intentionally doesn't invent those fields.

Select on evidence. Can the team explain which record was intended, which tenant decision committed, and what it will inspect after an uncertain result? Then ask whether its separate mail evidence supports the delivery claim. Pricing alone cannot answer those questions.

5. Stop retaining payloads and accept the investigation cost

A defensible retention proposal is to keep compact provisioning outcomes for the investigation window and expire raw diagnostic responses sooner. Choose those windows with the organization's operational and compliance requirements; the illustrative 7-day and 30-day periods above are arithmetic inputs, not a healthtech retention rule. Keep patient content and OTP secrets out of the provisioning evidence altogether.

There is a cost. After a raw response expires, an investigator cannot reconstruct its exact contents from a compact outcome record. A current DNS lookup establishes current state, not the full history of a previous attempt. That limits retrospective diagnosis, especially around an uncertain write. Preserve the intended identity and correlation reference so the remaining evidence still supports a focused investigation.

Some history is gone.

Accept that limitation deliberately. The result is a signup boundary that rejects definite provisioning failures, survives repeated CNAME writes, and leaves enough narrowly scoped evidence to investigate delivery readiness without keeping every payload.

Further reading

References: