-
Notifications
You must be signed in to change notification settings - Fork 2
Setting up the environment variables
The application needs some variables for proper functioning. It is pretty useless without it.
Create a file named .env.local
in the root directory of the application. This file will contain important information for the application. The structure of the file is as follows:
NEXT_PUBLIC_PROD_ENV=
NEXT_PUBLIC_SERVER_URL=
NEXT_PUBLIC_EMAILJS_SERVICE_ID=
NEXT_PUBLIC_EMAILJS_TEMPLATE_ID=
NEXT_PUBLIC_EMAILJS_PUBLIC_KEY=
Refer: .env.example
-
NEXT_PUBLIC_PROD_ENV
This is identify if the application is running in production mode, or development mode. If you are running your application on local system, you might wanna set it todev
, and for production, set it toproduction
-
NEXT_PUBLIC_SERVER_URL
It is the URL of your server. If your server is running on the same system as your frontend app, the default value should behttp://localhost:3002
, otherwise, if your server is running on a different system, you could set it up ashttp://192.x.x.x
orhttps://api.backend.com
. Keep in mind that there is no trailing/
in the value.
Setup for EmailJS. These variables are required for the contact page, and the application might fail if these are not provided. However, you an set these as "null" or any random value if you o not want that functionality
-
NEXT_PUBLIC_EMAILJS_SERVICE_ID
Available on https://dashboard.emailjs.com/admin upon adding a service. -
NEXT_PUBLIC_EMAILJS_PUBLIC_KEY
Available on https://dashboard.emailjs.com/admin after opening the service modal. -
NEXT_PUBLIC_EMAILJS_TEMPLATE_ID
Available on https://dashboard.emailjs.com/admin/templates upon creating an email template.
Note: You can keep two files named .env.development.local
and .env.production.local
in your folder. This way, while on production, the production one would automatically be selected, and while on development, the development. This is not a requirement, but a suggestion if you are constantly switching between production and development channels.