Search code examples
firebasegoogle-cloud-firestorefirebase-hosting

Do Firebase preview channels use the same DB?


I've looked around for answers to my question, but most are actively trying to do what I don't want which is why I'm asking.

An app I'm developing for the company I work for has gone live, and so to further develop I need to use Firebase preview channels.

I've looked over the documentation and it states that channels use the same resources, which I find a little unclear.

Does this mean that preview channels are UI only and using an app on a preview channel will still write to the live database (Firestore) that customers are currently using?


Solution

  • If you're talking about Firebase Hosting preview channels, the only difference between each channel is the web content (html, css, js, images) that you deploy to it. The configurations for the other Firebase products (database, analytics, etc) don't change at all. You can see this for yourself by printing the active Firebase configuration in JavaScript - you should see the all the same values.

    If you want to build against a different database before you push updates to production, you should instead use completely different Firebase projects to keep them separate. It's common for developers to keep multiple projects for multiple environments, such as development, staging, and production. This is the formal recommendation.

    Bottom line: A Firebase Hosting preview channel just lets you try out different web assets against the same backend services. If you want different working environments to avoid disturbing customers in production, you should use different projects entirely.