How to use environment variables in Next.js (includes a working example app)
Next.js is a React framework that makes building fast, user-friendly websites easy. It uses server-side rendering to pre-render pages on the server, which makes them load faster for users. Environment variables are a way to store sensitive information, such as passwords or API keys, outside of your code. This makes it more secure, it is one of the tenants of the 12-factor app. In this post, you will learn how to properly use environment variables on both the server and client side of Next.js. Let’s get started!