Before we start, I highly recommend installing pnpm
to navigate this project instead of using the usual npm
. Get pnpm
here.
- Create a
.env
file as per.env.example
in the root of the project. (Check out the (Appendix)[#Appendix] at end of this README for steps getting your own environment variables mentioned in.env.example
). - Apply migrations to your database.
I am using Prisma Postgres in this project. If you plan to use any other database, you would have to delete the existing migrations and generate them again. See the relevant database guide at Prisma.
pnpx prisma migrate dev
- OPTIONAL: Seed the database.
pnpm seed
- Generate the prisma client.
pnpx prisma generate
- Run the application.
pnpm dev
There are two parts of this application that require some environment variables:
- Database
- Auth
Database setup has been done using Prisma. You'll need to configure your database provider and connection string in the prisma/schema.prisma
file. Check out Prisma Docs on how to get your connection string. Put this in the DATABASE_URL
environment variable.
Auth setup has been done using NextAuth. You'll need three environment variables for it to work.
NOTE: We are using only Google OAuth 2.0 in this project but you can potentially expand it with other providers.
NEXTAUTH_SECRET
: Could be any random string. I recommend generating one using:openssl rand -base64 32
GOOGLE_CLIENT_ID
: Get it from Google Cloud Console. Steps to generate it can be found here.GOOGLE_CLIENT_SECRET
: Get it from Google Cloud Console. Steps to generate it can be found here.