How I built this portfolio

Pages leave the build finished: the browser gets HTML and about 6 KB of JavaScript, and each demo arrives as it nears the screen. The 3D started in CSS and ended, in part, in WebGL written by hand. This is how, with the proof next to it.

Design system

Everything comes from one file, design/tokens.ts: colours, type, spacing and motion, light and dark. These are its pieces; each one, in full, in the design system (in Spanish).

[ Open the design system (in Spanish) ]

From CSS 3D to WebGL

The site’s 3D did not come out in one go: it started in CSS, hit two walls and ended up split. Next to it, the same figure jogging, drawn both ways, with its frames per second measured now, in this browser.

  1. 01 · 20 Nov

    We started with CSS 3D

    The stack of layers was built twice, in CSS 3D and in WebGL, and both were measured: 60 frames per second each.

    CSS 3D won. It weighed 0.5 KB, not 4.1, and the text stayed HTML: sharp, selectable and readable by a screen reader.

    [ See the two prototypes (in Spanish) ]

  2. 02 · 1 Dec

    Until the camera had to go in

    To tell the MES, the camera had to go into the line: 3D machines, up close and moving.

    In CSS 3D, every face of every box is an element the browser sorts and composites on every frame. One runner is easy; with the crowd, the frames drop. Next to this, measured now: as you scroll down, the camera goes into the crowd.

  3. 03

    three.js did not fit the budget

    The usual way out is three.js. But a page’s scene has a budget of 80 KB compressed, and the whole of three.js weighs 167.

    Either the budget holds or the change does not ship.

  4. 04

    WebGL 2, written by hand

    Only what was needed, with no library: boxes with three tones depending on where each face points, and edges that open on screen with their own smoothing. The whole MES flow weighs 18 KB.

    The same crowd, the same zoom: 60 frames per second.

    [ See the MES flow ]

  5. 05

    The best of both

    Today they live together. The plates of the shorts are still CSS 3D, with their text in HTML; what is inside them (the line, the hospital game, the MES flow) is WebGL, and every frame it follows its plate’s matrix.

    The thin lines are not painted on the plates either: a canvas draws them on top, sharp at any angle.

This is HTML: sharp and selectable, on top of the WebGL.

CSS 3DWebGL · — frames per second · slowest, — ms

How a short is made

Each case opens with a short of about thirty seconds. This is how one is made, step by step, with an example next to it.

  1. 01

    A short is a list

    Each short is a script: a list of steps, each with its duration, the layers on screen, where the camera looks, what shows, what lights up and its subtitle.

    It is data, not code: the same player runs every short, and changing one means changing its list.

  2. 02

    A step changes state; CSS moves it

    Going from one step to the next is not animating: the player marks what shows and what lights up, and each piece goes to its new state with its transition.

    The subtitle comes in word by word, with the word that matters in blue.

  3. 03

    The camera, as CSS variables

    The camera is a set of CSS variables: the zoom, the height and the centre, with the stack’s turn and tilt. When the step changes they change value, and the scene travels to its new place with a single transition.

  4. 04

    The lines, on a canvas

    Almost edge-on, a thin line painted on the plate comes out dashed: the browser paints the plate flat and then tilts it, and the line falls between two samples.

    So the tracks and the risers between layers go separately, on a canvas on top, projected with their plate’s matrix: continuous at any angle.

  5. 05

    The clash with the budget

    With a short on the page, the click on the theme button went from 56–72 to 80–112 ms, on a phone with the CPU four times slower. The limit is 100.

    Each short now carries only the pieces of its script, the chapter bar stopped animating all the time, and the player loads only on the pages that have one.

ChaptersStepsLayers ListenDecideThe flowTaking shapeOne levelThe hospital 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 0 s5 s10 s15 s20 s25 s30 s35 s40 s45 s50 s
Fig. 07.1 The Sant Joan de Déu short’s script, in time: 20 steps in 50 s. On top, the chapters; under each step, the layers on screen. In blue, the steps where a screen stands up to be looked at. It is drawn from the script itself at build time.
  1. What arrives, firstA layer that appears comes down in 0.9 s, and meanwhile its phones wait: they stand up once the layer is still.
  2. StaggeredWhat rises together goes one at a time, 90 ms apart: that way the order reads.
  3. No jumpsEvery piece has its place before it arrives: appearing means changing position, never height, and the page never moves by itself.
  4. Still when askedWith reduced motion, the short stays on its main step; the chapters lead to each part with no animation.

Each rule has its test in the browser: one measures each phone’s tilt every 50 ms, also with the CPU four times slower; another checks that no demo changes height and nothing moves the page; another, that the lines stay continuous at 10°, 30° and 60° of tilt.

How a page is served

The build leaves two editions in the same deployment: the public one at the root and the full one under _full/. Before answering, the access core checks the invitation. Without one, it serves the public edition: of each case, the beginning and a notice; the rest is not in its HTML. With a valid one, the full edition, with a private cache and the viewer’s name in the footer. _full/ is never served by its own path.

How a page is served: the checks let the build through, which leaves both editions on Cloudflare Pages; the access core checks the invitation, with withdrawals, visits and requests in KV and D1, and serves the public or the full edition; the browser gets the HTML and loads each demo as it nears the screen, with its data only in the full edition. BuildTwo editions: root and _full/Cloudflare PagesStatic; hashed assetsAccess corehandle(request, ports)No invitation: the public oneBrowserHTML first; islandsChecksTypes, tests, weight, leaksKV and D1Withdrawals, visits, requestsDemo dataOnly in the full edition Drawing 07 · How a page is served The real material, only by invitationNo framework in the browser Rev B Nov 2026
How a page is served: the checks let the build through, which leaves both editions on Cloudflare Pages; the access core checks the invitation, with withdrawals, visits and requests in KV and D1, and serves the public or the full edition; the browser gets the HTML and loads each demo as it nears the screen, with its data only in the full edition. Drawing 07 · How a page is served · The realmaterial, only by invitation · No framework inthe browser ChecksTypes, tests, weight, leaksKV and D1Withdrawals, visits, requestsBuildTwo editions: root and _full/Cloudflare PagesStatic; hashed assetsAccess corehandle(request, ports)No invitation: the public oneBrowserHTML first; islandsDemo dataOnly in the full edition
Fig. 07.2 Red marks the rule: without a valid invitation, the real material never leaves Cloudflare.

Access, by ports and adapters

The access core does not know where it runs: it gets a request and some ports, and returns a response. The ports are what changes from one provider to another: reading a file of the deployment, checking whether an invitation was withdrawn, saving a visit or an access request.

Each provider is a thin adapter: Cloudflare, with Pages Functions, KV and D1; Netlify, with Edge Functions and Blobs; and Node, for the end-to-end tests and for looking at both editions locally. The core’s tests run with in-memory ports, with no provider at all.

Changing provider means writing another adapter, about a hundred lines, and passing the same tests.

Access, by ports: three adapters, Cloudflare, Netlify and Node, give the same ports to the core, which decides which edition to serve without knowing where it runs; the tests give it in-memory ports. CloudflarePages Functions, KV, D1NetlifyEdge Functions, BlobsNodeFiles; tests and localPortsFiles, withdrawals, logsCorehandle(request, ports)Nothing from the provider insideTestsIn-memory ports Drawing 07b · Access, by ports The core does not know where it runsOne adapter per provider Rev A Nov 2026
Access, by ports: three adapters, Cloudflare, Netlify and Node, give the same ports to the core, which decides which edition to serve without knowing where it runs; the tests give it in-memory ports. Drawing 07b · Access, by ports · The core doesnot know where it runs · One adapter perprovider CloudflarePages Functions, KV, D1NetlifyEdge Functions, BlobsNodeFiles; tests and localTestsIn-memory portsPortsFiles, withdrawals, logsCorehandle(request, ports)Nothing from the provider inside
Fig. 07.3 Red marks the rule: the core imports nothing from the provider; only Request, Response and Web Crypto.
export interface Ports {
  /** Un archivo del despliegue por su ruta (p. ej. /_full/proyectos/). Una carpeta sirve su index.html. */
  asset(path: string, req: Request): Promise<Response>;
  isRevoked(id: string): Promise<boolean>;
  logVisit(v: Visit): Promise<void>;
  /** Guarda la solicitud y, si el proveedor lo sabe, devuelve su número (para el enlace del aviso). */
  saveRequest(r: AccessRequest): Promise<number | void>;
  /** Cuántas solicitudes llegaron desde esta IP desde sinceIso (contra el abuso). */
  recentRequests(ip: string, sinceIso: string): Promise<number>;
  /** Guardar eventos del seguimiento de visitas. Opcional: sin él, /api/evento contesta y no guarda. */
  logEvents?(e: TrackEvent[]): Promise<void>;
  /** Avisar a quien invita de una solicitud nueva: un correo a su dirección (edge/core/mail.ts lo arma). Opcional. */
  notify?(mail: Mail): Promise<void>;
  /**
   * El panel (05/12). admin: el correo de quien entra, ya comprobado (en Cloudflare, el JWT de Access), o null. Sin
   * admin y store, /admin y /api/admin no existen (404).
   */
  admin?(req: Request): Promise<string | null>;
  store?: AdminStore;
  /** Retirar una invitación donde la mira cada petición (en Cloudflare, la KV). */
  revoke?(id: string): Promise<void>;
  rewriteHtml(res: Response, edit: HtmlEdit): Response | Promise<Response>;
  /** Trabajo después de responder (waitUntil). */
  later(p: Promise<unknown>): void;
  secret: string;
  clientIp(req: Request): string;
  country(req: Request): string;
}
Fig. 07.4 edge/core/ports.ts: all a provider has to give.

This visit

How long this page took and how much it weighed in your browser, measured right now with the same measures as the budget. The response to a click shows once you make one.

Main paint · LCP — Budget: < 1,200 ms…
Layout shift · CLS — Budget: < 0.01…
Response to a click · INP — Budget: < 100 ms…
First byte — Budget: no limit…
JavaScript on open — Budget: ≤ 20 KB…
Requests — Budget: no limit…
Fig. 07.5 Measured in this browser with PerformanceObserver. Some browsers do not give every measure: the cell says so.

Budget

If a page goes over, the check fails and the change does not ship.

WhatLimitHow it is checked
Main paint (LCP)< 1.2 s, on fast 4G with the CPU ×4npm run perf
Layout shift (CLS)< 0.01npm run perf
Response to a click< 100 msnpm run perf
JavaScript when a page opens≤ 20 KB gzipnpm run budget and npm run perf
Each demo≤ 60 KB gzip, as it nears the screennpm run budget
The 3D piece≤ 80 KB gzipnpm run budget
Lighthouse on mobile≥ 98Lighthouse on the build
Fig. 07.6 The budget for each page and each demo, in both editions.

Last run

The build served locally by Cloudflare’s server, on a 390 px phone with fast 4G and CPU ×4 emulated, on 30 November 2026. Pages behind an invitation, with a test one. Lighthouse on mobile: 98 to 100 in performance on the project pages and 100 on this one; 100 in accessibility and best practices; 63 to 66 in SEO because nothing on the site is indexed, on purpose.

PageLCPCLSClickJS
/en/projects/mqtt/656 ms096 ms11.6 KB
/en/projects/mqtt/504 ms0104 ms11.6 KB
/en/projects/mqtt/484 ms096 ms11.6 KB
Fig. 07.7 Each page’s run: main paint, layout shift, the response to a click on the theme button, and the JavaScript it loads when it opens, gzipped.

What I did

  1. No framework in the browserTypeScript templates that the build turns into HTML. Only what moves runs in the browser: about 6 KB of JavaScript when a page opens, and each demo separately.
  2. IslandsEach demo is its own module, downloaded as it nears the screen, with its own look. Without it, the page still reads in full.
  3. Images and fontsAVIF and WebP at five widths, with their size fixed and a low-resolution preview while they load; the printer-dot images as lossless PNG. Fonts served from the site itself.
  4. Two editionsThe public one can be walked through without asking and delivers the beginning of each case, like an article behind a paywall: what follows is not in its HTML, so it cannot be found by inspecting. The full one opens with a signed link per person (HMAC-SHA256) that expires, can be withdrawn at once and logs each page seen. The public edition is indexed; the full one, never.
  5. Visits, without cookiesIts own tracking, with no third parties: each event (the page, the short, the demo, requesting an invitation) goes to the access core, which stores it without the IP, with an identifier that changes every day. With an invitation, it is logged under that person’s name.
  6. Checked on every changeTypes, 169 unit tests, the build of both editions, the weight of each page and each demo, a leak scan over what gets published (internal IPs, hosts, emails and names; in the public edition, also that no originals, demo data or hospital app ship, and that the rest of each case is not in the HTML), 103 end-to-end access tests and the timing run.
  7. Two languages, one codebaseThe route sets the language when each page is built; texts, figures and dates come out in each one’s format.

Limits

Request an invitation

For a hiring process or a specific job, freelance included. Tell me what it is about: I read it myself and, if it fits, you get in from this same browser or receive a personal link.

The job post, the project or who sent you the link.
The role or the job, in a few lines.