Building a live score app backend: WebSocket, rooms and three data providers in Escore
- Published
- Reading
- 7 min read
- Author
- Mahmoud HamdyFull-Stack Engineer

This is how I built the backend of Escore, a live esports score app, and what I would watch for if you are planning a live score app backend of your own. Escore was a year of full-time remote work, August 2025 to August 2026, for Rov Group, a Saudi company. The backend is 16 Node.js and TypeScript modules in one process, Socket.IO for push, and three commercial data providers behind a single API.
The split on our side was simple. Mohamed Magdy led the Flutter app; I built the backend and the Next.js admin dashboard. The app is live on Google Play and the App Store with more than 5,000 registered users.
What the backend had to carry
A live score screen is the visible part. Behind it sit tournaments in several formats (group stages, single and double elimination, round robin) with generated brackets, matches whose scores change mid-game, and team and player rankings recalculated after every result, weighted by tournament tier, win rate and recency. Add bilingual news in Arabic and English and a transfers module that tracks players moving between teams.
The games covered include VALORANT, League of Legends, Dota 2 and CS2. Two clients read from the same API: the Flutter app and a Next.js web app that holds the editors' dashboard.
One constraint shaped everything. Much of the audience follows matches on slow networks, and although most registered users are on iOS, the app also had to work well on low-end Android phones. Every byte the server sends without need is paid for by someone staring at a spinner.
A modular monolith, not microservices
The backend is a single Node.js and Express process organized into 16 modules: tournaments, matches, teams, rankings, news, transfers, auth and roles, and nine more. Each module owns its routes, controllers, services and data models.
I considered splitting it into microservices and decided against it. That would have meant separate deploys, separate monitoring and network hops where function calls used to be, for a team of two engineers. Module boundaries inside one process give you most of the separation, and they leave the door open: if load ever demands it, a module with clean edges can be pulled out into its own service.
Node.js fit because its non-blocking I/O handles long-lived WebSocket connections alongside ordinary REST traffic. TypeScript earned its keep across 16 modules: change the shape of a tournament object and the compiler lists every call site that depends on it before anything runs.
Why a live score app backend should push instead of being polled
Polling is the obvious first version: the app asks the server for the latest score every few seconds. It works, and it loses twice. Most requests come back with nothing new, and a real change still waits for the next tick.
A back-of-envelope example, not Escore traffic: 1,000 people on a match screen, each app polling every 5 seconds, is 200 requests per second, including the long stretches when nothing happens. With a WebSocket the connection stays open and the server only speaks when there is something to say.
In Escore, Socket.IO runs alongside the HTTP server in the same process. It pushes score updates, bracket changes and in-app notifications to the mobile app and the web as they happen.
Rooms per tournament and per match
Broadcasting everything to everyone does not work for live scores. Many matches run at once across different tournaments, and a fan following one game should not burn mobile data on all the others.
So broadcasts in Escore are scoped with Socket.IO rooms: one room per tournament, one per match. A change in a match goes to that match's room and nowhere else.
Worth knowing about rooms in general: they exist only on the server, and the server decides which room a socket joins (Socket.IO docs on rooms). That makes the join step a natural place to check permissions if some channels are private.
Three providers, one normalized model
We do not produce professional match data; it comes from specialist providers. I evaluated three, PandaScore, GRID and Abios, and integrated all of them.
Each provider has its own response format. Scheduled jobs poll each one at configurable intervals, normalize the responses into one model and persist them in MongoDB. The app and the dashboard read only from the Escore API and never talk to a provider directly.
Yes, the server polls upstream while refusing to let clients poll it. The difference is fan-out: one consumer asks the provider, then pushes the result to every open connection. The separation pays off a second time. Swapping or adding a provider is a backend change, with no new app release and no wait for store review.
MongoDB for nested data, Redis and Docker Compose for operations
Esports data is nested and uneven: a team holds players, a tournament holds stages and matches, a match holds events and stats. I chose MongoDB with Mongoose because the document model fits that shape, and Mongoose adds schema validation and population across related documents.
The API, MongoDB and Redis run as containers under Docker Compose, with Redis handling sessions and cache. The same setup runs in development and on DigitalOcean Droplets in production, so what works on my machine works on the server with the same configuration.
Auth: five roles and short-lived tokens
There are five roles: Super Admin, Admin, Editor, Team Manager and Viewer. Every API route sits behind a role guard, so each user reaches only what their role allows; a verified team manager, for example, edits their own team and player profiles.
Authentication is stateless. Short-lived JWT access tokens pair with encrypted refresh tokens that rotate on every refresh, so the server does not look up a session per request and a stolen access token expires quickly. The same scheme serves the mobile app and the dashboard.
The biggest speed-up came from the client
It would be wrong to credit this to the backend. On the app side, Mohamed reworked how the app integrates with the API and how it serializes JSON. The data payload dropped by 65% and API response latency by 54%, and screens load noticeably faster on slow networks.
My takeaway as the backend engineer: perceived speed is not measured on the server. What you send, and how the phone parses it, is part of the performance budget, and that is much easier to fix when the app engineer and the backend engineer are on the same team.
Two more numbers from the app side: 74% of users are on iOS, and 90% of sign-ups use Google or Apple.
What I would watch for on a new real-time backend
This is advice for anyone building something similar, not a record of what happened on Escore:
- Disconnects are normal on mobile. The Socket.IO client reconnects on its own with growing delays, but events emitted while it was away are lost by default, since delivery is at most once (delivery guarantees). So have the client fetch the current state over REST after every reconnect, then apply live updates on top.
- Rooms do not survive a reconnect on their own. Connection state recovery can restore rooms and missed packets after a short drop, and the docs say plainly it will not always succeed (connection state recovery). Rejoin rooms whenever a connection was not recovered.
- Send the change, not the object. A score update needs a match id and the new score, not the whole match document.
- More than one server instance means each instance only sees its own sockets. You need an adapter such as the Redis adapter for broadcasts to reach everyone, and sticky sessions if HTTP long-polling stays enabled as a fallback (using multiple nodes).
- Respect provider rate limits. Configurable polling intervals are what let you trade freshness against each provider's request limits.
The hard part is not the WebSocket
Opening a persistent connection is a few lines in any library. The time goes into everything around it: keeping data sources away from the client, scoping broadcasts to the people who need them, surviving a flaky network, and checking permissions on the server for every request.
The full project is in the Escore case study, and this kind of work is what our real-time backend and API development page covers.
If your app needs live updates, send us a short brief here.
Share
More on the same topic
| No. | Date | Article | Topics | Reading |
|---|---|---|---|---|
| 02 | Flutter Arabic RTL support: what a bilingual esports app taught me | 5 min read |