FangDash
Getting Started

Developer Setup

Set up FangDash for local development.

TL;DR - Requires Node.js >= 24, Bun 1.3.10, a Cloudflare account, and a Twitch app - Clone → install → create D1 database → copy env files → bun dev - Web runs at localhost:3000, API at localhost:8787

Estimated time: ~10 minutes

This guide is for developers who want to run FangDash locally or contribute to the project.

Prerequisites

You need a Cloudflare account (for the D1 database) and a Twitch Developer application (for OAuth) before you can run FangDash locally.

RequirementVersion
Node.js>= 24
Bun1.3.10 (curl -fsSL https://bun.sh/install | bash)
Cloudflare accountFree tier works
Twitch Developer appdev.twitch.tv/console

Step 1 of 4 — Clone and Install

git clone https://github.com/MrDemonWolf/fangdash.git
cd fangdash
bun install

Step 2 of 4 — Set Up the Database

Create a Cloudflare D1 database:

bunx wrangler d1 create fangdash-db

The output will look something like this:

✅ Successfully created DB 'fangdash-db'

[[d1_databases]]
binding = "DB"
database_name = "fangdash-db"
database_id = "abc12345-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Copy the database_id value and paste it into the [[d1_databases]] block in apps/api/wrangler.toml:

[[d1_databases]]
binding = "DB"
database_name = "fangdash-db"
database_id = "abc12345-xxxx-xxxx-xxxx-xxxxxxxxxxxx"  # ← replace this
migrations_dir = "drizzle/"

FangDash uses drizzle/ as the migrations directory (not migrations/). This is already configured in wrangler.toml — you only need to update the database_id.

Then run migrations:

bunx wrangler d1 migrations apply fangdash-db --local

If migrations fail, make sure you've logged into Cloudflare first with bunx wrangler login.

Step 3 of 4 — Configure Environment Variables

Copy the example files from the repo root:

cp apps/api/.dev.vars.example apps/api/.dev.vars
cp apps/web/.env.example apps/web/.env.local

Never commit .dev.vars or .env.local — they contain secrets. Both files are already in .gitignore.

Fill in apps/api/.dev.vars:

BETTER_AUTH_SECRET=your-secret-here
BETTER_AUTH_URL=http://localhost:8787
TWITCH_CLIENT_ID=your-twitch-client-id
TWITCH_CLIENT_SECRET=your-twitch-client-secret

Generate a strong secret with: openssl rand -base64 32 — paste the output as your BETTER_AUTH_SECRET.

Twitch OAuth Redirect URL — In your Twitch Developer Console app settings, add http://localhost:8787/api/auth/callback/twitch as an OAuth Redirect URL. Without this, sign-in will fail with a redirect error.

To find your Twitch Client ID and Client Secret:

  1. Go to the Twitch Developer Console
  2. Click on your application (or create one)
  3. The Client ID is shown on the app overview page
  4. Click New Secret to generate a Client Secret (it's only shown once — copy it immediately)

Fill in apps/web/.env.local:

NEXT_PUBLIC_API_URL=http://localhost:8787

Step 4 of 4 — Start Development

bun dev

The web app runs at http://localhost:3000 and the API at http://localhost:8787.

You're all set! Your local FangDash instance is running. Head to localhost:3000 and sign in with Twitch to start playing.

Available Scripts

CommandDescription
bun devStart all apps in development mode
bun buildBuild all packages and apps
bun testRun all tests with Vitest
bun test:coverageRun tests with coverage report
bun typecheckType-check all packages
bun lintLint all packages
bun lint:fixLint with auto-fix
bun checkRun ESLint + Prettier check
bun formatFormat all files with Prettier
bun format:checkCheck formatting without writing
bun cleanRemove all build artifacts

Troubleshooting

Error / SymptomLikely CauseFix
D1_ERROR or "database not found"database_id in wrangler.toml doesn't match your D1 database, or migrations haven't been runDouble-check the ID from bunx wrangler d1 list and re-run bunx wrangler d1 migrations apply fangdash-db --local
"Auth not configured" or 503 from APIMissing or incorrect values in apps/api/.dev.varsEnsure all four variables (BETTER_AUTH_SECRET, BETTER_AUTH_URL, TWITCH_CLIENT_ID, TWITCH_CLIENT_SECRET) are set
CORS errors in the browser consoleNEXT_PUBLIC_API_URL in apps/web/.env.local doesn't match the actual API URLVerify the URL is http://localhost:8787 (no trailing slash) and restart bun dev after changing env files
Blank page or error after Twitch sign-inOAuth Redirect URL not registered in Twitch Developer ConsoleAdd http://localhost:8787/api/auth/callback/twitch as a redirect URL in your Twitch app settings
"Cannot find module" on bun devDependencies not installedRun bun install from the repo root

On this page