Who decides what a button does in a remote UI?
Server-driven UIOpinion6 min readMiniwall team
Part of the series: Server-driven UI: a field guide for app teams
The app decides. A screen that comes from a server should name what it wants, like "buy the annual plan", "turn on notifications" or "go to step two", and code in your app should own what each name does. Let the payload carry a URL only to send someone to a web page. Don't let it carry logic at all.
That's an opinion. Below is what it costs and when we'd pick differently. If server-driven UI is new to you, the field guide maps the whole topic, and how remote UI works follows one screen from JSON to the tap.
Three places a button's behaviour can live
Every remote UI makes this choice, even when nobody wrote it down.
- A name. The payload says
"action": "contact_sales". The app has a list of names it knows and runs the code registered for that one. - An address. The payload says
"myapp://settings/billing"orhttps://example.com/help. The app's router, or the operating system, works out where that goes. - Logic. The payload holds a condition, an expression or a script, and an interpreter in the app runs it.
The question underneath is who can change what a tap does without a release. With names, only the people who ship the app. With addresses, anyone who can publish a screen, within whatever the router accepts. With logic, anyone who can publish a screen, and that's the whole answer.
| Behaviour lives in | Who can change what a tap does | Worst a bad publish can do | What you test | Cost of something new |
|---|---|---|---|---|
| A name | Whoever ships the app | Run a real action at the wrong moment | Each handler, plus "every name exists" | A release |
| An address | Whoever publishes, within the router | Reach any route the router accepts, with any parameters | The router against hostile input | None, until a route is renamed |
| Logic | Whoever publishes | Anything the app's permissions allow | The interpreter's semantics on every platform | None, until the interpreter lacks a feature |
Swipe sideways to see every column.
Names: the screen asks, the app answers
The screen says contact_sales; your code decides whether that opens a form, a chat or nothing today. That keeps the dangerous part small. A bad publish can make a screen ugly, or put a real action behind the wrong label, but it can't invent behaviour. Every tap leads to code that was in the build you tested and, on mobile, the build a reviewer saw. Why that matters for store review is in what App Review says about screens from a server.
It also makes testing finite. You can test each handler, and check in CI that every name your published screens use exists in the build you're about to ship. Here's the whole app side in plain JavaScript (Node 22, no libraries):
// Everything a screen is allowed to ask for. The screen sends a name; this map decides.
const actions = new Map([
['enable_notifications', async () => 'asked for permission'],
['contact_sales', async ({ answers }) => `opened the sales form (team size: ${answers.team_size ?? 'not answered'})`],
]);
const report = (message) => console.warn(message);
export async function runAction(actionId, context) {
const handler = actions.get(actionId);
if (!handler) {
report(`unknown action: ${actionId}`); // a newer screen reached an older build
return false; // do nothing, and keep the screen open
}
return handler(context);
}
// Run in CI against the IDs your published screens use.
export const missingActions = (idsUsed) => idsUsed.filter((id) => !actions.has(id));runAction('start_trial', ...) on this build logs unknown action: start_trial and returns false. missingActions(['enable_notifications', 'start_trial']) returns ['start_trial'], which is the test that should fail before that screen goes live.
One detail: use a Map, not a plain object. {}['constructor'] is a function in JavaScript, so a lookup on a plain object "knows" names you never wrote, and a screen that sends constructor would find a handler.
The cost is versions. A new behaviour needs a new name, and a new name needs a release. Worse, a published screen reaches every build at once, including the ones that don't know the name yet. So the order is fixed: ship the handler, wait until the builds that have it are the ones people use, then publish the screen that sends it. In between, an unknown name must do nothing visible, keep the screen open so nobody is stuck, and get reported so you can see it happening.
Names also split ownership cleanly: publishers combine items from a menu, engineers decide what's on it. Who should own remote UI goes further.
Addresses: flexible, and now your router is an entry point
Deep links look like names you already have. But a URL from a payload is input, and your router wasn't written to take orders from screens. Apple's documentation warns that universal links "offer a potential attack vector into your app", and asks you to validate every parameter and "limit the available actions to those that don't risk the user's data"[1]. Android's security guidance says the same thing in its own words: check each deep link parameter "against a predefined allowlist of expected values", and check state such as whether the user is signed in before acting[2].
Follow that advice and you've built a list of allowed routes and allowed values. That's a list of names, written as strings and spread across a router. We'd rather have the list in one place.
Addresses also rot in a way names don't. A refactor renames /settings/billing, and a screen published last month now points nowhere on new builds while still working on old ones.
Where URLs are the right tool is leaving: terms, privacy, a help article, a mailto:. Even then, allow a short list of schemes and report anything refused. The remote UI security checklist explains why a deny list loses.
Logic: the most power, and everyone who publishes is now a programmer
If the payload can hold conditions or scripts, a new behaviour never needs a release. The bill comes in four parts. Everyone who can publish now writes code that runs with your app's permissions. You need an interpreter on every platform, and they must agree on every edge case. You test semantics, not layout. And on iOS, downloaded interpreted code is allowed only under conditions, which we covered in the App Review post rather than quote again here. JSON, a DSL or components goes through the format side of that decision.
When we'd pick differently
- Your screens point at things you can't list. A content app that links to thousands of articles can't register a name per article. Use one name with a parameter,
open_articleplus an ID, and validate the ID the way Android's guidance validates deep link parameters. Parameters are where names and addresses start to blur, so treat them as input. - You're web only and deploy daily. Then a new name costs one deploy, which makes names cheaper, not worse.
- A screen needs local behaviour a round trip can't give, and you have people who'll own an interpreter for years. Then logic can be worth it. We'd still keep anything that touches money or personal data behind names.
Next step: list every place in your payload where a tap leads somewhere, and write next to each one who can change where it leads. Anything that ends with "whoever can publish" is the first thing to turn into a name.
Sources
- Apple, Supporting universal links in your app (Warning on validating URLs) (opens in a new tab)developer.apple.com · accessed
- Android Developers, Unsafe use of deep links (Mitigations) (opens in a new tab)developer.android.com · accessed
- Miniwall docs, Callbacks (onPurchase, onAction, onOpenUrl) (opens in a new tab)docs.miniwall.app · accessed
- Miniwall docs, Actions and links (button actions, Action ID rules) (opens in a new tab)docs.miniwall.app · accessed


