A comprehensive web application to track and analyze the economics of major US sports stadiums, focusing on public subsidies and their return on investment.
- Interactive Map: Leaflet.js powered map showing stadium locations
- ROI Analysis: Calculate public cost per win for each stadium
- Data Visualization: Sortable table ranking stadiums by various metrics
- Policy Insights: Detailed funding source information
- Responsive Design: Mobile-friendly interface with dark/light mode
- Professional UI: Economist-style clean typography and data presentation
- Frontend: Astro + Tailwind CSS + Leaflet.js
- Backend: Cloudflare Workers + Hono.js
- Database: Cloudflare D1 (SQLite)
- Deployment: Cloudflare Pages + Workers
Currently tracking 5 major NFL stadiums:
- Allegiant Stadium (Las Vegas Raiders)
- SoFi Stadium (Los Angeles Rams/Chargers)
- Mercedes-Benz Stadium (Atlanta Falcons)
- U.S. Bank Stadium (Minnesota Vikings)
- Levi's Stadium (San Francisco 49ers)
- Node.js 18+
- npm or yarn
- Cloudflare account (for deployment)
-
Install dependencies:
npm install
-
Start development server:
npm run dev
-
Open browser: Visit
http://localhost:4321
-
Create Cloudflare D1 database:
npx wrangler d1 create stadium-economics
-
Initialize database schema:
npm run db:init
-
Update wrangler.toml with your database ID
-
Start worker in development:
npm run worker:dev
-
Deploy worker:
npm run worker:deploy
economics-of-mlb/
├── src/
│ ├── pages/
│ │ └── index.astro # Main frontend page
│ └── worker.ts # Cloudflare Worker backend
├── schema.sql # D1 database schema
├── wrangler.toml # Cloudflare configuration
├── package.json # Dependencies
├── astro.config.mjs # Astro configuration
├── tailwind.config.mjs # Tailwind CSS configuration
└── tsconfig.json # TypeScript configuration
npm run dev- Start Astro development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run worker:dev- Start Worker developmentnpm run worker:deploy- Deploy Worker to Cloudflarenpm run db:init- Initialize D1 database
The application calculates several important metrics:
- Public Cost per Win: Public subsidy divided by total wins since stadium opening
- Subsidy Percentage: Public contribution as percentage of total cost
- ROI Analysis: Efficiency of public investment in terms of team success
- Theme Toggle: Dark/light mode with system preference detection
- View Toggle: Switch between interactive map and data table
- Interactive Sidebar: Detailed stadium information on click
- Responsive Design: Mobile-optimized interface
- Professional Styling: Clean, data-focused design inspired by The Economist
-
Build the project:
npm run build
-
Deploy to Cloudflare Pages:
- Connect your GitHub repository
- Set build command:
npm run build - Set build output directory:
dist
-
Deploy Worker:
npm run worker:deploy
The application includes:
- Interactive map functionality
- Sidebar display on marker clicks
- Theme toggle functionality
- Responsive design verification
- Data table sorting
- ROI calculations validation
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
- Stadium financial data sourced from public records
- Team performance data from NFL statistics
- Map tiles provided by OpenStreetMap
- Icons and styling inspired by The Economist's data visualization standards