Skip to content

Architecture

Quiz Builder is a pnpm monorepo with Cloudflare-first deployment. Creators authenticate with Better Auth, manage quizzes from the web dashboard, and publish shareable links. Anonymous visitors complete published quizzes at /q/{permalink} with server-side scoring.

apps/
api/ Hono Workers API (OpenAPI + Scalar + quiz routes)
web/ React + Vite frontend (auth, creator UI, public take)
docs/ Astro Starlight documentation (this site)
storybook/ UI catalog + web feature stories with MSW
e2e/ Playwright smoke and journey tests
packages/
config/ Shared TypeScript presets
types/ Shared Zod schemas and DTOs
api-client/ Orval-generated hooks, MSW, and Faker
ui/ shadcn/ui components and global styles

React 19 + Vite + TanStack Router + Tailwind v4. Imports shared UI from @quiz-builder/ui and API hooks from @quiz-builder/api-client.

Routes:

PathPurpose
/Marketing home
/login, /registerBetter Auth email/password
/dashboardAuthenticated quiz list + session
/quizzes/$quizIdDraft editor or published read-only view
/q/$permalinkAnonymous quiz taking + score

Deploy target: Cloudflare Pages.

Hono on Cloudflare Workers with @hono/zod-openapi for route validation and OpenAPI generation. Interactive docs via Scalar at /scalar; raw spec at /doc.

Auth: Better Auth with email/password at /api/auth/*. Database: Drizzle ORM on Cloudflare D1 (SQLite). See Authentication.

Storybook 10 for @quiz-builder/ui components. Deploy target: Cloudflare Pages.

Astro Starlight site (you are here). Deploy target: Cloudflare Pages.

PackageRole
@quiz-builder/configtsconfig presets (base, react, node)
@quiz-builder/typesZod schemas with .openapi() metadata
@quiz-builder/api-clientOrval TanStack Query hooks, MSW handlers, Faker
@quiz-builder/uishadcn/ui primitives, globals.css, cn() helper

Components use Base UI primitives (@base-ui/react) with the base-nova style. Install or update components via the shadcn CLI from apps/web:

Terminal window
cd apps/web
pnpm dlx shadcn@latest add <component> -o -y

components.json in apps/web and packages/ui controls style and output paths. Apps import primitives through workspace package exports.

Installed primitives include: Button, Input, Label, Textarea, Checkbox, Radio Group, Select, Switch, Form, Card, Separator, Tabs, Dialog, Sheet, Alert, Dropdown Menu, Tooltip, Badge, Skeleton, Sonner, and Table.

Email verification, password-reset email, and outbound mail delivery are intentionally deferred — see Authentication. Production deploy jobs remain disabled in GitLab CI until Cloudflare credentials are configured.