How sandesh-pg/sportz works
Sportz is a sports-match API with persistent match and commentary records, plus WebSocket updates for connected clients. The main workflow accepts match or commentary requests, validates them, stores them in PostgreSQL, and broadcasts successful creations. A seed process can populate the service through its REST API. The graph reflects visible route registration and calls; the README is empty, and the excerpts do not show every seed operation or database migration detail.
Main entry points: matches.js Match Routes · commantary.js Commentary Routes · index.js HTTP Server · server.js WebSocket Service
Components 13
HTTP API
- HTTP Server
src/index.js - Match Routes
src/routes/matches.js - Commentary Routes
src/routes/commantary.js
Match Domain
- Match Validation
src/validation/matches.js - Commentary Validation
src/validation/commentary.js - Match Status
src/utils/matches-status.js
Live Updates
- WebSocket Service
src/ws/server.js - Arcjet Security
src/arcjet.js
Persistence and Seeding
- PostgreSQL
src/db/db.js - Match Data Schema
src/db/schema.js - Seed Process
src/seed/seed.js - Seed Data
src/data/data.json
Other components
- API Client
Connections 18
- API Client → HTTP Server: sends requests
src/index.js - HTTP Server → Match Routes: mounts routes
src/index.js - HTTP Server → Commentary Routes: mounts routes
src/index.js - HTTP Server → WebSocket Service: attaches server
src/index.js - Match Routes → Match Validation: validates input
src/routes/matches.js - Match Routes → Match Status: derives status
src/routes/matches.js - Match Routes → PostgreSQL: reads and writes
src/routes/matches.js - Match Routes → Match Data Schema: queries matches
src/routes/matches.js - Commentary Routes → Match Validation: validates match ID
src/routes/commantary.js - Commentary Routes → Commentary Validation: validates commentary
src/routes/commantary.js - Commentary Routes → PostgreSQL: reads and writes
src/routes/commantary.js - Commentary Routes → Match Data Schema: queries commentary
src/routes/commantary.js - Match Routes → WebSocket Service: broadcasts match creation
src/routes/matches.js - Commentary Routes → WebSocket Service: broadcasts commentary
src/routes/commantary.js - WebSocket Service → Arcjet Security: protects connections
src/ws/server.js - Seed Process → Seed Data: loads seed input
src/seed/seed.js - Seed Process → Match Routes: creates via REST
- Seed Process → Commentary Routes: posts via REST
src/seed/seed.js