Skip to content

RoxanaRujac/Trivia-App

Repository files navigation

Purrfect Trivia - Trivia Game App

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.

Screenshot 2025-03-01 172643 Screenshot 2025-03-01 172653

Table of Contents

  1. Introduction
  2. Technical Details
  3. Use Case Diagram
  4. Design Patterns
  5. Database Structure
  6. Resources
  7. Running the Project

Introduction

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.

Features:

  • 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
Screenshot 2025-03-01 172702 Screenshot 2025-03-01 172711

Technical Details

Frontend:

  • Framework: Flutter
  • Programming Language: Dart

Backend:

  • Framework: Express.js
  • Programming Language: JavaScript
  • Database: MySQL

Application Architecture:

  1. Frontend (Flutter) communicates with Backend (Express.js) using RESTful API.
  2. Backend interacts with the MySQL database to retrieve and store data.
  3. 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.

Use Case Diagram

Initially, the use case diagram was designed as shown below. As the project evolved, it was updated to meet new requirements:

Use Case Diagram

Design Patterns

  • Builder Pattern was implemented for the home_page class to simplify the creation of similar elements (like buttons) on the page. A ButtonBuilder class 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.

Database Structure

The database contains the following tables:

  • user: stores user information
  • questions: stores trivia questions
  • answers: stores possible answers for each question
  • categories: stores different trivia categories
  • user_achievements: stores user achievements
  • user_quiz_progress: stores the user's progress in quizzes
  • achievements: stores possible achievements
  • challenges: stores challenges sent between users

Database Diagram:

{6139B0E8-7ECC-4E8B-B8EE-05032765998C}

Resources

You can view the project on GitHub:
GitHub - Purrfect Trivia

Running the Project

Prerequisites:

  • Node.js (for backend)
  • Flutter (for frontend)
  • MySQL (for database)

Steps to Run:

  1. Backend Setup:

    • Navigate to the backend directory 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.
  2. Frontend Setup:

    • Navigate to the frontend directory and run the Flutter application:
      flutter run
  3. 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!

Conclusion

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.

About

Trivia App is a game featuring multiplayer trivia, leaderboards, and achievements—all wrapped in a playful, cat-inspired theme. Built with Flutter & Dart for a smooth cross-platform UI, a JavaScript API handling game logic and player data, RESTful APIs for communication and a database for storing player progress and achievements.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors