One collector, static files on Cloudflare's edge and a standby VPS. None of our servers sit in the visitor's path.

This page explains how the eleicoes.inema.club dashboard was made. It showed the 2026 2nd-round count live, using official TSE data. A single collector reads the TSE and writes ready-made files; those files sit on Cloudflare servers spread around the world; each person's browser only reads those files. So the number of visitors changes nothing about the load on the TSE or on our machine. It is for anyone who wants to understand, copy or teach this way of building a site that handles traffic peaks at low cost.
The collection talks to the TSE and writes files. The contract defines the format of those files. The site only reads the files and draws the screen. One part can go down or move to another machine without touching the others — which is what happened when the whole operation moved to the VPS.
Taken from the repository history (git log), with a night's sleep in the middle. Everything was done in Claude Code sessions; each fixed failure became a line in FALHAS.md.
The secret is having none of our servers in the visitor's path.
The files sit on Cloudflare servers spread around the world. Our machine only sends files when something changes. If it goes down, the site keeps showing the last result.
A thousand or a million visitors: the collector makes the same request every 15 s. If nothing changed, the TSE answers "not modified" and nothing is transferred.
Each version has its own name (v100340.json) and is never altered. The browser downloads it once and keeps it for a year.
The latest.json manifest is 4.9 KB and says which version is current. The large file is only downloaded when it changes.
A file request is served directly, without triggering any program. According to Cloudflare's documentation, these requests are neither billed nor limited.
The collector writes the version files before the manifest, and the upload to Cloudflare takes everything together at once. Nobody sees a manifest pointing to a file that has not arrived yet.
Each person with the dashboard open requests the manifest every 15 seconds. It was not tested with 1 million real people: this is what the edge needs to deliver.
| People at the same time | Requests per second at the edge | Traffic | Requests to the TSE | Load on our machine |
|---|---|---|---|---|
| 10 thousand | ~670 | ~3 MB/s | 1 every 15 s | none |
| 100 thousand | ~6,700 | ~33 MB/s | 1 every 15 s | none |
| 1 million | ~67,000 | ~330 MB/s | 1 every 15 s | none |
It is a single instance on Cloudflare. With millions of simultaneous sessions, it becomes a bottleneck. If it fails, only the number disappears from the menu; the dashboard keeps working. Fix: split it into several instances and add them up.
Each question calls the Anthropic API. That's why there is a cap: 25 questions per hour and 80 per day per visitor, 1,500 per day on the site.
If the TSE is late or sends a file that doesn't add up, that state stays frozen at the last valid value. We can't be faster than the source.
Each change becomes an upload to Cloudflare taking 18 to 26 seconds (measured in the publisher log). Added to the 15 s collection interval, the site stays about half a minute behind the TSE (estimate).
For the dashboard itself, more people looking doesn't raise the bill. Only the chat and the counter have a per-use cost.
| Item | Cost | Type |
|---|---|---|
| Collector, analyses and publisher | One small VPS (Hetzner CX23: 2 processors, 4 GB). Price in the range of a few euros per month. | ESTIMATE |
| Site and data (files on the edge) | No per-request charge on Cloudflare static files. | FACT |
| Counter and chat (program on Cloudflare) | Within the free allowance at low volume; billed by volume above it, according to the account's plan. | ESTIMATE |
| Chat (Anthropic API, Claude Opus 5.5) | About US$ 0.04 per question, measured in the first conversations. | FACT |
| TSE data | Public and free, no key. | FACT |
On count night, a second machine ran everything for real, ready to take over in minutes.
The VPS had its own collectors, started at 5 pm, writing versions from 500001. That way they never collided with the files already published by the main machine (which start at 100001).
The VPS served both sites at eleicoes2026.inema.club and municipios2026.inema.club, with the same cache rules. The standby could be tested at any time.
One command sent the domains to the VPS and another brought them back. Without the main machine, a manual explains the same switch through the Cloudflare dashboard: ferramentas/vps/TROCA-MANUAL.md (in Portuguese). The backup is installed with ferramentas/vps/instalar.sh vps.
# on election night: send the traffic to the VPS (without --executar it only shows what it would do) ferramentas/vps/trocar_dominios.sh vps --executar # switch back to Cloudflare ferramentas/vps/trocar_dominios.sh volta --executar # today (since Oct 26) the VPS is the primary; reinstall the entire operation: ssh root@<VPS-IP> 'cd /opt/eleicoes2026 && git pull && bash ferramentas/vps/operacao.sh --executar'
On Oct 26 the final data was copied to the VPS, the analyses ran there with identical results (checked by the sha256 fingerprint) and the main machine was shut down. The site never went offline.
Nothing exotic: a handful of simple decisions, applied with discipline.
The full document, with the technical details and file names, is in ARQUITETURA.md.