We will assume that you are deploying to Vercel.
-
Install git, nodejs on your computer.
-
Fork this project into your own github account.
-
Deploy this newly forked repo on Vercel. Guide
-
Note down your public deployment url.
It should look like (something.vercel.app)
!Attention! The url should NOT include your username.
-
Clone this newly forked repo into your local computer.
The environmental variables contains the following fields:
AUTH_SECRET=
<will be created with npx auth secret
>
AUTH_GOOGLE_ID
and AUTH_GOOGLE_SECRET
will be generated in Google Cloud Platform
DATABASE_URL
will include your database connection string. It is recommended to use a postgres database. (The development environment is using neondb)
DEFAULT_PROFESSORS_EMAILS
is a json formated string containing professor emails.
Example: DEFAULT_PROFESSORS_EMAILS="[email protected],[email protected],[email protected]"
TOTP_DIGITS=8
and TOTP_PERIOD=2
is used in one-time-secret generating. (Dev recommend to set it as is.)
- Open a terminal in this directory.
- run
npm install
to install all dependencies. - run
npx auth secret
to generate auth.js secret. - You should see a
.env.local
file in the directory.
-
Please follow Google's tutorial on obtaining these info.
-
For
Authorized JavaScript origins
please use your public deployment url above. -
For
Authorized redirect URIs
please use your public deployment url above, plus "/api/auth/callback/google"For example: Your public deploy url is
http://example.com
Then your
Authorized JavaScript origins
ishttp://example.com
Your
Authorized redirect URIs
ishttp://example.com/api/auth/callback/google
-
You should now see
client id
andclient secret
on your screen. Add it to the.env.local
file as below:AUTH_GOOGLE_ID="google id here"
AUTH_GOOGLE_SECRET="google secret here"
-
Please follow the guide here: NeonDB Guide
-
And this guide
-
Paste the connection string in the
.env.local
fileDATABASE_URL="connection string here"
Paste and modify the following:
DEFAULT_PROFESSORS_EMAILS="[email protected],[email protected],[email protected]"
Be careful on the quotation marks and commas. Emails should be separated by commas without space before or after.
Copy and paste the following
TOTP_DIGITS=8
TOTP_PERIOD=2
Follow the guide here: Guide
Tips: you can copy everything from the env file and paste it in browser. Vercel will automatically convert and separate it into different environment variables.
In order for the new environment varible to work, you need to trigger a re-deploy.
Don't worry, it's easy. Just delete the following line, save the file, commit the change and push to your github repository.
Delete me, save the file, commit the change and push for re-deployment.