Purrfect Trivia is a trivia-based game where players can answer various types of questions to earn points. The game features multiple categories, challenges between players, leaderboards, and achievements. It has a playful theme, with several elements in the game's design (logo, title icon, badges) inspired by cats.
This project was developed as part of the Software Engineering 2024-2025 course.
- Introduction
- Technical Details
- Use Case Diagram
- Design Patterns
- Database Structure
- Resources
- Running the Project
Purrfect Trivia is a simple trivia game where players can:
- Create an account and log in.
- Choose from multiple game categories (e.g., Space, Sports, History, Movies, Music, etc.).
- Play in Quick Game mode or Challenge a friend.
- View the Leaderboard to see how they rank among other players.
- Access a Help page for game instructions.
- View their Profile with stats, achievements, and badges.
- Account Creation (Register)
- Login functionality
- Quick Game Mode with multiple categories
- Challenge Mode for playing against other users
- Leaderboard to view top scores
- Profile Page for displaying achievements and badges
- Framework: Flutter
- Programming Language: Dart
- Framework: Express.js
- Programming Language: JavaScript
- Database: MySQL
- Frontend (Flutter) communicates with Backend (Express.js) using RESTful API.
- Backend interacts with the MySQL database to retrieve and store data.
- The Flow of Data:
- The user sends a request (e.g., login, select questions) from the Flutter app.
- The request is processed by the Express.js API, which performs operations on the MySQL database.
- The backend responds with the required data, which is displayed on the user's interface.
Initially, the use case diagram was designed as shown below. As the project evolved, it was updated to meet new requirements:
-
Builder Pattern was implemented for the home_page class to simplify the creation of similar elements (like buttons) on the page. A
ButtonBuilderclass was created to generate specific types of buttons used in the app. -
State Management Pattern was used for the LeaderboardScreen class (a StatefulWidget). The internal state is dynamically updated using setState, ensuring UI updates whenever the leaderboard data changes.
-
Observer Pattern was used for managing notifications between classes. A Subject (challenge sender) emits notifications, and Observers (users receiving challenges) react accordingly.
The database contains the following tables:
user: stores user informationquestions: stores trivia questionsanswers: stores possible answers for each questioncategories: stores different trivia categoriesuser_achievements: stores user achievementsuser_quiz_progress: stores the user's progress in quizzesachievements: stores possible achievementschallenges: stores challenges sent between users
Database Diagram:
You can view the project on GitHub:
GitHub - Purrfect Trivia
- Node.js (for backend)
- Flutter (for frontend)
- MySQL (for database)
-
Backend Setup:
- Navigate to the
backenddirectory in your terminal. - Run the following command to install the required dependencies:
npm install
- Start the backend API:
node app.js
- The backend should now be running and connected to the database.
- Navigate to the
-
Frontend Setup:
- Navigate to the
frontenddirectory and run the Flutter application:flutter run
- Navigate to the
-
Database Setup:
- Ensure that your MySQL server is running.
- Import the database schema (provided in the project files) to create the necessary tables.
Once everything is set up, you should be able to access the app and play the game!
Purrfect Trivia combines multithreading, a well-structured architecture, and interactive UI elements to create a fun and engaging trivia experience. With the integration of design patterns, real-time database updates, and user challenges, the project demonstrates practical use of various software engineering principles.



