How scribble-rs/scribble.rs works
Scribble.rs is a browser-based, account-free Pictionary game. Players create or join lobbies, configure game options, and play drawing-and-guessing rounds; the server handles lobby state and real-time events. The graph separates HTTP/API handling, game rules and state, and the browser experience, with configuration, translations, and metrics as supporting services. The principal runtime and several cross-module references are shown in sampled source or the source index; unsampled frontend wiring is left out rather than inferred.
Main entry points: lobbies.go Lobby Registry · lobby.go Game Lifecycle · main.go Server Runtime · index.go Lobby Creation
Components 21
Server Entry
- Server Runtime
cmd/scribblers/main.go - Configuration
internal/config/config.go - Metrics
internal/metrics/metrics.go
HTTP Interfaces
- API Routes
internal/api/http.go - Lobby API
internal/api/v1.go - Input Validation
internal/api/createparse.go - WebSocket Handler
internal/api/ws.go - Frontend Routes
internal/frontend/http.go - Lobby Creation
internal/frontend/index.go - Lobby Entry
internal/frontend/lobby.go
Game Domain
- Lobby Registry
internal/state/lobbies.go - Game Lifecycle
internal/game/lobby.go - Game Data
internal/game/data.go - Shared Rules
internal/game/shared.go - Word Lists
internal/game/words.go - Text Sanitization
internal/sanitize/sanitize.go
Browser Experience
- Translations
internal/translations/translations.go - Lobby Client
internal/frontend/lobby.js - Drawing Tools
internal/frontend/resources/draw.js - Keyboard Controls
internal/frontend/resources/keyboardManager.js
Other components
- Players
Connections 28
- Server Runtime → Configuration: loads settings
cmd/scribblers/main.go - Server Runtime → API Routes: registers routes
cmd/scribblers/main.go - Server Runtime → Frontend Routes: registers routes
cmd/scribblers/main.go - Server Runtime → Lobby Registry: starts cleanup
cmd/scribblers/main.go - API Routes → Metrics: serves metrics
internal/api/http.go - Lobby API → Game Lifecycle: creates lobbies
internal/api/v1.go - Lobby API → Lobby Registry: stores and looks up
internal/api/v1.go - Lobby API → Input Validation: validates settings
internal/api/v1.go - Input Validation → Configuration: reads bounds
internal/api/createparse.go - Input Validation → Shared Rules: uses game types
internal/api/createparse.go - WebSocket Handler → Lobby Registry: finds lobby
internal/api/ws.go - WebSocket Handler → Game Lifecycle: dispatches events
internal/api/ws.go - WebSocket Handler → Metrics: tracks connections
internal/api/ws.go - Game Lifecycle → Text Sanitization: sanitizes text
internal/game/lobby.go - Lobby Registry → Game Lifecycle: stores lobbies
internal/state/lobbies.go - Lobby Registry → Configuration: uses cleanup settings
internal/state/lobbies.go - Lobby Creation → Input Validation: validates options
internal/frontend/index.go - Lobby Creation → Game Lifecycle: creates lobby
internal/frontend/index.go - Lobby Creation → Lobby Registry: uses lobby state
internal/frontend/index.go - Lobby Creation → Translations: uses translations
internal/frontend/index.go - Lobby Entry → Lobby Registry: looks up lobby
internal/frontend/lobby.go - Lobby Entry → Game Lifecycle: joins player
internal/frontend/lobby.go - Lobby Entry → Lobby API: uses lobby data
internal/frontend/lobby.go - Lobby Entry → Translations: selects language
internal/frontend/lobby.go - Frontend Routes → Translations: uses translations
internal/frontend/http.go - Lobby Client → Keyboard Controls: uses controls
internal/frontend/lobby.js - Players → Server Runtime: plays game
README.md - Players → Lobby Client: uses client