This is a Next.js project bootstrapped with create-next-app
. It uses shadcn/ui for components, Planetscale for the database, Prisma as an ORM and database migration tool, and the Vercel Platform for deployment.
- Run
npm install
to install dependencies. - Define the environment variables (see below).
- Run
npx prisma db push
to push the database schema to your database. - Run
npx prisma db seed
to seed the database with initial data. - Run
npm run dev
to start the development server. - Open http://localhost:3000 with your browser to see the result.
The file env.example
contains the required environment variables.
Create a .env
file in the root directory, and copy the contents of env.example
.
This project uses Planetscale for its database. You can set up a Planetscale database yourself, or use a different MySQL-compatible database. Set DATABASE_URL
accordingly.
Set NEXTAUTH_URL
to the canonical URL of the site. Use http://localhost:3000
for development.
Set NEXTAUTH_SECRET
to a random value generated by:
openssl rand -base64 32
More details here.
- Create an OAuth application.
- Set the Redirect URI to
http://localhost:3000/api/auth/callback/wca
for development, orhttps://{YOUR_DOMAIN}/api/auth/callback/wca
for production. - Set the Scopes to
public email
and click Submit. - Update your
.env
file with the credentials shown on the page. "Application ID" is theWCA_CLIENT_ID
, and "Secret" is theWCA_CLIENT_SECRET
.
- Create a new Google Cloud project.
- On the Credentials page, click "Create credentials" and select "OAuth client ID".
- Select "Web application" for Application type.
- Enter the following information:
For development | For production | |
---|---|---|
Authorized JavaScript origins | http://localhost:3000 |
https://{YOUR_DOMAIN} |
Authorized redirect URIs | http://localhost:3000/api/auth/callback/google |
https://{YOUR_DOMAIN}/api/auth/callback/google |
- Update your
.env
file with the Google Client ID and Client secret shown in the "OAuth client created" dialog. - Update the OAuth consent screen.