Get started with core of Cascade

Cascade relies on Prisma for database management and Postgres for data storage. This guide will help you set up a local development environment with a Postgres database.

Clone the repo:

git clone https://github.com/d-ivashchuk/cascade.git

Spin up Postgres in docker headless mode.

docker compose up -d

Copy env variables from the example:

cp .env.example .env

Be sure to populate database urls; at this stage, they are the most important thing to get started locally:

POSTGRES_PRISMA_URL="postgresql://admin:admin@localhost:5432/cascade_db"
POSTGRES_URL_NON_POOLING="postgresql://admin:admin@localhost:5432/cascade_db"

Migrate Prisma & generate client:

npx prisma migrate dev

Install dependencies & run application

pnpm install && pnpm run dev

Add Discord authentication

This section is borrowed from the T3 app documentation as Casdcade is basing on T3.

  1. Head to the Applications section in the Discord Developer Portal, and click on “New Application”
  2. In the settings menu, go to “OAuth2 => General”
  • Copy the Client ID and paste it in DISCORD_CLIENT_ID in .env.
  • Under Client Secret, click “Reset Secret” and copy that string to DISCORD_CLIENT_SECRET in .env. Be careful as you won’t be able to see this secret again, and resetting it will cause the existing one to expire.
  • Click “Add Redirect” and paste in <app url>/api/auth/callback/discord (example for local development: http://localhost:3000/api/auth/callback/discord)
  • Save your changes
  • It is possible, but not recommended, to use the same Discord Application for both development and production. You could also consider Mocking the Provider during development.

Sign in into the application

Head to the login page(http://localhost:3000) and click on the Discord button to sign in with your Discord account.

Cascade relies on roles to manage user permissions. By default, the user is assigned the USER role. You can change the role in the database by updating the role field in the User table.

You need to change your user role to SUPER_ADMIN to get access to all features