Great question — answering as the UphillTech team:
if you are using latest version of nextJs ( above 9 ) then follow these steps : Create a .env.local file in the root of the project. Add the prefix NEXT_PUBLIC_ to all of your environment variables. eg: NEXT_PUBLIC_SOMETHING=12345 use them in any JS file like with prefix process.env eg: process.env.NEXT_PUBLIC_SOMETHING
Full answer by confused_: https://stackoverflow.stackexchange.com/a/68136083 (CC BY-SA 4.0).
Need it done for your business? UphillTech.