I am going to tell you to NOT proceed with the project as you currently are. The reason as outlined in the Production Replacement section of the Vite Env Variables and Modes documentation
During production, these env variables are statically replaced.
This means that the API Key and other firebase configuration will end up in the production build and available to anyone who care to look for it.
A much better approach as outlined in the following support guide is to create a function that fetches data from the database (handling errors in the process) and returns a response to the frontend