A modern, full-stack Quiz Builder application built with React, TypeScript, Express, Prisma, and PostgreSQL.
📄 Technical Specification: Check out the full Task Requirements.
A full-stack web platform where users can create custom quizzes with various question types, view all available quizzes in an interactive dashboard, and inspect the structure of individual quizzes in detail.
- 📝 Dynamic Quiz Creation: Build quizzes on the fly with multiple question types (Boolean, Short Answer, Multiple Choice Checkboxes).
- 📊 Quiz Dashboard: Clean, responsive list of all quizzes with question counts and creation timestamps.
- 🔍 Detailed Structure View: Dedicated read-only view to inspect questions, options, and correct answers.
- 🗑️ Quiz Management: Delete quizzes with automatic cascade deletion of related questions and options.
- 🛡️ End-to-End Validation: Strict type safety and validation with Zod on both frontend and backend.
- ☁️ Production-Ready: Configured for seamless deployment on Vercel (frontend), Render (backend), and Neon / Render (PostgreSQL).
- Node.js & Express.js
- TypeScript
- Prisma ORM (v7)
- PostgreSQL (
@prisma/adapter-pg,pg) - Zod (Request Validation)
- CORS & Dotenv
- Next.js 15 (App Router)
- React 19
- TypeScript
- Tailwind CSS
- React Hook Form & Zod
- Axios & React Hot Toast
- Zero-Downtime Local Mode (Browser Storage Fallback)
quiz-builder/
├── client/ # 💻 Next.js 15 App Router client application
│ ├── src/
│ │ ├── app/ # Next.js App Router (Layout, Home, Quizzes, Detail, Create)
│ │ ├── components/ # Reusable UI components & Header
│ │ ├── context/ # Storage Mode & Offline context
│ │ ├── services/ # API client & local browser storage fallback
│ │ ├── types/ # TypeScript interfaces
│ │ └── validators/ # Client-side form schemas
│ └── .env.example # Example client environment variables
├── server/ # ⚙️ Express.js REST API
│ ├── prisma/ # Prisma schema, migrations, and seed script
│ │ ├── schema.prisma # PostgreSQL schema definition
│ │ └── seed.ts # Database seed with sample quizzes
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── lib/ # Prisma client initialization (PostgreSQL adapter)
│ │ ├── routes/ # Express route definitions
│ │ ├── services/ # Business logic & database queries
│ │ └── validators/ # Zod validation schemas
│ ├── prisma.config.ts # Prisma configuration
│ └── .env.example # Example server environment variables
├── render.yaml # Render Blueprint for one-click backend deployment
├── docs/ # 📄 Project documentation
└── README.md
- Node.js (v18 or higher)
- npm
- PostgreSQL Database URL (e.g., from Neon.tech — free, or local PostgreSQL)
-
Navigate to the
serverdirectory:cd server npm install -
Create a
.envfile from.env.example:cp .env.example .env
Add your PostgreSQL connection string:
PORT=3000 DATABASE_URL="postgresql://user:password@host/database?sslmode=require"
-
Push the schema to PostgreSQL and seed initial data:
npx prisma db push npm run seed
-
Start the development server:
npm run dev
🌐 The backend API will be running at
http://localhost:3000(Health check athttp://localhost:3000/health).
In a new terminal window:
-
Navigate to the
clientdirectory:cd client npm install -
Start the Vite development server:
npm run dev
🌐 The frontend web app will be running at
http://localhost:5173(proxies/apirequests tohttp://localhost:3000automatically).
We recommend Neon.tech (free, never expires, fast serverless PostgreSQL):
- Sign up at neon.tech and create a project (e.g.,
quiz-builder). - Copy the Connection String (it looks like
postgresql://user:password@ep-...neon.tech/neondb?sslmode=require).
(Alternative: You can also create a PostgreSQL instance on Render.com, though Render's free databases expire after 30 days).
- Push your project to GitHub.
- Go to Render Dashboard -> New -> Web Service.
- Connect your GitHub repository.
- Fill in the service settings:
- Name:
quiz-builder-api - Root Directory:
server - Runtime:
Node - Build Command:
npm install && npx prisma generate && npx prisma db push && npm run build - Start Command:
npm start - Health Check Path:
/health
- Name:
- In Environment Variables, add:
NODE_ENV:productionDATABASE_URL: (paste your PostgreSQL connection string from Step 1)
- Click Create Web Service.
- Once deployed, copy your Render service URL (e.g.,
https://quiz-builder-api.onrender.com).
- Go to Vercel Dashboard -> Add New... -> Project.
- Import your GitHub repository.
- Configure the project:
- Framework Preset:
Vite - Root Directory: click Edit and select
client.
- Framework Preset:
- Under Environment Variables, add:
VITE_API_URL: (paste your Render backend URL, e.g.https://quiz-builder-api.onrender.com)
- Click Deploy.
- That's it! Your Quiz Builder is live with a custom Vercel domain and backed by a PostgreSQL database on Render.
- Open the website in your browser.
- Click Create Quiz in the top navigation bar.
- Enter a quiz title (e.g. "World Geography & Capitals").
- Add questions using the interactive question builder:
- True / False: Select the correct boolean answer.
- Short Answer: Provide the question text and expected answer.
- Multiple Choice: Add multiple options and check the boxes for correct ones.
- Click Save Quiz!
cd server
npx prisma studio🌐 Launches a visual database manager at
http://localhost:5555to view and edit PostgreSQL tables directly.
npm run dev— Start development server with auto-reloadnpm run build— Compile TypeScript todist/npm start— Run compiled production servernpm run prisma:generate— Generate Prisma Clientnpm run prisma:push— Sync Prisma schema with databasenpm run seed— Seed sample quizzes into the databasenpm run lint— Run ESLint checksnpm run format— Format code with Prettier
npm run dev— Start Vite development servernpm run build— Type-check and build production bundlenpm run preview— Preview production build locallynpm run lint— Run ESLint checksnpm run format— Format code with Prettier