← Code Exchange

Durable Wordle

Wordle where each game is a Temporal Workflow, not a database row. Crash the server mid-game and your progress survives. A small, complete app demoing durable execution, Updates, Queries, and Activities, fully playable from the Temporal CLI or a web UI.


Durable Wordle is the word game you already know, rebuilt so that each game session is a Temporal Workflow instead of a row in a database. There is no database at all. The Workflow's event history is the game state.

Kill the worker mid-guess and restart it, and Temporal replays the history, rebuilds your exact board, and finishes the guess that was in flight. Nothing lost, and you didn't write a single line of save-and-restore code.

How It's Built#

It's a small, complete, readable app that maps Wordle mechanics directly onto the core Temporal building blocks, so it works as both a teaching reference and a "show, don't tell" demo:

  • Start Workflow: each game session starts a Workflow; a deterministic Workflow ID reconnects a returning player.
  • Updates: make_guess mutates state and returns feedback, with a synchronous validator that rejects malformed guesses before anything is written to history.
  • Queries: get_game_state returns the board, read-only, any time.
  • Activities: word selection, real dictionary-API word validation (with Temporal retries), and green/yellow/gray scoring, each visible in the event history.
  • Durable Execution: the worker holds state in memory; a restart replays history to rebuild it with zero data loss.

The Workflow is the whole game#

All game logic lives in the Workflow, never in the API layer. You can play a complete game from the command line with temporal workflow start / update / query, which makes it a great way to show what's actually happening underneath. Two modes ship: a daily word (deterministic via workflow.now()) and a random word (via workflow.random()), both replay-safe.

Stack#

Temporal Python SDK, FastAPI, and Jinja2 on the backend; HTMX and Tailwind on the frontend. uv for packaging, just for tasks, and a Docker Compose setup that brings up the Temporal dev server, worker, and web app with one command.

Great for learning durable execution and the Python SDK by reading one complete example, or for running a quick booth or conference demo that lets someone feel why durability matters.


Language

Python
💖 Community

About the Author

Young man with glasses wearing a bright blue shirt, smiling at camera with bookshelf in background

Mason Egger

Sr. Technical Curriculum Developer

Temporal