🧠 Good to know: After changing the
.env
file, make sure to restart your server to apply the changes and avoid any issues.
This is the first step to get started with Boilkit - the first step to something great ⛰️! Before we start, check if you fulfill the requirements for local development.
To get started, you need a .env
file in the root directory of your project.
This file will contain all the environment variables that your app needs to run.
Rename the .env.example
file to .env
and fill in the values for each variable. Do it manually or use:
cp .env.example .env
Now, open the .env
file and fill in the values for each variable:
Generate a secret key pressing the button below:
Your default values for the url’s will be http://localhost:3000
.
To make sure your system uses the same port, run next dev
in your terminal. You’ll see on which specific port your app runs.
NEXTAUTH_URL="http://localhost:3000" // Specifically used for the authentication with NextAuth.js
NEXT_PUBLIC_SITE_URL="http://localhost:3000"
SITE_URL="http://localhost:3000"
🧠 Find out what each single variable is used for:
NEXTAUTH_URL
This is specifically for the authentication with NextAuth.js and tells the app where to redirect users during authentication. It should be the base URL of your site, typically the same for development (
localhost
) and production (your live site).
NEXT_PUBLIC_SITE_URL
This is a public environment variable, meaning it will be exposed to the client-side JavaScript. If you need the base URL of your site to be accessible on the client side (e.g., for API requests or links), you use this.
SITE_URL
This is more of a general-purpose variable for the site's base URL, and can is used for various configurations or external services that need the full URL.
⚠️ Never add variables that contain sensitive information to variables starting with
NEXT_PUBLIC_
, as they can be accessed by anyone viewing your site's source code.
For the rest of the site information, you’re free to choose whatever you like. These values are used across the app - mostly for fallback values:
SITE_NAME="Boilkit Boilerplate"
AUTHOR_NAME="Emin Araki"
📖 Continue reading to learn more about Boilkit. Boilkit Documentation.