- Install dependencies:
npm i-
Create a MongoDB cluster and get the connection string from the MongoDB dashboard.
-
Create a
.envfile in the root directory as per the.env.examplefile:
cp .env.example .env- Set MongoDB credentials in the
.envfile:
MONGODB_USER="user"
MONGODB_PASSWORD="password"
MONGODB_DATABASE="database"
MONGODB_CLUSTER="cluster0"
MONGODB_DOMAIN="mzcsh.mongodb.net"- Generate a secret key:
openssl rand -base64 32- Set
AUTH_SECRETandNEXTAUTH_URLin the.envfile:
NEXTAUTH_SECRET="<generated_key>"
NEXTAUTH_URL="http://localhost:3000"- Set the
ADMIN_EMAILin the.envfile (GitHub email used in this example):
ADMIN_EMAIL="admin@gmail.com"- Create a GitHub OAuth app and set the
GITHUB_IDandGITHUB_SECRETin the.envfile:
GITHUB_ID="<github_id>"
GITHUB_SECRET="<github_secret>"- Run the server:
npm run dev
# or
npm start- Open http://localhost:3000 on your browser.