How pywebio/pordle works
Project type and purpose (from README + file tree)
Type: Small single-file Python web app (interactive UI) built with PyWebIO.
Purpose: Implements a Wordle-like game (“PORDLE”) served from a local Python process; users play via a browser UI rendered/managed by PyWebIO.
• Game “word” is hard-coded (no DB / no word list service in this simplified repo version).
• No stats, no daily limits, no mobile/desktop keyboard integration (so fewer external components).
• Runtime is: pip install pywebio then python pordle.py.
What the file structure implies architecturally
Top-level files:
• pordle.py: entire application (UI + game logic + server startup entrypoint likely all together).
• requirements.txt: dependency declaration (at least pywebio; possibly others).
• .drone.yml: CI pipeline definition (build/test/lint steps if any).
• README.md: usage docs.
There are no separate src/, templates/, static/, tests/, db/, etc. directories, which implies:
• Monolithic app contained in a single process
• No persistent storage layer
• No explicit API layer (PyWebIO is UI-driven; not a REST backend + separate frontend)
Component (inside pordle.py: UI loop, game rules, state)
This avoids over-inventing components that aren’t present (e.g., databases, separate frontend bundles), while still being “very detailed” about the real runtime boundaries and flows.
User → Browser
• “types guess, submits”
Browser ⇄ PyWebIO Server (Python process)
• “UI events / session updates” over HTTP/WebSocket
PyWebIO Server → Game Rules/Evaluation
• “evaluate guess vs target”
Game Rules/Evaluation → Game State
• “update attempts, statuses”
PyWebIO Server → Browser
• “render updated grid/feedback”
Because the word is hard-coded and there is no persistence:
Architectural patterns/design principles actually present
• Single-process monolith (one Python runtime)
• Server-driven UI (PyWebIO renders UI from Python; not a compiled SPA frontend)
• Session-oriented interaction
• Each player has a session; game state is typically kept in-memory for that session.
• No persistence (ephemeral in-memory state)
• “State is in-memory per session; lost on process restart.”
• Protocol: HTTP/WebSocket session channel
• Components: Entrypoint, UI/Interaction, Game Logic, State
Examples:
• “Guess submission (string)”
• “Rendered UI diff / output commands”
• “Letter feedback statuses (per position)”
• “Session state update”
Explicitly show boundaries
This makes the “single-file architecture” explicit, which is the defining property of this repo.
• No DB, no Redis, no auth, no stats service (README explicitly says no stats and simplified behavior).
• No separate frontend build pipeline (no frontend/, no JS bundle).