Next.js Discord

Discord Forum

Can I call protected environment variables through the backend and use it in the frontend?

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Avatar
Transvaal lionOP
I was thinking of using a protected route in the backend of my NextJS project and fetch that route for the API key, but I would then have to protect the private route in the backend. I'm asking the question, since I'm not sure if whether or not this is a good approach to use some protected environment variables.

4 Replies

Avatar
yeah, you can. but how would you use the protected environment variables in your frontend?
I am so curious
@Transvaal lion
Avatar
@Transvaal lion ?