API-only Rails 7 app manging game, player, and stat data for Brain Defrost trivia game
This API-only Rails app manages game, player, and stat data for Brain Defrost. Trivia questions for a game are received from an external API via a POST request to this repository. The questions are processed as plain old ruby objects (POROs), stored with Redis caching before being attached to a trivia game and sent to the frontend, and available through all game endpoints. Multiplayer funcionality was implemented using ActionCable for WebSockets.
Brain Defrost is a web application designed to help people become more connected and engaged virtually via a trivia game. Generative AI is used to create custom trivia questions based on the topic and desired question count provided.
To play, a user inputs a topic, number of questions, number of players, a time limit to answer questions, and what they'd like their display name to be. The user is then taken to the game's lobby and provided with a shareable link other players may use to join. Once everyone joins, players may start the game and enjoy answering trivia questions. The correct answer and a list of players who answered correctly is displayed after each question. At the end, players may request the game's final stats via email.
This project was completed for Turing's Capstone Project for Mod 4. Part 1 of the project pertained planning and completing our app's minimum viable product (MVP). Part 2 focused on adding additional features: caching a game's questions with Redis, implementing multiplayer with WebSockets, and allowing users to receive an email of the game results using Sidekiq for the background job.
Repo | Deployment | Description |
---|---|---|
FE Repo | FE Netlify | Play a game of trivia |
BE Repo 1 (you're here) | BE Heroku | Game, player, stats API |
BE Repo 2 | BE Render | Questions API |
git clone <ssh or https path>
cd Brain-Defrost_BE
bundle install
to install gems used for this projectrails db:{drop,create,migrate}
This app uses http://localhost:3000
.
To start the local server run rails server
in the terminal while in the app's base directory (Brain-Defrost_BE-Questions folder).
To stop the local rails server use Ctrl
+ C
in the open terminal.
Rspec was used for testing. This project currently uses rspec-rails v6.1 and rspec-core v3.13.
Terminal commands
bundle exec rspec spec
bundle exec rspec spec/folder_name
# ex: bundle exec rspec spec/models
bundle exec rspec <path/to/test/file>
# ex: bundle exec rspec spec/requests/api/v1/games_spec.rb
bundle exec rspec <path/to/test/file>:test_line
# ex: bundle exec spec/requests/api/v1/players_spec.rb:76
API documentation may be accessed here. Documentation was setup using the rswag gem and SwaggerUI.
To access the API documentation on the local server. Start the server and navigate to http://localhost:3000/api-docs/index.html
in a browser.
If preferred, you can also use Postman to run endpoints, but you will still need to startup the local server using the rails server
command.
Martin Chavez - Github | LinkedIn Jessica Kohl - Github | LinkedIn Laura Vega - Github | LinkedIn
Ethan Duvall - Github | LinkedIn Tayla Phillips - Github | LinkedIn