How tbeidlershenk/hotround works
Project type and purpose
• HotRound is a full-stack, data-driven application with two primary user-facing interfaces:
• A ReactJS single-page web app served by a Flask backend
• A Discord bot built with Disnake
• It scrapes and aggregates PDGA tournament data, stores it in a local SQLite database, then exposes rating-calculation endpoints to both the website and the bot.
File structure
• Top-level:
• Dockerfile.web, Dockerfile.bot, docker-compose.yml, heroku.yml → containerized deployment
• site/ → React frontend (package.json, src/, public/)
• src/ → Flask server (server.py), bot (bot.py), extensions (exts/), models/, utility modules (util/), scraping scripts (scripts/), requirements.txt
• Patterns:
• MVC-style models in src/models/
• Separate “scraper” scripts for data ingestion (src/scripts/)
• Flask app and Discord bot live in the same codebase, likely sharing models and utilities
• SQLite via util/database.py
README for additional insights
• Technologies: Python, Flask, React, Selenium, SQLite, Docker, Heroku
• Data flow: scrape → SQLite → rating algorithm → serve via API
• Two deployment targets: web service and bot service
Main components & interactions
a. Components
1. Web Client (Browser)
2. ReactJS App (site/src)
3. Flask Web Server (src/server.py + exts/* + models/* + util/*)
4. Discord Bot Service (src/bot.py + exts/*)
5. Scraper Service (src/scripts/*.py using Selenium)
6. SQLite Database (data store)
7. External PDGALive Website (data source)
8. Hosting/Orchestration (Docker, docker-compose, Heroku)
b. Relationships & data flows
• Browser → HTTP → Flask server → queries SQLite → HTTP response → Browser
• Discord user → Discord API → Bot service → internal commands → queries SQLite → responds via Discord API
• Scraper service (scheduled or manual) → Selenium → PDGALive → writes new records into SQLite
• Docker-compose orchestrates three containers: web, bot, (optionally a scheduler for scrapers)
c. Architectural patterns/Design principles
• Separation of concerns: frontend vs. API layer vs. bot logic vs. scraper
• Shared domain model: src/models used by both web and bot services
• Single source of truth: SQLite database
• Containerized micro-services style (web vs. bot)
d. Key technologies
• React (site/src)
• Flask (src/server.py)
• Disnake (src/bot.py)
• Selenium (src/scripts/)
• SQLite (util/database.py)
• Docker & Heroku