A apuração do 2º turno para presidente ainda não começou: Flávio Bolsonaro e Lula estão com 0% e 0 votos. Os números aparecem quando o TSE publicar o primeiro boletim do 2º turno. Dados do TSE às 09:38:12 de 15/10/2026.

A technical demo

Brazil Election Count 2026, presidential and governor runoffs, live. An AEM Edge Functions demo (beta) by EadTech.

This site is an EadTech demo, built in a partner sandbox. Its purpose is to put AEM Edge Functions, a feature released in beta, to a real-world test alongside Edge Delivery Services, Universal Editor and App Builder. It has no commercial purpose, it is not a commercial product, and it is not a production service.

We picked a demanding case on purpose: a scoreboard that changes every minute, read on phones, with a statistical projection and without exposing the data source.

Who does what

Two pieces do the work, each on its own shift. The Edge Function runs at the edge on every visit and assembles the page in a few milliseconds, close to the reader. App Builder works behind the scenes: one action wakes up every minute to read the TSE files and run the numbers, and two others answer only the edge. No visit ever reaches the TSE or App Builder directly.

Hover over a piece (or give it keyboard focus) to see what it talks to.

acesso
navegador
Your browser
Phone or computer
Only knows apuracao2026.eadtech.net. Every 15 seconds it checks whether the TSE has published anything new and updates the scoreboard without reloading.
cdn
borda
cdn
AEM CDN
AEM Managed CDN, rules in Cloud Manager
Rejects anything that isn't a read, throttles clients that repeat requests too often and caches each response for 10 seconds. It also adds the secret that locks App Builder to the request.
edge
borda
edge
Edge Function apuracao-borda
AEM Edge Functions (beta), JavaScript on WebAssembly

Assembles every page: it fetches the HTML from Edge Delivery and the panel from App Builder at the same time, puts the numbers into the page and returns it ready to render, with the security headers.

It hides the origin addresses. It also serves /api/painel.json, /llms.txt and the consent routes.

eds,painel,consentimento
origem
eds
Edge Delivery Services
AEM Sites, Universal Editor, AEM Assets
Pages, copy, poll spreadsheets and candidate photos. Everything is edited on the content side, in Universal Editor.
origem
painel
Panel action
App Builder (I/O Runtime)
Reads the latest snapshot of the count and returns the scoreboard JSON. Without the CDN secret, it rejects the request.
state
origem
consentimento
Consent action
App Builder (I/O Runtime)
Stores every cookie choice with a receipt, for one year. The report opens only for users who sign in with an authorized account.
state
dados
tse
TSE files
TSE results publication
State totals and municipality results, published as the count goes on.
dados
coletar
Collect action
App Builder, 1-minute alarm
Wakes up every minute, reads only the TSE files that changed, runs the municipality-level projection with 3,000 simulations and saves the snapshot.
tse,state
dados
state
App Builder State
Key-value storage
Holds the latest snapshot of the count and the consent records.
operacao
github
GitHub
Code, Code Sync and CI workflow
Holds the code. Every push reaches Edge Delivery through Code Sync, and a workflow runs Lighthouse and publishes the score shown in the top bar.
eds
operacao
cloudmanager
Cloud Manager
Config pipeline
Deploys the CDN rules, the Edge Function declaration and the secret environment variable.
cdn,edge

The path of a request

You open apuracao2026.eadtech.net
Browser
The browser only talks to this domain. It never sees a TSE or App Builder address.
AEM CDN
AEM Managed CDN (configured in Cloud Manager)
Filters traffic (the site accepts reads only and throttles repeated requests), sets the security headers and adds to the request a secret that only the CDN knows.
Edge Function apuracao-borda
AEM Edge Functions, JavaScript compiled to WebAssembly (Fastly Compute)
Fetches the page from Edge Delivery and the latest panel from App Builder, merges them and returns the page with the numbers already in it. The panel is cached for 10 seconds, so all requests arriving in that window are served by a single lookup.
Pages and copy
Edge Delivery Services + Universal Editor (AEM Sites)
Every piece of copy, label and notice is edited in Universal Editor. Images come from AEM Assets.
Panel and consent log
App Builder (I/O Runtime + State)
Two web actions, locked by the CDN secret: one serves the latest panel, the other stores each visitor's cookie choice, with no personal data.
Collector
App Builder, 1-minute alarm
Reads the TSE's public results files with conditional caching (it only downloads what changed), runs the model municipality by municipality and saves the panel.

Why an Edge Function

We considered two alternatives: calling App Builder straight from the browser (which exposes the address and opens the action to anyone) and a static page with JavaScript fetching the data (the page opens empty and performance suffers).

Under the hood, in detail

This part is for readers who will open the code or reproduce the setup in another project. Timings were measured on the live domain on October 21.

1. The request, step by step

  1. CDN rules. The request reaches the AEM managed CDN. Traffic filters run first: so-leitura blocks any method other than GET, HEAD or OPTIONS (except on /consent-log), and painel-sem-enxurrada limits each IP to 30 requests per 10 seconds on the /api/* and /consent-* routes, with a 60-second penalty.
  2. The secret is added to the request. A request transformation sets the x-require-whisk-auth header to the value of the pipeline's secret variable APURACAO_ORIGEM_SEGREDO. The browser never sees that value, and it isn't in the code.
  3. Origin selection. An origin selector routes to the edgefunction-apuracao-borda origin the pages (paths with no extension), /llms.txt, /api/painel.json, /api/serie.json and the three consent routes, the latter uncached. Scripts, styles, fonts, images and spreadsheets go straight to Edge Delivery with normal caching.
  4. The Edge Function fetches both origins in parallel. Using Promise.all, it requests the HTML from Edge Delivery (60 s edge cache) and the panel from App Builder (10 s cache), passing the secret along. Measured uncached: 100 to 320 ms for both fetches, and 1 to 2 ms to assemble the page.
  5. Assembly. The function injects into the <head> an island <script type="application/json" id="painel-inicial"> holding the panel, escaped so it can't close the tag or open an HTML comment. At the top of <main> it adds a plain-text summary for clients that don't run JavaScript (search engines and AI agents). The page's JavaScript removes that summary during the eager phase.
  6. Response. It goes out with cache-control: public, max-age=0, s-maxage=10, stale-while-revalidate=30: the CDN keeps it for 10 s and may serve the previous copy for another 30 s while it refreshes. Requests arriving within those seconds are served with a single fetch to the origin. The server-timing header carries both timings to the browser, and the top bar displays them.

2. Inside the Edge Function

3. Inside App Builder

4. The projection model

5. The page in the browser

6. What the sandbox changes

How the projection is calculated

Each municipality is compared with its own first-round result, counting only the two candidates. The swing measured in municipalities already counted estimates what remains in each state, using a country, region and state hierarchy. Municipalities carry more weight the more complete their count is, because a big city's partial count is misleading. Uncertainty comes from 3,000 simulations. The win probability only appears once 15% of polling stations are counted and ballots have come in from at least 20 states.

In a backtest on the 2022 runoff, using the actual order in which ballots arrived, the projection's mean error was 0.04 percentage point.

Performance, accessibility and security

What we learned from Edge Functions

Disclaimer

The official numbers are those of Brazil's Superior Electoral Court (TSE). This site reads the TSE's public files and may lag, fail or show incomplete data. The projection and the win probability are statistical estimates, not results. The site has no affiliation with the TSE, parties, candidates or campaigns.

It is an EadTech technical demo running in the partner sandbox, used under the program's terms: for demonstration and training only, with no production use, no pilot, no load testing and no storage of personal data. AEM Edge Functions is a new feature, and parts of the site may stop working at any time. It is not a product or a commercial service.

Sources: results and candidate photos come from public TSE databases (results files and DivulgaCandContas). The polls cited are those registered with the TSE.