On this page

Custom domains

Serve every API of a project on your own domain, such as api.yourapp.com, with certificates issued and renewed for you. Included from the Pro plan.

A custom domain serves every API of your project (REST, Auth, Storage, Realtime and Edge Functions) on a name you own, such as api.yourapp.com, instead of <ref>.p.stitchdb.com. Certificates are issued and renewed for you, there is no extra charge on paid plans, and the domain follows your project when it moves, fails over or serves reads from a replica close to your users.

#Add a domain

  1. Open Project › Settings › Custom domains, enter the domain and click Add domain.
  2. At your DNS provider, add the CNAME record shown on the page: the name (such as api) pointing to <ref>.p.stitchdb.com. If your provider offers a proxy or CDN for the record, keep it off (DNS only), otherwise the certificate can’t be issued.
  3. Within a few minutes of the record showing up, the domain is checked, a certificate is issued and the status turns Live. Click Check now to skip the wait.

#Use it in your app

Use the domain as the project URL. The keys stay the same, and the project’s own address keeps working.

JavaScript
import { createClient } from 'stitchdb-js'

const stitchdb = createClient('https://api.yourapp.com', STITCHDB_ANON_KEY)

#Use it for Auth

Tick Use for Auth on a live domain and e-mail links, OAuth callbacks, SAML and the token issuer move to https://api.yourapp.com/auth/v1, so users only ever see your domain. Before you turn it on, add https://api.yourapp.com/auth/v1/callback as a redirect URI at each OAuth provider you use (Google, GitHub …). Auth restarts once, which takes a few seconds. Only one domain per project can be used for Auth.

#Use it for the status page

Tick Use for the status page on a live domain such as status.yourapp.com and its root opens your project's status page; links in status e-mails and webhooks use it too. Every API keeps working on the same domain. One domain at a time can show the status page.

#Status

StatusWhat it means
Waiting for DNSThe CNAME record isn’t visible yet, or points somewhere else. The page shows what the domain points to now. A domain whose record never shows up is removed after 14 days.
Issuing certificateThe record is right; a certificate from Let’s Encrypt is being issued (usually under a minute).
LiveServed on the domain with its own certificate, renewed automatically 30 days before it expires.
Certificate failedLet’s Encrypt couldn’t issue the certificate. The reason is shown (a CAA record that doesn’t allow Let’s Encrypt, a proxy in front of the record, a rate limit); it is tried again automatically, or click Check now after fixing it.

#How it works

The CNAME makes your domain resolve like <ref>.p.stitchdb.com, which StitchDB’s own DNS answers with the servers of your project. The certificate is proven over HTTP on port 80 of those servers and installed on each of them; requests are handled exactly like requests to the project’s own address, with the same limits, logs and usage. Nothing is proxied through a third party.

#Limits

LimitFreeProScaleEnterprise
Custom domains per project01310