Keeping Your Data Secure: Environment Variables in NextJS / React

Published: 13 October 2022
on channel: Josh tried coding
26,292
443

Environment variables (.env) are THE way to keep your sensitive data like API keys secure and away from users. You define them in special .env.local files on your local machine and then define them wherever you deploy your React / NextJS project.

While you can use secure .env variables in NextJS, due to the nature of React (being client-side rendered), you can only use public environment variables in React. To interact with APIs in React, you'd make a request to a NodeJS server that contains the server-side env variables.

Hope you found this video helpful, and have fun coding your following projects!
Josh


Watch video Keeping Your Data Secure: Environment Variables in NextJS / React online without registration, duration hours minute second in high quality. This video was added by user Josh tried coding 13 October 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 26,292 once and liked it 443 people.