A live trivia game with phone play, built by Claude Code on Elements A live trivia game with phone play, built by Claude Code on Elements

A live trivia game with phone play, built by Claude Code on Elements

Hosts build quizzes and run them on a big screen. Players join from their phones with a code, race the countdown, and see their points and rank after every question.

View the code on GitHub →

How it's built

Quizlight needed a big screen and a room full of phones that move through each question together, a fair countdown, scoring and accounts for hosts. Each of those is a part of Elements, so the agent spent its 21 minutes on the game itself.

  • One game state for every screen. A channel carries a snapshot of the game, and every join, answer and host action sends a fresh one, so the big screen and each phone redraw together. The answer and new scores join it when the question closes.
  • Players join from their phones. A player types the six-digit code from the big screen and a nickname and gets their own game page. Nicknames are unique and a game holds up to 50 players.
  • Scoring timed on the server. Each answer is timed in SQL from when the question opened, so points fall from 1,000 for an instant answer to 500 at the buzzer, with a short grace for the network. The question closes the moment the last player answers.
  • A countdown in step. Each screen turns the server's remaining time into a local deadline once per question, so the phones and the big screen count down together.
  • Server calls as function calls. The host's controls and the quiz editor call server functions straight from the page with @rpc.
  • Data and sessions from SQL. Migrations define the game and seed a host login with three quizzes of ten questions each. Hosts sign in with a session, and each game's controls stay with the host who started it.

Why Elements

Elements is the integrated stack for web apps: a build server and tooling, an app framework, a Postgres database and deployment, engineered as one system. Your editor, tools and one or many agents all connect to the same always-on build server, which runs type checking, program analysis, migrations and tests as the agent builds. Built-in guardrails keep the app structured correctly and secure as it grows from prototype to production.

Run it yourself

Install Elements

  1. Copy the install command.

    curl -fsSL https://elements.dev/install | sh
    View script
  2. Open a terminal in VS Code: choose Terminal › New Terminal from the menu bar at the top of your screen.

  3. Copy and paste the command into the terminal and press Enter.

    VS Code
    The install command pasted into the VS Code terminal The install command pasted into the VS Code terminalcurl -fsSL https://elements.dev/install | sh

Create your copy of this app

  1. When the install finishes, press Shift + Command + P to open the command palette.

  2. Type new app, select Elements: New App in the list and press Enter.

    VS Code
    VS Code's command palette with Elements: New App selected VS Code's command palette with Elements: New App selected
  3. Copy the text.

    VS Code
    quizlight -scaffold=elementscode/demo-quizlight
  4. Paste the text into the Elements: New App name box and press Enter.

    VS Code
    The name box Elements: New App opens, with this app's name and scaffold typed in The name box Elements: New App opens, with this app's name and scaffold typed inquizlight -scaffold=elementscode/demo-quizlight

    Your copy of this app opens in VS Code with a terminal and Claude Code on the left.

Start your app

  1. Copy the command.

    Terminal
    elements start
    
  2. Paste the command into the terminal and press Enter.

    VS Code
    elements start typed into the terminal of the new app elements start typed into the terminal of the new app

    Your app opens in VS Code's browser, next to the terminal and Claude Code.

New to Elements? Read the getting started guide.