The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Minimum price
$19.00
$29.00
About the Book
A studio ships a feature: a user uploads a phone video, and the product returns a short clip ready to share. Four months later the cloud invoice has a line nobody can explain: data transfer out, four figures a month, growing faster than the number of users. The answer is already in the room and nobody says it, because it sounds like a joke: the file is on the user’s phone, the phone has four cores, and the browser tab runs JavaScript that the engine compiles to machine code. The server is there because a decade of tutorials put it there, not because the job needs it.
The book takes that invoice apart. The job is one 120 MB video from a phone, and the server does three small things with it: it makes a thumbnail (a small preview image), reads the duration, and computes a checksum (a fingerprint of the file, used to detect changes). In the book’s priced example, 79.3% of what that job costs is egress: the bytes the server sends back to the user, which every cloud provider bills by the gigabyte. The same three things run in the page. The browser asks for byte ranges — small slices of the file — instead of the whole video, decodes them as they arrive, and sends nothing back.
Twenty chapters, one job each, moved from a server into the browser: the program already installed on the user’s phone or laptop. The browser runs JavaScript, and it also runs WebAssembly, a binary format that lets a program written in another language execute at close to native speed. A video is decoded without being downloaded, a photo is converted without being uploaded, a database and a small language model run inside the page.
The argument is not that servers are useless. It is that the server is a default nobody priced. Every chapter measures its job, saves the measurement in a file, and ships the program that reproduces it. The last chapter checks all twenty claims against those files, so a reader can clone the code and see whether the book is telling the truth.
The saving is not a slogan; it is four lines on a cloud invoice, and each one shrinks:
What does not move, the book names and refuses: a 6 GB file in one piece, a text two people edited in the same sentence, a format another application has to read. Every chapter has a section on what its approach cannot do, with the fallback beside it.
Each chapter is a small, complete project:
The book uses no framework, no build system beyond a shell script, and no service to sign up for. The code is TypeScript run directly by Node, the program that executes JavaScript outside the browser; the pages are served by a small local server.
A web developer who has shipped a TypeScript application and has never had a reason to learn what a byte range is, how a page can save a file without opening a file picker (the origin private file system), or what a WebAssembly heap is. The book assumes TypeScript, a terminal, and the patience to read a measurement table. It does not assume browser internals, graphics programming, cryptography or machine learning.
To run the code you need Node 24 or later, a browser built on Chromium (Chrome or Edge; the book was measured on Chrome 157), about 8 GB of RAM, and no account anywhere.
read:own and write:own, in a 358-character token. Put it in the fragment of a URL — the part after #, which browsers never send to a server — and it verifies in 2.68 ms with no request. A forged token that widens the scope is refused.
The export: one HTML file carrying twelve notes, their permission and the reader that checks them, 6,097 bytes, openable in ten years without the application that wrote it. The merge: two devices editing the same three notes, one conflict, a 729-byte state, a merge in 0.10 ms, and a named limit — when two people edit the same sentence, the merge keeps one. The calendar: a Wednesday meeting at 09:00 that stays at 09:00 across the daylight-saving change, exported as 511 bytes of .ics, the calendar file format other applications read. The support report: 369 bytes built from named fields, so it cannot contain a note. The thread pool: six 4 MB buffers hashed in four threads, 45 ms of work and a 42 ms longest frame, against 220 ms of freeze.
The twenty chapters form four parts. Each part answers one question a buyer is really asking, and each chapter inside it builds one piece you can run.
The parts stand on their own: each chapter names the files it needs and closes with what it proved, so you can start with the part that matches the product you are building.
The repository. All the code, the records and the exercises are in one repository: https://github.com/edgarmilvus/zero-backend. Clone it, run npm ci, and ./run_offline.sh runs every chapter's checks in about seventy-five seconds.
Chapter 1 is the only chapter that prices a whole bill — every line, not just the compute. It takes one job (a 120 MB phone video, a preview image, the duration, a fingerprint) and sets beside it the four lines a provider invoices: requests, compute time, the bytes sent out, and storage. The prices come from an AWS price list dated in the chapter and shipped as data, with its source and the day it was read, so every number can be traced and the list can be replaced when the provider changes it.
The other chapters do not invent prices. A bill depends on your contract, your region and your volume, so each chapter gives you the unit your provider charges for — gigabytes of egress, minutes of transcoding, GB-seconds of memory, instance-hours, terabytes scanned, tokens. Multiply those units by the rates on your own invoice and the same arithmetic applies.
If it were printed, this book would run past 600 pages.
About the Author
A veteran software engineer with 20 years of experience, I have dedicated my career to the art of automation. My philosophy is simple: programming should eliminate repetitive chores to unlock human creativity. This journey began early on with the development of custom code-generation tools and has evolved into a deep mastery of LLMs and their APIs. Today, I specialize in architecting AI-driven solutions that handle everything from complex coding and security tasks to advanced knowledge retrieval, transforming the way we interact with technology
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.