QuizMaker is a Vite, React, and TypeScript quiz-board application backed by a Fastify REST API and PostgreSQL.
- React 19 and Vite
- Fastify with TypeBox request validation
- Prisma ORM and PostgreSQL
- TanStack Query for server state
- Firebase Authentication and Storage in production
- Local user switching when Firebase is not configured
-
Copy
.env.exampleto.envand adjust values if needed. -
Install dependencies:
pnpm install
-
Start PostgreSQL, apply migrations, and load sample data:
docker compose up -d pnpm db:reset:local
-
Start the API and web app together:
pnpm dev
The web app runs at http://localhost:5173, the API at http://localhost:3001, and Vite proxies /api requests to the API.
pnpm dev: run the API and Vite development servers.pnpm dev:api: run only Fastify with file watching.pnpm dev:web: run only Vite.pnpm build: generate Prisma Client, type-check the app and API, and build both.pnpm lint: run ESLint.pnpm db:migrate: apply Prisma migrations usingDATABASE_URL.pnpm db:migrate:local: apply migrations to local Docker PostgreSQL.pnpm db:reset:local: recreate the local schema, apply migrations, and load sample data.pnpm db:seed:local: reload local sample data.
When Firebase variables are configured, the browser sends a Firebase ID token and the API verifies it with Firebase Admin. Set FIREBASE_PROJECT_ID on the API service and the matching VITE_FIREBASE_PROJECT_ID in the frontend build.
Without Firebase, non-production API instances allow the seeded local users. Set ALLOW_LOCAL_AUTH=true explicitly to enable this mode. Never enable local authentication in production.
The connected Vercel project deploys the Vite frontend and Fastify API together. Requests under /api/* run in a Vercel Node function; all other routes use the SPA fallback.
Set DATABASE_URL and FIREBASE_PROJECT_ID in Vercel. VITE_API_URL should remain empty for the default same-origin deployment. Run pnpm db:migrate as a release step whenever new Prisma migrations are added.
Pushes to main automatically apply Prisma migrations and deploy changes to
Firebase Storage Security Rules. Add a GitHub Actions secret named
FIREBASE_SERVICE_ACCOUNT containing the JSON key for a service account that
can deploy Firebase Storage rules to the quiz-maker-mok project. Keep the
JSON key out of the repository.