Monorepo with two Node.js projects:
sportz: Express + WebSocket live score API with PostgreSQL via Drizzle ORM.websockets: Minimal WebSocket broadcast server for quick testing.
sportz/- main live score appwebsockets/- lightweight WS playgroundREADME.md- this file
- REST API for matches and commentary
- WebSocket server that broadcasts live commentary updates
cd sportz
npm install
npm run devServer logs:
Server is running on http://localhost:8000
WebSocket Server is running on ws://localhost:8000/ws
Set DATABASE_URL in sportz/.env:
DATABASE_URL=postgres://user:pass@localhost:5432/dbname
GET /matchesPOST /matchesGET /matches/:matchId/commentaryPOST /matches/:matchId/commentary
Connect to:
ws://localhost:8000/ws
Subscribe:
{"type":"subscribe","matchId":1}Unsubscribe:
{"type":"unsubscribe","matchId":1}Broadcasts:
{"type":"commentary","data":{...}}{"type":"match_created","data":{...}}cd websockets
npm install
npm run devServer logs:
Webscoket server is live on ws://localhost:8080
npx wscat -c ws://localhost:8080Type a message and hit enter to broadcast to all clients.
- Both projects use
node --watchfor development. - The
sportzapp is the primary service;websocketsis a simple playground.