Building a Robust Quiz Application: A Full-Stack Approach
Hello Hashnode community!
I'm excited to share my latest project: a robust Quiz Application built using Node.js, Express, PostgreSQL, and various other technologies. This project has been an excellent opportunity for me to apply my skills and learn new techniques. In this post, I'll walk you through the key features and architecture of the application.
๐ ๏ธ Project Overview
The Quiz Application is designed to manage quiz questions and multiple-choice options efficiently. The application includes functionality for:
Creating Quiz Questions: Users can add new quiz questions along with multiple-choice options.
Fetching Quiz Questions: Retrieve all existing questions and their associated options.
Deleting Quiz Questions: Remove quiz questions and their options from the database.
๐ Key Features
User Authentication
Register: Users can create a new account.
Login: Users can log in to receive a JWT token for secure access.
Profile: Users can view their profile information (JWT required).
Quiz Management
Add Questions: Post new quiz questions and associated options.
Retrieve Questions: Fetch all questions along with their options.
Delete Questions: Remove a question and its options from the system.
๐ API Endpoints
Here are the main API endpoints for interacting with the application:
Authentication
POST /auth/register: Register a new user.
POST /auth/login: Log in and get a JWT token.
Quiz Category
POST /category: Create a new quiz category (JWT required).
GET /category: Retrieve all quiz categories(JWT required).
DELETE /category/:id: Delete a quiz category by ID(JWT required).
Quiz Questions
POST /questions: Create a new quiz question with options(JWT required).
GET /questions: Retrieve all quiz questions with options(JWT required).
DELETE /questions/:id: Delete a quiz question by ID(JWT required).
User Answers
POST /answers/submit: Submit User answer to quiz question(JWT required).
GET /answers/:id: Retrieve User answer by ID(JWT required).
๐งฉ Architecture & Technology Stack
Backend: Node.js with Express
Database: PostgreSQL
Authentication: JWT (JSON Web Tokens)
Validation: express-validator
Error Handling: Custom middleware
๐ฏ Future Improvements
Here are a few ideas for enhancing the application:
User Roles: Implement different user roles (e.g., admin, regular user).
Advanced Analytics: Provide detailed analytics and reporting for quizzes.
Feel free to check out the GitHub repo for the full code