Environment Variables
Learn how to configure environment variables for iShortn.
The .env.local
file contains various environment variables that need to be set before running iShortn. The .env.example
file is provided as a reference for setting your own environment variables.
To start, copy the content of the .env.example
file into a new file called .env.local
and fill in the values for the environment variables below.
Database
When developing locally, the docker container will automatically create the database for you. You only need to set the DATABASE_URL
environment variable, which is the same thing as what is in the .env.example
file.
Authentication
We use Clerk for authentication. Please follow the instructions below on how to set it up. There are 6 environment variables that need to be set for authentication to work, but you only need to set 2 of them:
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
- CLERK_SECRET_KEY
How to get them
-
Log in to your Clerk account at https://clerk.com/ or create a new account if you don’t have one yet.
-
Once logged in, go to your dashboard at https://dashboard.clerk.com/ and select create a new app if you do not have any application already.
-
On the create new app screen, enter your app name and select Google and or GitHub under the section How will your users sign in?
-
Please note that using other providers will cause issues in the application due to the different payload received from Clerk.
-
After setting up your app, navigate to the “DEVELOPERS” section in the left-hand menu and find “API Keys.”
-
In the “Quick Copy” section, make sure that Next.js is selected, then click the copy icon to obtain the keys. Copy the values for “NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY” and “CLERK_SECRET_KEY.”
-
Paste these values into the
.env.local
file under their respective variables. It should look something like this (real values without censorship):