Custom Domain SDK
A TypeScript SDK for adding bring-your-own-domain support to multi-tenant apps, built on Cloudflare Custom Hostnames with a strict domain lifecycle.
Custom Domain SDK
A production-grade TypeScript SDK for managing custom domains using Cloudflare like Custom Hostnames. This SDK is framework-agnostic, database-agnostic, and implements a strict domain lifecycle state machine.
Domain Lifecycle
The SDK enforces the following state transitions:
- created: Internal record created.
- pending_verification: Waiting for TXT record verification.
- verified: TXT record matched.
- pending_dns: Waiting for CNAME/A record to point to our edge.
- provisioning_ssl: Calling Cloudflare to issue certificates.
- active: Domain is live.
- failed: Terminating state for any step.
Why this exists
Every platform that lets you bring your own domain, the way Vercel or Webflow map a custom domain onto your account, builds this flow internally, and none of them ship it as a package. Custom domains look trivial until you actually do it: DNS propagation, TLS provisioning, and provider-specific quirks turn it into a painful thing to debug. I wanted to understand that flow end to end and leave behind a reusable version, so this SDK makes the logic explicit, deterministic, and both framework and database agnostic.
Let's work together
Have a project in mind? Reach out and let's build something great.