DEV Community

Kevin Downs
Kevin Downs

Posted on

Personal Project - Trivia App

As Covid-19 continues to change the way we interact with the world, we are all discovering new ways to connect - mainly in online spaces. One of the activities my friends and I started to make a regular occurrence was weekly Trivia Nights on Zoom. As someone learning software development, I always wanted to find a way to make this activity a more pleasant and enjoyable experience. Currently we were working on a simple editable slideshow with categories and point vales, with individual players having the responsibility of keeping track of and actually reading their questions. My goal was to create an application that would allow players to submit categories and questions to a central game, that the game runner would then be able to execute like a browser game.

The only thing I had been struggling with was finding an appropriate stack or framework to work with. After my post last week on using React with Rails, I thought this would be a great way to dive deeper into using those two technologies together as it seemed like the perfect fit for what I wanted to do. As this project is something more complicated than I've worked on before I wanted really take the time to design things properly. I also thought this would be a good opportunity to do a different type of post this week, talking more about my process in designing the structure of the application. Let's get to it!


The most important thing to plan out for me are the models that my application will be using. Since these will form the basis of how the application flows and what features are available to users.

Obviously my first model would be a User as everything else in the application will be user based for the most part. My vision was to have players able to create Games as well as add categories to both their own games as well as other created games. So we need a Game and Category model as well.

Lastly, I wanted each category to consist of five questions, so we will need a Questions model as well.


The Users model will be the most simple out of all of them. Just starting I will only need to have a username and a password attribute to allow a User to register and login.

Attribute Type
username string
password string


The second model and the one that we will access most of our information from will be Game. Each Game will belong to a specific user and so we will definitely want to have a user_id attribute. Each Game should also probably have a name.

We will also want users to be able to link categories to a specific game that may not be theirs. My thought process on this was to generate a unique code for each game that a player could share or input in order to gain access to that game. We will call this something like game_code.

Lastly each Game will have two teams that will be playing against each other. The implementation for this might change in the future but for now I've gone with a team and team_score field for each.

Attribute Type
user_id integer
name string
game_code string
team_a string
team_a_score integer
team_b string
team_b_score integer


The next model to work on is the Category model. I'm still not 100% sold on the implementation of this one, but for now I wanted to have each category link to a specific game and be a container of sorts for our questions. To link to our game, we will need to have a game_id attribute, and we want each category to have a name as well.

Attribute Type
game_id integer
name string


The Question model is the last one! We want to link each question with a specific category so a category_id attribute is a must. Next we need the actual question and answer values for the actual question. To keep track of what each question is worth we will also need a point_value attribute, and lastly a boolean to track whether or not the question has been answered.

Attribute Type
category_id integer
question string
answer string
point_value integer
answered boolean


And those are the basics as to how I'm organizing my application! I hope if you're trying to figure out how to plan your own application out this might give you some ideas on how things can be organized. I think one of the most important things to keep development simple is to have a good scaffold or plan going into things. It's much easier to anticipate changes or tweak things with good planning!

Top comments (0)