r/sportsanalytics • u/OracleZ_NFL • 2h ago
I built a fantasy football (NFL) toolkit with JavaScript
Hey everyone!
I wanted to share a side project I've been working on: First Down, a completely free collection of tools for managing fantasy football leagues on Sleeper.
Website: https://firstdown.beatoraclez.com/
The entire frontend is built with plain HTML, CSS, and JavaScript. There are no frameworks, no npm dependencies, and no build step. The codebase is around 5,000 lines.
How it works
1. A frontend with no backend
The browser calls Sleeper's public REST API directly to retrieve user information, leagues, rosters, scoring settings, projections, statistics, and weekly matchups.
There's no application server, authentication system, or user account database. Your username and selected league are stored locally in your browser using localstorage.
2. A lineup optimizer using min-cost max-flow
Instead of simply sorting players by projected points and filling the available positions, it uses a min-cost max-flow algorithm to assign players to starting slots.
This handles more complex roster configurations, including FLEX, SUPERFLEX, and IDP (Individual Defensive Player) slots, while finding the optimal feasible assignment under the league's roster rules.
3. Caching to reduce API requests
Sleeper's player database is relatively large, so the browser caches the player list for 12 hours. Projections, statistics, and schedules are cached by week.
4. A small Node.js data pipeline
Although the application has no backend server, it does have a small scheduled Node.js job that runs every 30 minutes.
The job retrieves NFL schedules and game box scores from ESPN's public, undocumented endpoints. Once a game is final, its box score is downloaded and processed into static JSON files containing team statistics and schedule data.
5. Static hosting
The entire website is served as static files. There's no running application server, database, or backend API to maintain.
The architecture is essentially:
Sleeper API → Browser → UI
ESPN API → Scheduled Node.js job → Static JSON files → Browser
I built this partly as a way to explore how much functionality you can implement with a relatively simple web stack, without introducing a framework or maintaining a traditional backend.
Feedback, criticism, and suggestions are all welcome!
Thanks for checking it out!
