---
title: "Discussion on \"Using a Dotenv File to Store and Use API Keys in a Vite-built React App\" | Hashnode"
description: "Discussion on \"Using a Dotenv File to Store and Use API Keys in a Vite-built React App\". I recently developed a form authentication application that required an API key in order for users to gain access to the backend. It was suggested that I keep my API key in a dotenv file. I went ahead and completed this because I had never previously..."
url: "https://hashnode.com/posts/using-a-dotenv-file-to-store-and-use-api-keys-in-a-vite-built-react-app/63bc174b14626743de083635"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Using a Dotenv File to Store and Use API Keys in a Vite-built React App](https://devzibah.hashnode.dev/using-a-dotenv-file-to-store-and-use-api-keys-in-a-vite-built-react-app?utm_source=hashnode&utm_medium=feed)

I recently developed a form authentication application that required an API key in order for users to gain access to the backend. It was suggested that I keep my API key in a dotenv file. I went ahead and completed this because I had never previously...

Jan 9, 2023 · 3 min read · devzibah.hashnode.dev  
Read the article

-   [#apis](https://hashnode.com/tag/apis)
-   [#apikey](https://hashnode.com/tag/apikey)
-   [#vite](https://hashnode.com/tag/vite)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Chisom Nnenna Chukwuma](https://hashnode.com/@DevZibah)

@DevZibah · Lagos, Nigeria

  
[View profile](https://hashnode.com/@DevZibah)

I pride myself in creating articles that are understandable to readers.

Hello, my name is Chisom, and I work as a frontend developer and technical writer. I enjoy creating interactive and dynamic websites using cutting-edge technologies. I also enjoy writing because it allows me to teach others.

## Responses 2

Markdown supported · ⌘↵ to post

[Taís Massaro](https://hashnode.com/@taismassaro)

[Jul 13, 2023](https://hashnode.com/posts/using-a-dotenv-file-to-store-and-use-api-keys-in-a-vite-built-react-app/63bc174b14626743de083635/comment/64b00e0a3910a270b4c98f1f)

hi Chisom, I just found your post while trying to understand how to inject env variables since that can only happen after the application is built by Vite in our case. do you have any experience with that? how do you add the production .env files to your application?

[Negar Baharmand](https://hashnode.com/@Negar)

[Apr 18, 2023](https://hashnode.com/posts/using-a-dotenv-file-to-store-and-use-api-keys-in-a-vite-built-react-app/63bc174b14626743de083635/comment/643ed94aafd036f10426afd8)

Hi Chisom. I just wanted to say that your article rescued my life after hours of changing my code and getting tons of errors. Thank you very much and good luck!

[Chisom Nnenna Chukwuma](https://hashnode.com/@DevZibah)

[Apr 19, 2023](https://hashnode.com/posts/using-a-dotenv-file-to-store-and-use-api-keys-in-a-vite-built-react-app/63bc174b14626743de083635/comment/643ed94aafd036f10426afd8#reply-643fecbc5ac69f01bd307950)

I'm happy it helped out. Good luck to you too.
