To get started with your own development, you will need the following prerequisites:
- A Vercel account
- Basic knowledge of Git and NPM
- An email domain for sending emails
For the purpose of this project, we have chosen to use Vercel and its storage services (Vercel Postgres, Vercel Blob) for ease of deployment.
- Fork this repository using these steps
- Import the forked repository to Vercel using these steps
- Add the following environment variable during the import process
# Key: AUTH_SECRET
# Value:
openssl rand -base64 32For advanced use, you may have different sets of environment variables (e.g. API keys) for production, preview and development. This setting may be changed in the project settings later. For the initial set up, you may check all environments to be applied for a variable. More information can be found here.
- Follow the steps in this guide to create and connect Vercel Postgres to your project (similar steps for Vercel Blob)
You may name the database however you wish.
- Clone the forked repository into your local drive
- Navigate to the project directory with your preferred IDE or via the CLI
- Rename the environment variable file
.env.localto.env - For the environment variables under
# NextAuth,# Vercel Bloband ,# Vercel Postgres(see below), you may retrieve them from Vercel.com > Your project > Settings > Environment Variables. - For the
PUBLIC_URLenvironment variable, you can retrieve it from Vercel.com > Your project > Settings > Domains. For example, thePUBLIC_URLenvironment variable for this project is set to"https://its-frontend-manager.vercel.app". - For the sending of reset password email, you can either use third-party mail service providers or libraries such as nodemailer. You can refer to this Vercel guide for more information.
- If you use third-party service providers, you can remove the environment variables under
# Node Mailer(see below) from your.envfile. You will also have to reconfiguresend-reset-email.tsbased on your service provider's documentation. - For this project, our team has decided to use the Nodemailer library with Zoho email hosting service.
- If you use
Nodemailerwith an email domain other than Zoho, you will have to reconfigure the environment variables under# Node Mailer(and possibly thesend-reset-email.tsfile) based on the email domain used. You can read more about that at nodemailer. - If you choose to use Zoho email hosting service with the Nodemailer library, you can retrieve the following environment variables with the steps below:
SMTP_HOST="smtp.zoho.com", if you use the US data server,SMTP_HOST="smtp.zoho.eu"if you use the European data server.- For
APP_PASSWORD, you can generate an app password from mail.zoho.com/ > My profile > My Account > Security > App Password - For
HOST_EMAIL, you should use your Zoho mail account.
# NextAuth
AUTH_SECRET=""
# Vercel Blob
BLOB_READ_WRITE_TOKEN=""
# Vercel Postgres
POSTGRES_DATABASE=""
POSTGRES_HOST=""
POSTGRES_PASSWORD=""
POSTGRES_PRISMA_URL=""
POSTGRES_URL=""
POSTGRES_URL_NON_POOLING=""
POSTGRES_URL_NO_SSL=""
POSTGRES_USER=""
# Vercel deployment domain
PUBLIC_URL=""
# Node Mailer
APP_PASSWORD=""
HOST_EMAIL=""
SMTP_HOST=""For users familiar with Vercel workflow, you may use the Vercel CLI and directly pull the environment variables from the deployed project (requires additional set up)
vercel env pull- Install the project dependencies and generate Prisma client
npm installAt this point, you should have correctly configured the deployed project on Vercel and the local project environment
- Push the database schema and seed the database with some initial values
npx prisma db push
npx prisma db seed- Finally you can view the deployed project or run a local development
npm run dev
# Open http://localhost:3000 with your browserBefore proceeding, ensure that you have Docker installed and running on your machine. More details can be found here.
- Ensure that you have already renamed the environment variable file
.env.localto.env. - Ensure that the unfilled variables under
# NextAuth,# Vercel Bloband# Node Mailerbelow has been filled with the environment variable's values obtained from Part 1 and 2 above. - Ensure that the environment variables under
# Dockerare filled with the values stated below. - The
.envfile should contain:
# NextAuth
AUTH_SECRET=""
# Vercel Blob
BLOB_READ_WRITE_TOKEN=""
# Node Mailer
APP_PASSWORD=""
HOST_EMAIL=""
SMTP_HOST=""
# Docker
POSTGRES_USER="postgres"
POSTGRES_PASSWORD="postgres"
POSTGRES_DB="postgres"
DATABASE_URL="postgresql://postgres:postgres@postgres:5432/postgres?schema=public"- In
/prisma/schema.prisma, you should replacedatasource dbwith the following changes:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL") // uses connection pooling
relationMode = "foreignKeys"
}
- Build your container with
npm run docker:compose:dev. - Run
docker psto retrieve the CONTAINER ID forits-frontend-manager-frontendimage. - Run
docker exec {CONTAINER ID} npx prisma db push - Run
docker exec {CONTAINER ID} npx prisma db seed - Open
http://localhost:3000with your browser
You may read more about Next.js and Docker here.