In-house project · Live since election night, 29 November 2026
A results page built for the worst hour of all: the count itself, when the data arrives in bursts and everyone who wants to see it arrives at once. Official results at three levels — national, provincial and municipal — updated as the count progresses, without the source receiving one request per visitor and without the page breaking if it stops responding.
The problem
An election night has two enemies at the same time: the clock and the surge. Results arrive in bursts every few minutes, and in that same moment everyone who wants to see them arrives at once. A page that queries the official source every time somebody opens it will bring itself down, or bring the source down with it. And there is a third trap, the worst one: if the source stops responding for a minute, the easy outcome is to show a broken page exactly when most people are looking at it.
What we built
- National results: how the 350 seats in the Congress of Deputies are shared out, with the 176-seat absolute majority marked, and a table of parties showing seats, votes, percentage and the change since the previous election.
- A majorities panel that predicts no coalitions: it states which combinations reach 176. It includes an adder for selecting parties and watching the total, and a list of the minimal combinations — the ones that fall below the line as soon as a partner is removed. Without that filter you get hundreds of combinations that are arithmetically correct and practically absurd.
- A map of the 52 constituencies, coloured by the leading party, with each province's detail a click away. Ceuta and Melilla also get their own buttons: on the map they are two nearly invisible dots, and each one elects a deputy.
- A municipality finder in two steps — province first, then municipality — across all 8,132 of them.
- The colours are the official ones, published by the Ministry of the Interior in its register of candidacies. They were not chosen here.
What made it hard
The territorial structure the Ministry publishes is 15 MB of JSON covering 30,818 areas, and decoding it costs some 230 MB of memory. Doing that on every visit does not hold up, so it is processed once, before the night begins, and what goes on the server is 693 KB already chewed over. It is the register of areas, not the results: it does not change during the count.
The rest comes down to three architectural decisions, taken precisely because election night offers no second chance:
- The browser never talks to the official source, it talks to our server. However many people turn up, the source receives at most one request every 45 seconds.
- The page is rendered in full on the server, data included. Anyone arriving without JavaScript sees the same results; JavaScript only adds the chart, the map, the finders and the automatic refresh.
- If the source fails, the last good figures are shown with their timestamp. Two-minute-old data, clearly dated, beats a broken page in the middle of election night.
And one point of accuracy that almost nobody bothers with: in a general election a municipality elects no deputies, because the constituency is the province. That is why each municipality shows votes and percentages but never seats, and why the page says so rather than letting the figures be misread.
Technology
PHP with no framework and JavaScript with no libraries · a disk cache that serves the last valid figures when the source does not answer · our own API between the browser and the official source · a flat SVG map of the 52 provinces, generated once from National Geographic Institute geometry, with no mapping library and no CDN · a pre-computed territorial index.
Inside the page



See the page
These are provisional counting figures — the official result is declared by the electoral boards in the following days, and the page says so, with the time of the last update and a link to the source. The page itself is in Spanish.