Live site: ssbstats.app
SSB Stats is a Flask analytics site for a long-running Super Smash Bros league that is tracked like a WWE-style franchise. It turns manually recorded match history into searchable fighter profiles, rivalry comparisons, power rankings, season summaries, championship history, event history, fight logs, and an AI-assisted stats search.
- Browse the full fighter roster with current champion badges
- Compare any two fighters across career and season-level metrics
- View fighter profile pages with accolades, streaks, charts, and fight history
- Explore all-time and season-specific power rankings
- Review season summaries, championship history, and PPV/event history
- Filter and scan detailed fight logs
- Ask natural-language questions against the stats database
- Flask + Jinja2 for server-rendered pages and JSON APIs
- MySQL on AWS RDS for normalized league data and pre-aggregated views
- Vanilla JavaScript + Chart.js for frontend interactions and charts
- Gunicorn on AWS Elastic Beanstalk, with Cloudflare in front of the app
The backend has been split into a small Flask entrypoint plus modular route and service files:
ssbstats/
├── app.py
├── ssbstats_app/
│ ├── __init__.py
│ ├── utils.py
│ ├── repositories/
│ │ ├── base.py
│ │ ├── comparisons.py
│ │ ├── elo.py
│ │ ├── events.py
│ │ ├── fighters.py
│ │ ├── fights.py
│ │ ├── leaderboards.py
│ │ ├── lookups.py
│ │ ├── power.py
│ │ └── seasons.py
│ ├── routes/
│ │ ├── api.py
│ │ └── pages.py
│ └── services/
│ ├── chat.py
│ ├── content.py
│ └── stats.py
├── templates/
│ └── partials/
├── static/
│ └── js/pages/
├── tests/
├── scripts/
│ └── maintenance/
├── generated/
├── fighters.yaml
├── DEV_GUIDE.md
└── requirements.txt
Responsibilities:
app.py: WSGI entrypoint for local runs and Gunicornssbstats_app/__init__.py: app factory and blueprint registrationssbstats_app/repositories/: database access split by feature areassbstats_app/routes/: HTTP route definitionsssbstats_app/services/: payload shaping and feature logicssbstats_app/utils.py: shared serialization and naming helperstemplates/partials/: reusable template sections for large pages like fighter profiles and comparisonsstatic/js/pages/: page-specific frontend scripts extracted from templatesscripts/maintenance/: standalone local maintenance utilities like Elo and Power Score scriptsgenerated/: generated local artifacts produced by maintenance scriptstests/: lightweightunittestcoverage for stable helpers and guard logic
- Python 3.11 recommended
- MySQL credentials for the AWS RDS instance
- IP allowlisting for direct DB access if required by your environment
git clone <repo-url>
cd ssbstats
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp secrets.env.example secrets.envFill in secrets.env:
awsendpoint=your-rds-endpoint.region.rds.amazonaws.com
awsuser=your_database_username
awspassword=your_database_password
awsdb=SmashBros
GROQ_API_KEY=optional_for_chatpython app.pyOpen http://localhost:5000.
python -m unittest discover tests/roster/head2headfighter comparison/fighter/<name>fighter profile/leaderboardpower rankings/seasonsseason summaries/championshipschampionship history/eventsPPV/event history/fightsfight log explorer/chatAI stats search/aboutproject background and architecture story
/api/autocomplete/<category>/api/head2head/api/fighter/<name>/api/fighter/<name>/advanced/api/leaderboard/api/seasons/api/season/<season_id>/api/fights/api/compare/api/championships/api/events/api/chat
- Original domain and dataset rather than reused public sample data
- Real relational modeling with derived views and computed metrics
- End-user product surface on top of the analytics layer
- Clear personal story behind the data and why it exists
- The app still depends on private database access for full local use
- There is not yet a formal automated test suite
- several templates and some frontend scripts are still larger than ideal
- The AI chat is useful, but less reliable than the deterministic stats pages
Production runs through Elastic Beanstalk with:
Procfile->gunicorn --bind 0.0.0.0:8000 --workers 2 app:app- Cloudflare for DNS and HTTPS
- RDS MySQL for the league data
For a fuller architecture walkthrough, see DEV_GUIDE.md.