Design / Web/Kahoots API
27 / 67

05/2023Design / Web

Kahoots API

An HTTP API for Kahoot-style quiz games — quizzes, live sessions, and time-weighted scoring, built on TypeScript, Express, and MongoDB.

╌╌╌╌

An HTTP API for running Kahoot-style quiz games: a host builds a quiz, players join a live session with a game code, and everyone answers the same timed multiple-choice questions. Built with TypeScript, Express, and Node, with quizzes and game state persisted in MongoDB.

The API is organized around three resources exposed over HTTP. A quiz is an ordered list of questions, each with its choices and the index of the correct one. A game is a session created from a quiz, identified by a join code. A player belongs to a game and accumulates a running score. Express routers expose create, read, update, and delete over each, and Mongo stores them as documents so a session survives between requests rather than living in process memory.

Scoring is time-weighted: a correct answer earns points scaled by how quickly it arrives inside the question's time limit, and a wrong answer earns nothing. With response time and question limit , the standard rule awards

for a correct answer and otherwise, so an instant answer is worth the full and one at the buzzer is worth half. The server times each question from when it is served, which keeps scoring authoritative on the backend rather than trusting a client-reported clock.

The game flow runs as a small state machine: a session moves through a lobby while players join, then one question phase per question, then a results phase that reveals the answer and the updated standings. The server holds the current phase and advances it, so every client reads the same state from one source.

References

  1. Project repository
  2. Live site

╌╌ END ╌╌