↓ Skip to main content

Video 9 min

Self-Hosted Expo OTA Updates Without EAS: An Update Server With Django and Tigris

How Expo OTA updates work, and how I self-host them without EAS Update: a Django REST server that speaks the Expo Updates protocol, bundles on Tigris S3, and about a dollar a month to run.

Narrated in English Subtitles: English, 日本語, 한국어, Tiếng Việt, 简体中文

Transcript

A bug fix for my estimating app is ready. It's only JavaScript, so it never goes anywhere near App Store review. It goes straight to users' phones, over the air. Expo's hosted service, EAS Update, will happily do that for me. I built my own server anyway.

It has served every iOS and Android update since. It costs about a dollar a month. But some problems only showed up once I was running it myself. And the most common failure was also the quietest.

Here's how it works, and what running it taught me. One note first. Codemagic has since released Patch, an open-source, self-hostable update server. They paid me to move an app to it and write about it, and asked me to mention it here. More on that at the end.

So how do these updates work? The app's expo-updates library asks an update server for a manifest, sending its platform and runtime version. The server answers with the newest compatible update. The app downloads its JavaScript bundle and assets, and runs the new bundle on its next launch. EAS Update is Expo's hosted server for that protocol.

But any server that speaks it will do. That's what I built.

Why bother? Mostly cost. EAS Update pricing scales with usage, so frequent updates to a growing user base add up. Storage like Tigris stays nearly free. Other reasons might weigh more for you: keeping every asset inside your own infrastructure, rolling out to specific user segments, or not depending on Expo's availability or their next pricing change.

The app asks my Django server for a manifest, instead of Expo's. Django finds the latest update and presigns URLs for its files. The app downloads them straight from Tigris.

A publishing script feeds the whole thing. But everything hangs off two models. The first stores each update with its runtime version, and clients only ever download updates matching their own. iOS and Android get separate rows, because the bundles differ. An active flag is the rollback mechanism.

Deactivate a bad update, and clients fall back to the previous one. The second model tracks the files, keyed by their SHA-256 hash. That makes them immutable, cacheable, and shareable across any number of updates. The manifest endpoint is where app and server actually talk. If there's nothing new, it answers with a two-oh-four, and the app carries on with its embedded bundle.

Asset URLs are presigned, so downloads come straight from Tigris's CDN, not through Django. And the protocol version response header isn't optional. The client checks for it. Publishing hashes every exported asset, uploads them to Tigris in parallel, then swaps the active update in a single transaction. I didn't want production credentials sitting on my laptop.

So I publish locally, and a production endpoint imports the metadata itself. In the app, two settings point it at my server: the update URL, and the runtime version. Keep that runtime version strictly matched. Change native code or upgrade the Expo SDK, and you bump it and publish fresh updates.

Tigris is S3-compatible, considerably cheaper than AWS, and caches at the edge, which matters for multi-megabyte bundles. The manifest endpoint is open on purpose: apps need updates before anyone logs in. But the import endpoint writes to production, so it needs a shared secret, compared in constant time. Asset integrity comes free with the design: everything is verified against its SHA-256 hash, so a tampered asset simply fails. A composite index keeps the manifest query quick, however many updates pile up.

And Tigris handles distribution, caching assets near users on its own. Then there's uploading in parallel. A typical update has fifty or so assets. Publishing used to take about two minutes. Now it takes fifteen seconds.

Day to day, there are three things I do with it. In development, I publish locally and test on a device, which downloads and applies the update automatically. Shipping is the same command with a production flag, then a check of the records in the Django admin. And rolling back? I mark the bad update inactive, and clients receive the previous one.

So what does it cost? The app has around five hundred active users. Storing old updates on Tigris costs about two cents a month. Download traffic, about a dollar. Django rides on the server my API already runs on, so it adds nothing.

Call it a dollar a month, all in. EAS Update at similar usage would land around three hundred to five hundred dollars a year. This paid for itself more or less immediately. Monitoring is nothing fancy: a log of every manifest request, and the Django admin as the de facto dashboard.

Then there are the gotchas, the ones that only show up once you're running it yourself. The most common failure is also the quietest: clients only download updates matching their runtime version. Say the installed app is on runtime one point oh point oh. I publish for one point oh point one. Nothing arrives.

And nothing errors. The client also only applies an update that's newer than its embedded bundle. So if I build a binary after publishing locally, I republish, so the update's timestamp wins. Each manifest asset's key must be a deterministic hash, like the MD5 of the filename, not a random UUID. Otherwise, updates silently break after the first successful load.

A reader, Raphael Mutschler, flagged that one. He had updates working exactly once before he discovered it. He caught another. If the app reads its config at runtime, the manifest's expoClient field must carry it. Without it, the app may launch fine, then crash or refuse to reopen after being closed.

And old updates pile up in Tigris. For now, I clean them up by hand. A scheduled task is the obvious home for this. I haven't got round to it.

There are three things I'd add next. Patch now does all three, and more. First, gradual rollouts, so an update goes out to a slice of users first. Second, an environment field, so staging builds receive different updates from production. And third, download analytics, to answer the "did anyone actually get this?" question properly.

So what did it all come to? The whole system is two Django models, a couple of views, a publishing script and a dollar a month in infrastructure. That's less than I expected going in. The code in the post is simplified, so adapt it. If you'd rather start from something that already runs, Raphael published expo-ota-server.

If you'd rather not write the server at all, there's Codemagic Patch. It's open source, runs on your own box, and can use a Tigris bucket. It speaks CodePush, so you swap in its SDK. And it has what I never built: rollouts, staging, install numbers, mandatory updates, code signing, and rollback on the device. The trade is a new native binary first, and a server to run instead of a command.

My write-up on moving an app across covers how hard it really is. As for what I built, it has quietly done its job, on both platforms, ever since. The full post, with all the code and links, is on jared.lynskey.co.nz.

More videos

Claude Code Worktrees: Running Parallel Agents Without Collisions

Cloudflare 520, nginx 499 and Postgres Stalls: Keeping Webhooks Alive

pytest-testmon: Run Only the Tests Affected by Your Code Change

Replacing My Self-Hosted Expo Update Server with Codemagic Patch