Backend REST API for a quiz application built with Node.js, Express, Sequelize, and TypeScript.
- Node.js
- Express.js
- TypeScript
- Sequelize
- PostgreSQL
- MVC
src/
├── config/ # DB config
├── controllers/ # Request handlers
├── services/ # Business logic
├── routes/ # API routes
├── models/ # Sequelize models
├── middlewares/ # Error handling
├── exeptions/ # Custom API errors
├── utils/ # Helpers (catchError)
├── seed.ts # DB seeding script
├── setup.ts # DB setup / initialization
├── app.ts # Express app config
└── index.ts # Server entry point
git clone <repo-url>
cd backendnpm installCreate a .env file in the root:
DB_HOST=localhost
PORT=3000
DB_USER=postgres
DB_PORT=2121
DB_PASS=123123
DB_DATABASE=postgresnpm run seedThis will:
- Connect to the database
- Drop existing tables
- Create new schema
- Insert sample quiz data
npm run devBase URL: http://localhost:3000
| Method | Endpoint | Description |
|---|---|---|
GET |
/quizzes |
Get all quizzes |
GET |
/quizzes/:id |
Get quiz by ID |
POST |
/quizzes |
Create a new quiz |
DELETE |
/quizzes/:id |
Delete quiz by ID |
POST /quizzes
{
"title": "JavaScript Basics",
"description": "Test your JS knowledge",
"questions": [
{
"text": "What is JavaScript?",
"type": "single",
"options": [
{ "text": "A programming language", "isCorrect": true },
{ "text": "A database", "isCorrect": false }
]
}
]
}- React — UI library
- TypeScript — static typing
- TanStack Query — server state management
- Axios — HTTP client
- Tailwind CSS — utility-first styling
- Zod — schema validation
- React Hook Form — form management
- Motion — animations
- Flowbite — UI components
- Sonner — Toaster
src/
├── main.tsx # Entry point
├── store.tsx # React Query client setup
├── config/ # App configuration (Router, axios)
├── style/ # Base styles and global CSS
├── pages/ # Route-level page components
├── layouts/ # Reusable layout sections (Header, Footer)
├── components/ # Shared UI components
└── features/
└── quiz/
├── hooks/ # TanStack Query hooks
├── services/ # Axios API calls
└── validation/ # Zod schemas
git clone
cd frontendnpm installCreate a .env file in the root:
VITE_API_URL=http://localhost:3000npm run dev