Using Firebase API Keys in Vite/React Apps

Dana Scheider (he/they)
4 min readMar 4, 2023

I spent several hours scouring the Internet trying to find out how to enable my React app, built on Vite, to use my Firebase API key without exposing the key in the production bundle. I’m here to save you time, so I won’t bury the lede: it’s not possible, nor is it necessary. It turns out, it’s actually not only OK but almost necessary to have your Firebase API key exposed in both version control and your client-side bundle. This is safe as long as your application has appropriate security rules in place for its database (if you have one — I don’t).

--

--

Dana Scheider (he/they)

Senior Engineer at CashApp, formerly at Envato & New Relic