Question on storing Rawg API key

Within the video game react project, it is a little unclear how we should be storing our API keys. To my understanding, the best way to store the API key for the Rawg React project is:

-Store API key in .env file
-add .env to .gitignore
-use import.meta.env.filename in our api-client.ts file in the key: section.

Is this the correct way to go about storing the key?

Well ideally no that’s not the best way.

The ideal way would be create a docker image with enviromental variables set to api key and secret codes being set in automatically the console upon deployment after build or auto rebuild if the app crashes.

Second beat would be deploy without environment vars omitted but app set up to use them, then after build manually go into your web host console and set the variables.

When i deploy with vercel for example it pulls from my git repo so those git ignored files would not be on the deployment. These concepts mosh covers in his docker and git tutorials. But essentially it’s stored in the operating system or some lower code through the console commands.