skip to content

In a mobile app with server-driven screens, what does the server send, and what must the installed build already contain?

level: juniorimportance: must knowfreq 32%

answer

  1. data, not code, crosses the wire
  2. a tree of typed nodes with props
  3. type string looked up to a renderer
  4. a tap names an action from a list
  5. a new component type needs a release

basics

~20 s

The server sends data: a tree of typed components with their properties and tap actions. The build must already ship a renderer for each component type and a handler for each action, so the server can recompose only what the build knows.

solid answer

~40 s

With server-driven UI the server returns a **layout**: a tree, or an ordered list of sections, of nodes that each carry a `type`, its properties and, where tappable, an action such as `open_screen` or `add_to_cart` drawn from a fixed vocabulary. The app holds a **component registry** that maps each `type` to a native renderer, plus a handler for each action type, and walks the tree to build the screen. Nothing executable crosses the wire, so a merchandising team can reorder the grocery home screen, swap the week's promotion or change copy without a release, but a genuinely new component or tap behaviour still needs a new build. The layout also carries a **schema version**, so the server knows which component types a given build can draw.

go deeper

for a junior

Recall the split: the server sends a tree of typed components with props and actions, and the build holds the renderers and action handlers that turn it into native views.

for a middle

Explain the registry as the build's vocabulary and why actions come from a fixed list. Show which weekly changes ship as layouts and which still need a release.

for a senior

Name the operating costs up front: offline launch, tracing which layout a user got, rendering cost of deep trees, and screens that should stay native.

for a principal

Frame SDUI as moving arrangement decisions from release cadence to data cadence, and argue which teams and screens earn the platform cost of a schema, registry and tooling.

## The problem server-driven UI solves An installed app changes only when a user installs a new build, and that means a store review followed by weeks of gradual adoption. A grocery retailer's merchandising team, though, rearranges the home screen every week: which promotion leads, whether the "buy again" row sits above seasonal recipes, what the checkout upsell suggests. **Server-driven UI** (SDUI) moves the *arrangement* of a screen out of the binary and into a server response, so those weekly changes ship as data. The key word is *arrangement*. The server describes the screen; the app still draws it with its own native components, its own accessibility behaviour and its own design tokens. ## What crosses the wire The server sends a **layout**: a document written in a **layout schema**, the agreed format both sides use to describe a screen. Usually it is a tree of nodes, and each node carries: - a `type`, a string naming a component the app knows, such as `hero_banner`, `product_carousel` or `section_header`; - **props**, the data that component needs: a title, an image URL, a data source name, a colour expressed as a design-token name rather than a raw value; - **children**, nested nodes for containers such as a vertical stack or a grid; - an optional **action**, describing what a tap does, also expressed as data. ```json { "schemaVersion": 4, "screen": "home", "root": { "type": "vertical_stack", "children": [ { "type": "hero_banner", "props": { "title": "Weekly deals", "imageUrl": "https://cdn.example.com/w41.jpg" }, "action": { "type": "open_screen", "target": "promotions/week-41" } }, { "type": "product_carousel", "props": { "title": "Buy again", "source": "buy_again" } } ]} } ``` ## What the installed build must already contain 1. A **component registry**: a lookup from each `type` string to a renderer that turns props into native views. This is the build's vocabulary. 2. An **action handler** for every action type: open a screen, add an item to the basket, open a link, refresh a section. 3. A **parser and validator** for the schema version it was built against, so a malformed node is rejected instead of half drawn. 4. A **fallback policy** for anything it does not recognise, because layouts written after the build shipped will reach it for years. The registry is why the server's power is bounded. It can reorder, hide, re-skin and re-label any component the build ships, but it cannot make an old build draw a component that did not exist when that build was compiled. ## Actions as data, not code A tap's behaviour arrives as a small object from a **bounded vocabulary**, for example `{"type": "add_to_cart", "productId": "p-1182"}`. The app maps each action type to code it already contains. That buys three things: - **Safety**: every behaviour a user can trigger is code the team shipped and tested in that build; the response cannot make the app run new logic. - **Testability**: each action handler can be tested like any other code, independent of which layout uses it. - **Graceful degradation**: an action type the build does not know can be dropped, or its tap disabled, instead of failing. Sending a script for the app to evaluate is a different design. It turns the layout into code and inherits the risks of shipping code outside a release, which is exactly what the bounded vocabulary avoids. ## What a layout change can and cannot do | Change | Ships as a layout change? | Why | |---|---|---| | Reorder home sections, swap the lead promotion | Yes | Only arrangement and props change | | New copy, images, colours from existing tokens | Yes | Props of components the build knows | | A new carousel style the registry lacks | No, it needs a release | No renderer exists in shipped builds | | A new tap behaviour such as reserving a delivery slot | No, it needs a release | No handler exists for that action type | ## The costs you accept SDUI is not free: - **Offline launch.** A screen now depends on a network response, so the app needs a cached last layout and a bundled default. - **Debugging.** The question moves from "which build?" to "which build received which layout?", so layouts need ids and revisions in logs. - **Rendering cost.** A deep generic tree can parse and lay out more slowly than a hand-built screen. - **Poor fits.** Dense, interactive screens, such as a checkout form with validation or a gesture-heavy editor, are behaviour rather than arrangement. Interviewers listen for a candidate who treats SDUI as a release-speed tool with an operating cost, applied to the screens that change often.

  • Why not let the server send a script that the app evaluates, so new behaviour ships without a release?
    Because the layout would stop being data. A script runs logic that was never part of a tested build, an old build may interpret it differently, and a tampered or buggy response can now do anything the interpreter allows. A bounded action vocabulary keeps every behaviour in shipped, tested code; a genuinely new behaviour goes out in a release, and the layout starts using it once builds support it.
  • Should a server-driven layout embed product data such as prices, or only reference it?
    Usually reference anything that changes on its own clock. The layout says "a carousel fed by the buy-again source"; prices and stock come from the normal data endpoints and their caches. Layout and data then refresh independently, prices keep one source of truth, and an offline launch can render a cached layout with cached data. Small static content, such as a banner's headline, can sit in props.

  • Server-driven UI means the server sends finished screens as rendered images or web pages.
  • With server-driven UI any new component can ship without an app release.
  • A tap action can be any logic the server chooses to send to the app.
  • The layout schema needs no version because the server knows every component.
  • Once screens are server-driven the app no longer needs a bundled or cached layout.