A simple live football score tracker with:
- Node/Express SSE server
- React + Vite client
- Admin panel to create/edit/delete matches
- User view to select a match and see live score
server/Express server exposing REST and SSE endpointsclient/React app (admin and user modes)
- Node.js 18+
- pnpm (recommended) or npm
pnpm -C server install
pnpm -C server run devServer runs at http://localhost:5000
Admin UI (port auto or 5173):
VITE_ROLE=admin VITE_SERVER_URL=http://localhost:5000 pnpm -C client install
VITE_ROLE=admin VITE_SERVER_URL=http://localhost:5000 pnpm -C client devUser UI (choose another port):
VITE_ROLE=user VITE_SERVER_URL=http://localhost:5000 VITE_PORT=5174 pnpm -C client devOpen:
- Admin: http://localhost:5173
- User: http://localhost:5174
GET /matches→ list matchesPOST /matches{ team1, team2 } → create match (default score0 : 0)PUT /matches/:id{ team1?, team2?, score? } → update; score must benumber : number(e.g.2 : 1)DELETE /matches/:id→ remove matchGET /events→ Server-Sent Events (SSE) stream of the full matches array
- CORS enabled for development
- SSE reconnect handled by browser; a "LIVE" badge shows when connected
- To secure admin actions, set and validate an
x-admin-tokenheader (optional)
- Server:
dev,build,start - Client:
dev,build,preview
matchfootball.mp4
MIT