Deploy Locally

This section describes how to deploy the application locally on your machine. You can use it to run your own instance of the application for development and testing purposes.

Setting up the environment

Installing Packages

Install the dependencies for the root project

pnpm install

Setting up the database

This application uses Postgres as the database. You can install it locally or use a cloud service like Neon or Supabase.

Once you get your connection url add it in the .env file in the root directory of the project.

Running migrations and seeding the database

  • Move to packages/db directory
cd packages/db
  • Run migrations
pnpm migrate

Setting Up Github OAuth Keys

Follow this link to create a new app filling the following required details on creation:

Homepage URL: http://localhost:3000
Authorization callback URL: http://localhost:3000/api/auth/callback/github

Once completed, you will be redirected to the application page settings, from there create the client secret by clicking on Generate a new client secret button.

Next, copy the client secret generated and the client ID into the .env file, replacing <client_id> and <client_secret>, respectively:

GITHUB_CLIENT_ID=<client_id>
GITHUB_CLIENT_SECRET=<client_secret>

Setting up Next Auth

NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET="long random string which no one should know"

Running the application

Run the following command in the root directory of the project

pnpm dev

Below is list of ports used by the different services:

Setting up admin user

Open localhost:3000 in your browser and login using Github. Once logged in, move to packages/db directory and run the following command:

pnpm studio

This will open the Prisma Studio in your browser. From there you can go to User table and in roles column add Admin to the user you want to make admin.

Now you can access the admin panel at localhost:3001

Populating tracks & challenges in the database

In packages/db directory run the following command:

pnpx tsc && node dist/scripts/index.js