How jakeharveyy/nrl-tipping-app-backend works
Project type and purpose
• This is a Flask-based backend API for an NRL tipping application. It provides REST endpoints, background jobs (scraping, data updates, AI predictions), server-sent events for real-time updates, and a CLI for maintenance tasks. The frontend (React) is in a separate repo.
File structure
• Top level:
• run.py, .flaskenv, Procfile, docker-compose.yml – entry points and deployment
• app/ – the main application package
• migrations/ – Alembic database migrations
• app/ layout:
• app/__init__.py & config.py – app factory and environment setup
• app/api/ – REST routes and settlement logic
• app/services/ – business-logic services (betting, scraping, AI orchestration)
• app/ai_models/ – trained ML artifacts, feature engineering, prediction pipeline
• app/models.py – SQLAlchemy model definitions
• app/sse_events.py – server-sent events for live updates
• app/utils/ – helper functions
• Scheduling & CLI: uses Flask-APScheduler for periodic scraping & prediction, and Flask CLI commands in run.py.
README for additional insights
• Technologies: Python 3.13, Flask, SQLAlchemy, MySQL/SQLite, Flask-RESTful, JWT, CORS, APScheduler, OAuth, Pandas/NumPy, scikit-learn, Beautiful Soup, Alembic.
• External integrations: NRL.com scraping, Google OAuth, frontend via CORS.
• Execution flow: user actions → REST API → services → database/AI → responses / SSE.
Detailed capture of architectural elements
• Break the backend into:
• HTTP API layer (Flask blueprints / routes)
• Service layer modules (app/services/*.py)
• Data persistence (models.py + migrations + MySQL)
• AI pipeline (app/ai_models/)
• Scheduler & CLI (Flask-APScheduler, run.py commands)
• Real-time updates (sse_events.py)
• External integrations:
• NRL scrapable data source
• Google OAuth
• Deployment context (Docker Compose, Heroku Procfile).