Skip to content

Latest commit

 

History

History
116 lines (82 loc) · 3.57 KB

quickstart.mdx

File metadata and controls

116 lines (82 loc) · 3.57 KB
title description icon
Quickstart
Start developing locally in 5 minutes
play

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.

You can easily replace Posgres with other databases supported by Prisma. Check out the Prisma documentation for more information.

Clone the repo:

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

Spin up Postgres in docker headless mode.

docker compose up -d
If you are using hosted Postgres, you can skip the docker step and populate the connection string in the `.env` file with your existing database URL.

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:https://admin:admin@localhost:5432/cascade_db"
POSTGRES_URL_NON_POOLING="postgresql:https://admin:admin@localhost:5432/cascade_db"

Migrate Prisma & generate client:

npx prisma migrate dev

Install dependencies & run application

pnpm install && pnpm run dev
If you want to have some basic data to work with, you can populate the User table immediately by running the following command:
npx prisma db seed
<Frame>
  <img
    src="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/images/user-management.jpeg"
    style={{ borderRadius: "0.5rem" }}
  />
</Frame>

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: https://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(https://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