← All posts
Engineering

Why We Built a One-Script Architecture

Twelve scripts on your page is twelve points of failure. Here is how we collapsed everything into 2kb.

Anna Kowalski
· 9 min read
W

Most marketing tech is bloated by accident. Each new vendor adds a script tag, a new HTTP request, a new parsing pass. After a few years your site has twelve scripts running and a Lighthouse score in the seventies.

The 2kb constraint

We set a hard limit: the entire client runtime must fit in 2kb gzipped. That ruled out jQuery, lodash, even most polyfills. Anything we couldn't ship in 2kb had to lazy-load, on demand.

What we shipped

A single script that lazy-loads widget code only when triggers fire. Median impact on Lighthouse score: zero. The full widget catalog is delivered as separate, cacheable, lazy-loaded modules — but the core runtime stays under 2kb gzipped.

What we didn't ship

jQuery. React. A bundler runtime. Polyfills for browsers we don't support. Sourcemaps in production. Each of these would have been easy to add. None of them respected the 2kb budget.

Subscribe

Get new posts in your inbox

A new piece each week. No spam, no bots.

Anna Kowalski
About the author
Anna Kowalski

Senior engineer at ClickMeMaybe. Builds the runtime, breaks the bytes. 2kb gzipped is the goal.

All posts by this author →
Notes & comments

Discussion is open to subscribers. Leave your email to get posts and join the thread.

Subscribe to comment

Stop guessing. Start converting.

Install in 5 minutes. Publish your first widget today.

Start Free Now