A full-stack application that tracks NFL games with weather data and maintains a historical database of games, scores, weather conditions, and betting information.
- 🏈 Real-time NFL Games: Display upcoming NFL games with live weather data
- 📊 Historical Database: Browse historical NFL games from the past seasons
- 🌤️ Weather Integration: Real-time and historical weather data for game locations
- 💾 Cloudflare D1 Database: SQLite-based serverless database for historical data
- 🔄 Agent-to-Agent Communication: Built-in A2A protocol for inter-agent messaging
- 📱 Modern UI: React + TypeScript frontend with responsive design
- Frontend: React 19, TypeScript, Vite
- Backend: Cloudflare Workers with Express.js
- Database: Cloudflare D1 (SQLite)
- APIs:
- ESPN API (NFL games)
- TheSportsDB API (historical games)
- OpenWeatherMap API (weather data)
- Node.js and pnpm installed
- Cloudflare account (for deployment)
- OpenWeatherMap API key (free tier available)
# Install dependencies
pnpm install
# Build the project
pnpm run build-
Set up D1 Database:
wrangler d1 create nfl-games-db
Update
wrangler.jsoncwith the database ID, then run migrations:wrangler d1 migrations apply nfl-games-db --remote
-
Set Weather API Key:
wrangler secret put WEATHER_API_KEY
# Start dev server
pnpm run devpnpm run deploy- Setup Guide - Initial setup and configuration
- Database Setup - D1 database configuration
- Populate Database - How to populate historical data
- API Keys Setup - Setting up API keys
- Agent Communication - A2A protocol documentation
weatherbet/
├── worker/ # Cloudflare Worker backend
│ ├── index.ts # Main worker entry point
│ ├── nfl.ts # NFL game data fetching
│ ├── weather.ts # Weather data fetching
│ ├── database.ts # D1 database utilities
│ └── ...
├── src/ # React frontend
│ ├── components/ # React components
│ └── ...
├── scripts/ # Utility scripts
│ └── populate-all-data.mjs # Populate weather/location data
└── migrations/ # Database migrations
The nfl_games table stores:
- Game information (teams, scores, dates, stadiums)
- Location data (city, state, coordinates)
- Weather data (temperature, condition, humidity, wind, precipitation)
- Betting data (spread, over/under)
GET /api/health- Health checkGET /api/nfl/games- Get upcoming NFL gamesGET /api/nfl/weather- Get games with weather dataGET /api/db/games- Get historical games from databaseGET /api/db/stats- Get database statistics
MIT