---
title: "Comment by Adam Kościelniak on \"Using Vite to Serve and Hot-Reload React App & Express API Together\" | Hashnode"
description: "I like this, but one problem with this solution: If I want to have variables for my backend like keys for my DB I have to use the VITE_ pattern which makes it a"
url: "https://hashnode.com/posts/using-vite-to-serve-and-hot-reload-react-app-express-api-together/63d676ef0eee226dca3e4fcb/comment/64661a21eb43c7e4ebcfef04"
---

[Discussion](https://hashnode.com/posts/using-vite-to-serve-and-hot-reload-react-app-express-api-together/63d676ef0eee226dca3e4fcb)

Comment [Using Vite to Serve and Hot-Reload React App & Express API Together](https://hashnode.com/posts/using-vite-to-serve-and-hot-reload-react-app-express-api-together/63d676ef0eee226dca3e4fcb)

[Adam Kościelniak](https://hashnode.com/@Tackgnol)

[May 18, 2023](https://hashnode.com/posts/using-vite-to-serve-and-hot-reload-react-app-express-api-together/63d676ef0eee226dca3e4fcb/comment/64661a21eb43c7e4ebcfef04)

I like this, but one problem with this solution: If I want to have variables for my backend like keys for my DB I have to use the VITE\_ pattern which makes it also visible on the front-end :(.

Any solution for that?

[noam honig](https://hashnode.com/@noamhonig)

[May 18, 2023](https://hashnode.com/posts/using-vite-to-serve-and-hot-reload-react-app-express-api-together/63d676ef0eee226dca3e4fcb/comment/64661a21eb43c7e4ebcfef04#reply-646620a0eb43c7e4ebcfeff4)

I solved that using 'dotenv'

And placing these variables in a .env file - like I would do in my node js server

```
import {config} from 'dotenv'
config()
console.log({ test: process.env["TESTING123"] })
```

.env

```
TESTING123=works
```
