How to Deploy a Firebase Studio App to a Custom Domain
The preview in Firebase Studio proves the app works. Moving it to your own domain is a different job, and the ordering matters — do it wrong and you get a certificate error you cannot easily debug.
Short answer: deploy to Firebase Hosting first, add the custom domain in the Firebase console, create the A and TXT records it shows you, wait for SSL provisioning, then set production environment secrets and redeploy.
Why deploy before configuring the domain?
Firebase needs an existing hosting site before it can attach a domain. If you skip straight to DNS, you end up editing records for a target that does not exist yet.
Do the free web.app deploy first, confirm the app loads there, and only then start the domain work. If the app is broken on the default URL, it will be broken on yours too.
How do you connect DNS to Firebase Hosting?
- In the Firebase console, open Hosting and click Add custom domain.
- Enter your domain, for example
app.example.com. Use a subdomain rather than the bare apex if you can. - Firebase shows two A records for the apex or a CNAME for a subdomain, plus a TXT record for verification.
- Add those records at your registrar exactly as shown.
- Return to the console and click Verify. Propagation is usually minutes but can take up to 24 hours.
The TXT record proves ownership. If verification fails, it is almost always a typo in the record name or a proxy setting on your DNS provider that strips the record.
How long does SSL take?
Once verification passes, Firebase provisions a managed TLS certificate automatically. This takes from a few minutes to a few hours, occasionally up to 24. You do not need to buy a certificate.
| Stage | Typical time |
|---|---|
| DNS propagation | 5-60 minutes |
| Domain verification | Seconds after propagation |
| SSL provisioning | 15 minutes to 24 hours |
In the meantime the domain shows a certificate warning. That is expected, not a sign you did something wrong.
What usually breaks the first deploy?
Environment variables. Anything reading from process.env at build time needs to be present in the Firebase environment, not just in your Studio workspace settings. This is the single most common cause of “works in Studio, blank page in production.”
The second most common is the wrong build output directory — Firebase expects out for static Next.js exports or public for plain static sites. Check firebase.json matches what your framework actually produces.
Third: client-side routing breaks on refresh because there is no rewrite rule to index.html. Add a rewrite in the hosting config and redeploy.
Who should bother with a custom domain?
Anyone shipping to real users. A web.app URL is fine for a demo but reads as unfinished for a product, and some email providers treat it as suspicious.
If you are prototyping, skip all of this — the default URL is free, instant, and gets you feedback faster. Add the domain when the app earns it.
Quick Summary
- Deploy to the default
web.appURL before touching DNS. - Add A or CNAME records plus the TXT verification record, then click Verify.
- SSL is managed and free, but provisioning can take up to 24 hours.
- Missing production environment variables are the top cause of blank deploys.
- Add a rewrite to
index.htmlif client-side routes 404 on refresh.
