Portfolio Web Design & Development Built from scratch

Case 4 of 4

NextGen MasterQuiz

Trivia web app I built on my own as the final project of the Python programming course at Tokio School. A Selenium bot collects the questions, a Flask API stores them in MySQL and serves them, and an Angular front end runs the game with JWT login and a leaderboard.

Stack

Angular
Flask
MySQL
Python

Year

2024

Timeline

8–10 weeks

Role

Full-stack development, solo project

NextGen MasterQuiz trivia app shown on a desktop screen

Context

A course project with every layer in it

The brief was a game that takes trivia questions from a web page, stores them and gives them back to the player at random, with a score at the end. I took it as a way to improve at back end and front end in the same project.

Starting requirements

01

Collect trivia questions and answers from a public web page

02

Store them in a database

03

Serve them to the player in random order

04

Return a final score from 1 to 10

The challenge

How it arrived

A course assignment and two things to learn at once: I had never built an application in Angular, and I still had to choose a Python framework for the server.

How it shipped

A working application: registration and login, random or category-based quizzes, answers checked on the server and a leaderboard with every player's score. Back end and front end are separate repositories that talk over HTTP.

Delivery

A Flask server and an Angular client

The server is split into modules and exposes a REST API. The client is built in Angular 16.2.4.

NextGen MasterQuiz laptop mockup showing the home page of the app
NextGen MasterQuiz laptop mockup, second view of the app
NextGen MasterQuiz trivia app shown on a desktop screen
NextGen MasterQuiz on a laptop, view 1
NextGen MasterQuiz on a laptop, view 2
NextGen MasterQuiz on a laptop, view 3

Decisions

Three decisions, one constraint

I was the only developer and I was learning the front-end framework as I went. That shaped all three.

01

Back end

Flask instead of Django

I weighed both. Flask had more documentation close to what I wanted to build and a gentler learning curve, and that mattered: I was learning Angular on the front end at the same time.

02

Architecture

One module per responsibility

The server is five files. scraper_bot.py collects the questions with Selenium and writes them to MySQL. auth_module.py handles registration, login and sessions with JSON Web Tokens. trivia_module.py builds the quizzes and checks the answers. db_mysql.py manages the database connection and models.py defines categories and questions. A new feature can go in as a new module.

03

Front end

Observables, a guard and an interceptor

Application state and asynchronous data run on observables. AuthService and MyTriviaService hold the business logic and the calls to the API. An AuthGuard protects the quiz and leaderboard routes, and an AuthInterceptor adds the token to every outgoing request. Registration, login and quiz answers use reactive forms.

Impact

It met the course requirements and left me with a working base in Python, Flask and Angular.

The demo video and both repositories are public: demo on YouTube, back-end repository and front-end repository.

Álvaro Fajardo

Design, front-end and development on this project

Author's notes

What cost me the most

State management on the front end. It was my first Angular application and I had to understand how observables work before the quiz behaved as I wanted. Choosing Flask kept the server simple enough to leave me time for that.