Project Support Document
Quiz Backend Management API using FastAPI
Project Overview
The Quiz Backend Management API is a RESTful backend application
developed using FastAPI that enables the creation and management of quiz
questions and answer choices. The system provides APIs for performing
CRUD (Create, Read, Update, Delete) operations while maintaining
relationships between questions and answers using a relational database.
This project is designed to help students understand modern backend
development practices, API design, database management, and data
validation techniques.
Project Objective
The primary objectives of this project are:
Develop a scalable and high-performance REST API using FastAPI.
Implement CRUD operations for quiz questions and answer choices.
Store and retrieve quiz data efficiently using a database.
Validate incoming data using Pydantic models.
Understand database relationships using SQLAlchemy ORM.
Build a backend that can be integrated with web or mobile
applications.
Project Scope
Students have the flexibility to choose one of the following approaches:
Option 1: General Quiz Management System
Develop a generic quiz platform capable of supporting quizzes from multiple
domains such as:
General Knowledge
Programming
Mathematics
Data Science
Business Studies
Aptitude
Option 2: Domain-Specific Quiz Management System
Develop a quiz system dedicated to a specific domain, such as:
Data Science Quiz Platform
Python Programming Quiz System
Healthcare Quiz Application
Finance and Accounting Quiz Platform
Students are free to decide whether they want to build a general-purpose
or domain-specific quiz management system.
Dataset Requirements
A predefined dataset is not mandatory for this project.
Students may:
Create their own dataset based on the chosen domain.
Design their own questions, answer choices, and categories.
Populate the database manually or by importing data from CSV or JSON
files.
This flexibility encourages creativity and allows students to work on domains
that align with their interests.
Technologies Used
Technology Purpose
FastAPI Building RESTful APIs
SQLAlchemy Database ORM and management
Pydantic Data validation and serialization
SQLite/MySQL/PostgreSQL Database storage
Uvicorn ASGI server for running FastAPI
System Architecture
Client Request
↓
FastAPI Routes
↓
Business Logic Layer
↓
SQLAlchemy ORM
↓
Database
Database Design
Question Table
Field Name Data Type Description
id Integer Primary Key
Stores the quiz
question_text String
question
Quiz category/domain
category String
(optional)
Choice Table
Field Name Data Type Description
id Integer Primary Key
choice_text String Answer option
Indicates the correct
is_correct Boolean
answer
Foreign Key referencing
question_id Integer
Question
Relationship
One Question → Multiple Choices
One Choice → One Question
API Endpoints
Question Management
Create Question
POST /questions
Creates a new quiz question.
Get All Questions
GET /questions
Retrieves all questions.
Get Question by ID
GET /questions/{id}
Retrieves a specific question.
Update Question
PUT /questions/{id}
Updates an existing question.
Delete Question
DELETE /questions/{id}
Deletes a question and its associated choices.
Choice Management
Create Choice
POST /choices
Adds a new answer choice.
Get All Choices
GET /choices
Retrieves all answer choices.
Update Choice
PUT /choices/{id}
Updates an answer choice.
Delete Choice
DELETE /choices/{id}
Deletes an answer choice.
Pydantic Validation
Pydantic is used to:
Validate incoming data.
Ensure correct data types.
Handle request and response schemas.
Prevent invalid data from being stored in the database.
Example:
class QuestionCreate(BaseModel):
question_text: str
category: str | None = None
SQLAlchemy ORM Usage
SQLAlchemy is used to:
Define database models.
Create relationships between tables.
Perform database operations.
Manage sessions and transactions efficiently.
Core Functionalities
Create
Add new questions and answer choices.
Read
Retrieve questions and answers from the database.
Update
Modify existing quiz data.
Delete
Remove questions and associated choices.
Data Science Relevance
This project can support various Data Science applications, including:
Educational data analysis.
Student performance tracking.
Quiz recommendation systems.
Learning analytics and dashboards.
Personalized learning systems.
Data collection for predictive analytics.
Expected Learning Outcomes
By completing this project, students will gain hands-on experience in:
REST API development using FastAPI.
Database design and management.
SQLAlchemy ORM implementation.
Data validation with Pydantic.
Backend system architecture.
API testing and documentation.
Building scalable backend applications.
Future Enhancements
Students may extend the project by implementing:
User authentication and authorization.
Timer-based quizzes.
Score and leaderboard management.
Quiz attempt history.
Analytics dashboard.
Adaptive quizzes using Machine Learning.
Recommendation systems based on user performance.
Conclusion
The Quiz Backend Management API using FastAPI is a comprehensive
backend development project that introduces students to API development,
database management, and scalable application design.
Students are free to:
1. Build either a general-purpose or domain-specific quiz
management system.
2. Create and use their own datasets based on their chosen domain and
project requirements.
This flexibility allows students to demonstrate creativity while applying
backend development concepts to real-world applications.