How rowdyslav/glitchme works
Project type and purpose
• This is a full-stack, modular game platform combining:
• A REST-API backend (FastAPI)
• A reactive Flet frontend (web/desktop)
• A Telegram client via Aiogram
• Players connect via the Flet UI or Telegram bot; both talk to the same FastAPI service which stores game state in a database.
File structure
• Top-level directories:
• api/ – contains FastAPI app (main.py, routers/, schemas/, db.py, misc/)
• app/ – Flet frontend (main.py, controls/, misc/)
• bot/ – Telegram bot (main.py, commands/, misc/)
• Configuration & environment: config.json, config.py, env.py
• Requirements.txt lists Python 3.13, FastAPI, Flet, Aiogram
• DB layer abstracted in api/db.py
README for additional insights
• Modular architecture: backend houses “mechanics,” clients only render & send user actions
• QR-based registration, real-time Flet updates
• Configurable rounds/questions in config.json
a. Main components
• FastAPI Backend
• Database (e.g., SQLite/Postgres via SQLAlchemy in api/db.py)
• Flet Frontend (app/)
• Telegram Bot (bot/)
• External Telegram API
• Configuration store (config.json)
b. Relationships & interactions
• Flet Frontend ↔ HTTP(S) ↔ FastAPI
• Telegram Bot ↔ Aiogram Polling/Webhook ↔ FastAPI
• FastAPI ↔ DB (CRUD of games/players/rounds)
• FastAPI ↔ config.json (load questions at startup)
• FastAPI generates QR codes → Flet bot displays them → Clients scan → frontend/bot call PATCH /game/connect/{id}
c. Architectural patterns & principles
• Layered: Presentation (app/, bot/) → API layer → Persistence layer
• Modular: routers/schemas/handlers → easily extend with new endpoints or game mechanics
• Reactive UI: Flet uses event handlers & long-poll updates (or WebSockets/SSE) to reflect state changes
d. Key technologies/frameworks
• FastAPI (api/main.py)
• Flet UI (app/main.py, app/controls/)
• Aiogram (bot/main.py, bot/commands/)
• SQLAlchemy or equivalent in api/db.py
• config.json for dynamic rounds/questions
Detailed capture of essential elements
• Break Backend into components:
• Routers (api/routers/game.py, player.py)
• Schema definitions (models, params, errors)
• misc utilities (QR code, by_bot, by_api handlers)
• DB module
• Frontend modules mapping:
• Controls (game.py, lobby.py, index.py)
• misc helpers (by_api calls)
• Bot modules:
• Command handlers (advanced, base)
• misc (keyboards, messages, by_api)