nsilvestri / algdb

Home Page:https://algdb.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AlgDB Next

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.

Getting Started

  1. Run npm install to install dependencies.
  2. Define the environment variables (see below).
  3. Run npx prisma db push to push the database schema to your database.
  4. Run npx prisma db seed to seed the database with initial data.
  5. Run npm run dev to start the development server.
  6. Open http://localhost:3000 with your browser to see the result.

Environment Variables

The file env.example contains the required environment variables. Create a .env file in the root directory, and copy the contents of env.example.

Prisma Database URL

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.

NextAuth

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.

Setting up WCA OAuth

  1. Create an OAuth application.
  2. Set the Redirect URI to http://localhost:3000/api/auth/callback/wca for development, or https://{YOUR_DOMAIN}/api/auth/callback/wca for production.
  3. Set the Scopes to public email and click Submit.
  4. Update your .env file with the credentials shown on the page. "Application ID" is the WCA_CLIENT_ID, and "Secret" is the WCA_CLIENT_SECRET.

Setting up Google OAuth

  1. Create a new Google Cloud project.
  2. On the Credentials page, click "Create credentials" and select "OAuth client ID".
  3. Select "Web application" for Application type.
  4. 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
  1. Update your .env file with the Google Client ID and Client secret shown in the "OAuth client created" dialog.
  2. Update the OAuth consent screen.

About

https://algdb.vercel.app


Languages

Language:TypeScript 97.8%Language:CSS 2.0%Language:JavaScript 0.2%