NBA Statistics & Analytics Platform - Compare players, teams, and query stats in natural language.
- Player Statistics - View individual player stats for any season (2015-16 through 2024-25)
- Head-to-Head Comparisons - Compare two players with detailed game logs
- Team Comparisons - Compare teams with game-by-game results
- Natural Language Querying - Ask questions in plain English about NBA stats
- Framework: FastAPI (Python)
- Database: SQLite3
- Data Source: NBA API (
nba_apiPython library) - Server: Uvicorn (ASGI server)
- Framework: React 19
- Build Tool: Vite
- Styling: Tailwind CSS 3.4
- HTTP Client: Axios
- Routing: React Router DOM
- Python 3.12+
- Node.js (Latest LTS)
- pip (Python package manager)
- npm (Node package manager)
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/statpad.git cd statpad -
Set up Backend
cd backend python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Set up Frontend
cd frontend npm install
-
Start Backend Server (Terminal 1)
cd backend source venv/bin/activate # On Windows: venv\Scripts\activate uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
-
Start Frontend Server (Terminal 2)
cd frontend npm run dev -
Access the Application
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
-
Initialize Database
cd backend python app/database/setup.py -
Seed Teams (if needed)
python app/scripts/seed_teams.py
-
Import Data (if needed)
python app/scripts/import_player_stats_csv.py python app/scripts/import_league_gamelogs.py
statpad/
├── backend/
│ ├── app/
│ │ ├── __init__.py
│ │ ├── main.py # FastAPI app and routes
│ │ ├── database/
│ │ │ ├── setup.py # Database initialization
│ │ │ └── __init__.py
│ │ ├── services/
│ │ │ ├── queries.py # Database query functions
│ │ │ └── nlp_query.py # Natural language processing
│ │ └── scripts/
│ │ ├── seed_teams.py
│ │ ├── import_player_stats_csv.py
│ │ └── import_league_gamelogs.py
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── App.jsx # Main app component
│ │ ├── main.jsx # React entry point
│ │ ├── index.css # Tailwind CSS imports
│ │ ├── components/
│ │ │ ├── PlayerStats.jsx
│ │ │ ├── HeadToHeadGameLogs.jsx
│ │ │ └── NaturalLanguageQuery.jsx
│ │ └── services/
│ │ └── api.js # API client functions
│ ├── package.json
│ ├── vite.config.js
│ ├── tailwind.config.js
│ └── postcss.config.js
├── docs/
│ ├── PROJECT_SPECIFICATION.md
│ └── GITHUB_SETUP.md
└── README.md
- Project Specification - Detailed project requirements
- GitHub Setup Guide - Git workflow and commit guidelines
GET /players/{player_name}/seasons/{season}- Get player stats for a season
GET /compare/players/{player1}/{player2}/seasons/{season}- Compare two players' season statsGET /compare/players/{player1}/{player2}/game-logs/seasons/{season}?last_n={N}- Get head-to-head game logsGET /compare/players/{player1}/{player2}/game-logs/all-seasons?last_n={N}- Get game logs across all seasons
GET /compare/teams/{team1}/{team2}/seasons/{season}?include_game_logs=true&last_n={N}- Compare teamsGET /compare/teams/{team1}/{team2}/game-logs/seasons/{season}?last_n={N}- Get team game logs
POST /query- Process natural language query
See API documentation at http://localhost:8000/docs for detailed endpoint information.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
We follow conventional commit format:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, no logic change)refactor: Code refactoringperf: Performance improvementstest: Adding/updating testschore: Maintenance tasks
MIT License
- NBA API data provided by nba_api
- Built with FastAPI, React, and Tailwind CSS