Web app for football: matches, tables, top scorers, charts.
Your favorite leagues are saved in Postgres. Live scores and league data come from football-data.org when you use the app. They are not copied into the database as a separate cache.
- Copy
.env.exampleto.env.local. - Add the values described in Environment variables below.
- Run:
npm install
npm run db:migrate
npm run dev- Open http://localhost:3000.
If something is missing:
- No
FOOTBALL_DATA_API_TOKEN→ match and league APIs return 503. - No
DATABASE_URL→ migrations and favorites do not work.
Put these in .env.local. Do not commit real keys or passwords.
FOOTBALL_DATA_API_TOKEN (you need this)
Register and copy a key: football-data.org. The app uses it only on the server (src/app/api), not in the browser.
DATABASE_URL (you need this)
Postgres URL for Prisma. Used for favorites and for running migrations.
FOOTBALL_DATA_MATCH_MAX_DAYS (optional)
How many days of fixtures to request. Default is 10. Maximum is 366.
- Matches, competitions, standings, scorers: loaded from football-data.org through your own
/api/...routes. The browser never sees the football-data token. - Favorite leagues: read and written in Postgres with Prisma.
npm run dev— local dev servernpm run dev:webpack— same, Webpack instead of Turbopack if you need itnpm run build— production buildnpm run vercel-build— migrations,prisma generate, thennext build(for Vercel)npm run db:migrate— run migrations locally (uses.env.local)npm run db:deploy— apply migrations (e.g. production)npm run lint— ESLint
- Connect the GitHub repo. Vercel usually detects Next.js by itself.
- Add a Postgres database and set
DATABASE_URLin the project env vars (Production; add the same for Preview if you want preview deployments to hit a real DB). - Set
FOOTBALL_DATA_API_TOKEN. AddFOOTBALL_DATA_MATCH_MAX_DAYSonly if you want to change the default. - Deploy. This repo includes
vercel.jsonwithbuildCommand: npm run vercel-build(runsprisma migrate deploy, then build). If you ever remove that file, set Build Command tonpm run vercel-buildin the Vercel project settings.
Vercel does not bring back a removed project. Create a new project from the same Git repository.
- Env vars do not copy over — enter
DATABASE_URLandFOOTBALL_DATA_API_TOKENagain (and optional vars) for each environment you use. - Postgres — the old database integration is tied to the old project. Create a new Vercel Postgres (or point
DATABASE_URLat another Postgres instance you control). - First successful deploy runs migrations against whatever
DATABASE_URLyou set. - Custom domains — add them again under the new project’s Domains settings.
The free football-data.org plan has request limits. Under heavy load you may see HTTP 429.