Skip to content
buzrrPublic

About

Real-time, open-source quiz platform built for live engagement, instant feedback, dynamic leaderboards and 1v1 battles

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

74 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

โšก๏ธŽ Buzrr

Open-source QuizUp and Kahoot, together in one app. Go head-to-head in ranked 1v1 quiz battles like QuizUp, host live multiplayer quiz rooms like Kahoot, and generate whole quizzes with AI.

License: AGPL v3 PRs Welcome Next.js NestJS


โœจ Features

  • ๐ŸŽฎ Live multiplayer quizzes (the Kahoot half) โ€” host a room, players join with a code, link or QR code (no account needed), everyone answers in real time over WebSockets. Hosts can kick or ban players.
  • โš”๏ธ Ranked 1v1 duels (the QuizUp half) โ€” matchmaking with an ELO rating system, backed by difficulty-scaled bot opponents when nobody else is queuing. Challenge a friend with an unrated invite link.
  • ๐Ÿค– AI quiz generation โ€” describe a topic and let a model draft the questions: Gemini, or anything that speaks the OpenAI API โ€” including a local model via Ollama (optional).
  • ๐Ÿ“š AI Knowledge Spaces โ€” upload PDF, DOCX, TXT or Markdown documents and generate cited questions from them with RAG (optional Python service).
  • ๐Ÿ’ณ Buzrr Pro โ€” the hosted version's paid plan (bigger rooms, unlimited quizzes, more AI generations) via Dodo Payments. Self-hosted instances run without billing and every account gets Pro limits.
  • ๐Ÿ›ก๏ธ Public question moderation โ€” community questions feed the duel pool behind an approve/report workflow.
  • ๐Ÿ–ผ๏ธ Media questions โ€” image uploads to local disk, any S3-compatible bucket, or Cloudinary.
  • ๐Ÿ” Sign-in โ€” local email + password accounts and/or Google, powered by Better Auth.
  • ๐Ÿ  Self-host anywhere โ€” docker compose up runs the whole thing, fully offline on a school server if you like. No SaaS accounts required.
  • ๐Ÿงฉ Pluggable question types โ€” each type is a small server handler plus a web renderer; add one without touching the game engine.
  • โšก Server-authoritative game loop โ€” live state lives in Redis; only finished games are persisted to Postgres.

๐Ÿ—๏ธ Architecture

Buzrr is a Turborepo monorepo: a Next.js frontend (apps/web, which also hosts auth), a NestJS server (apps/server) that owns every game rule over Socket.IO, an optional Python service for AI Knowledge Spaces (apps/ai), and a shared Prisma package. Live game state lives in Redis; Postgres keeps the lobby record and the final result.

The socket and REST shapes both apps speak are defined once, as zod schemas, in packages/contract.

๐Ÿ“ Read ARCHITECTURE.md for the full picture โ€” the server-authoritative game loop, how timer ownership survives crashes and multiple instances, and the Redis/Postgres split. Detailed docs live in docs/ โ€” architecture by area, decision records (ADRs) and the current project state. Coding agents start at AGENTS.md.

๐Ÿ  Self-host in one command

All you need is Docker:

git clone https://github.com/buzrr/buzrr && cd buzrr
docker compose up -d          # first run builds the images (a few minutes)

Open http://localhost:3000 and create an account. That's the whole install: Postgres, Redis, migrations, the API and the web app, with local accounts, images on a Docker volume and an auth secret generated on first boot โ€” nothing calls out to the internet. AI is off until you point it at a model (--profile ollama bundles a local one).

To serve other machines, set PUBLIC_WEB_URL / PUBLIC_API_URL in a .env next to docker-compose.yml and run docker compose up -d --build. Every option โ€” LAN installs, closing sign-ups, S3 storage, AI, upgrades, backups โ€” is in docs/self-hosting.md.

๐Ÿš€ Develop locally

Prerequisites

  • Node.js โ‰ฅ 18 (20 LTS recommended) โ€” Yarn 4 is bundled via Corepack.
  • Docker (for the local Postgres + Redis).
  • Python 3.12 โ€” only if you want the AI Knowledge Spaces service.

One-command setup

corepack enable          # makes the pinned Yarn 4 available (first time only)
yarn install             # install dependencies
yarn setup               # โฌ…๏ธ starts Postgres + Redis, writes .env files, pushes the schema

yarn setup spins up the databases in Docker, generates local .env files (with a shared auth secret), and syncs the schema โ€” see scripts/setup.mjs. It's idempotent and safe to re-run: existing values are never overwritten, and if a required key goes missing from a .env file it's re-added with the local default.

Then start everything:

yarn dev                 # web โ†’ http://localhost:3000   api โ†’ http://localhost:3001

yarn dev also starts the AI service (apps/ai, :3002), which needs a one-time yarn workspace ai setup first. If you don't want it, run yarn dev:web and yarn dev:server instead.

Open http://localhost:3000 and create a local account (email + password โ€” yarn setup turns that on for development). Everything else is optional.

Optional features

Feature Add to .env Where to get it
Google sign-in GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET (in apps/web/.env) Google Cloud Console โ€” redirect URI http://localhost:3000/api/auth/callback/google
AI quiz generation GEMINI_API_KEY โ€” or LLM_BASE_URL + LLM_MODEL for any OpenAI-compatible server Google AI Studio, or a local Ollama
Image uploads CLOUDINARY_*, or STORAGE_DRIVER=s3 + S3_*, or STORAGE_DRIVER=local. Unconfigured โ‡’ uploads return 503 Cloudinary / any S3-compatible store
Landing GitHub stats GITHUB_TOKEN (in apps/web/.env) GitHub personal access tokens โ€” no scopes needed for public repos
Rate limiting RATELIMIT=ON + UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN Upstash
AI Knowledge Spaces NEXT_PUBLIC_AI_API_URL (web) + apps/ai/.env See apps/ai/README.md
Billing (Buzrr Pro) BILLING=ON + DODO_*, APP_URL (server), DODO_PAYMENTS_WEBHOOK_KEY (web) Dodo Payments โ€” hosted version only; leave off when self-hosting
Landing-page video LANDING_VIDEO_URL (in apps/web/.env) โ€” an MP4 URL Any video host; Cloudinary URLs also get a poster frame

๐Ÿ”ง Environment variables

yarn setup writes sensible local defaults; these are the ones you'll touch. See the .env.example files for the full, commented list.

Variable Required Purpose
AUTH_EMAIL_PASSWORD โœ…ยน ON enables local email + password accounts (web).
GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET โœ…ยน Google sign-in (web).
BETTER_AUTH_SECRET โœ… Signs/verifies session JWTs. Must match between web and server.
DATABASE_URL / DIRECT_URL โœ… PostgreSQL connection (defaults to the Docker container).
REDIS_URL โœ… Redis for live game state (server won't boot without it).
NEXT_PUBLIC_SOCKET_URL / NEXT_PUBLIC_API_URL โœ… Where the browser reaches the API.
GEMINI_API_KEY or LLM_BASE_URL + LLM_MODEL โž– Enables AI quiz generation (Gemini or an OpenAI-compatible server).
STORAGE_DRIVER + CLOUDINARY_* / S3_* โž– Where question images go (unset: uploads disabled).
GITHUB_TOKEN โž– Raises GitHub API rate limits for landing-page repo stats (web).
LANDING_VIDEO_URL โž– MP4 shown on the landing page (web); unset hides the section.
NEXT_PUBLIC_AI_API_URL โž– Where the browser reaches Buzrr-AI; unset hides AI Spaces.
BILLING + DODO_* + APP_URL โž– Enables Buzrr Pro billing. Off = no billing, everyone gets Pro.
UPSTASH_REDIS_REST_* + RATELIMIT โž– Enables rate limiting.
DUEL_BOTS โž– Set to OFF to disable bot opponents in 1v1 matchmaking.

ยน At least one sign-in method is required.

๐Ÿ“œ Scripts

Run from the repo root:

Command What it does
yarn setup One-command local bootstrap (Docker DBs + env + schema).
yarn dev Run web + server with hot reload.
yarn dev:web / yarn dev:server Run a single app.
yarn build Build all apps (what CI runs).
yarn lint / yarn check-types Lint / type-check.
yarn workspace server test Server tests (engine core, question types, storage, AI adapters; billing specs need Postgres).
yarn format Prettier over the repo.
yarn db:push Sync the Prisma schema to the database.
yarn db:studio Open Prisma Studio.
yarn docker:up / yarn docker:down Start / stop the Postgres + Redis containers.
yarn selfhost Build and run the whole self-hosted stack in Docker.
yarn docker:reset Wipe the databases and re-run setup.
yarn workspace ai setup Create the AI service's Python virtualenv.

Troubleshooting

  • Cannot resolve environment variable: DIRECT_URL โ€” the Prisma CLI reads DATABASE_URL/DIRECT_URL from the root .env. If you emptied or edited it, just re-run yarn setup; it restores any missing required keys.
  • Cannot connect to the Docker daemon โ€” start Docker Desktop, then re-run yarn setup.
  • Fresh start โ€” yarn docker:reset wipes the local databases and re-bootstraps everything.

๐Ÿ—‚๏ธ Project structure

buzrr/
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ web/        # Next.js app (+ Better Auth)
โ”‚   โ”œโ”€โ”€ server/     # NestJS API + Socket.IO
โ”‚   โ””โ”€โ”€ ai/         # Buzrr-AI: Python FastAPI + worker (optional)
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ contract/   # zod schemas: the socket + REST contract both apps import
โ”‚   โ”œโ”€โ”€ prisma/     # schema, migrations, generated client
โ”‚   โ”œโ”€โ”€ eslint-config/
โ”‚   โ””โ”€โ”€ typescript-config/
โ”œโ”€โ”€ docs/                # architecture, ADRs, current state
โ”œโ”€โ”€ docker-compose.yml   # the self-hosted stack (dev uses only its Postgres + Redis)
โ”œโ”€โ”€ render.yaml          # Render blueprint for apps/ai
โ””โ”€โ”€ scripts/setup.mjs    # one-command bootstrap

๐Ÿšข Deployment & CI

Every push and PR runs the CI workflow: lint, type-check, server tests and build against real Postgres + Redis; a check that the Docker dev setup boots; a job that brings up the full self-hosted stack with docker compose up and signs up a user; and a Buzrr-AI job (ruff, mypy, migrations, pytest). To gate production deploys on it, open your Vercel project โ†’ Settings โ†’ Git โ†’ Deployment Checks and add the CI workflow's "Lint, typecheck & build" job as a required check โ€” deployments then only go live once CI is green, and a failing run leaves the current production deployment in place.

Self-hosting? docker compose up -d is the supported path โ€” see docs/self-hosting.md. For the hosted setup: apps/web deploys to Vercel; apps/server (Socket.IO, long-lived) needs a container/VM host such as Render, Railway or Fly. apps/ai deploys to Render from render.yaml (a web service plus a cron-driven ingestion worker). Both apps read their config from environment variables โ€” see the .env.example files for what each host needs. For production databases, apply the committed migrations with prisma migrate deploy (local dev uses db push via yarn setup). With billing on, register https://<web app>/api/webhooks/dodo as the webhook endpoint in Dodo.

๐Ÿค Contributing

Contributions are welcome! We use the standard fork-based workflow: fork this repo, branch off main in your fork, and open a pull request from there โ€” see CONTRIBUTING.md for the full steps. Please also read our Code of Conduct before opening a PR. Found a security issue? See SECURITY.md.

๐Ÿ“„ License

AGPL-3.0 ยฉ Buzrr contributors

About

Real-time, open-source quiz platform built for live engagement, instant feedback, dynamic leaderboards and 1v1 battles

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

13 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages