Server-driven UI for frontend system design: schema, component registry, BFF and versioning
How server-driven UI works: a layout schema, a client component registry, a BFF that composes pages, versioning old clients, caching, SSR, analytics and when to avoid it.
Advanced 14 min readBy UIRound, updated 23 November 2026
Server-driven UI (SDUI) means the server decides what a screen contains and in what order, and the client only knows how to draw each piece. Instead of shipping a home page whose sections are fixed in code, the client asks for a layout, receives a tree of typed nodes ("a hero banner, then a carousel, then a product grid"), and renders each node with a component it already has. It comes up in interviews for home pages, storefronts, onboarding flows and anything a product team wants to change without a release. This guide covers the schema, the client registry, the backend that composes layouts, versioning for old clients, data fetching, caching, SSR, analytics, testing, and the cases where SDUI is the wrong tool.
What server-driven UI is
Every SDUI system has three parts:
- A schema: the shape of a layout. Usually JSON (or a GraphQL type), describing nodes with a
type,props, optionalchildren, and actions such as "navigate to this URL" or "add to cart". - A component registry on the client: a map from
typeto a real component. The registry is the client's vocabulary. The server can only arrange words the client knows. - A layout service, often a backend for frontend (BFF), that builds the tree for this user, page, platform and client version, and returns it.
It helps to see SDUI as a spectrum rather than one thing:
| Level | What the server controls | Example |
|---|---|---|
| Config-driven | Flags, copy, colours, which features are on | A remote config that hides a banner |
| Layout-driven | Which known widgets appear, in what order, with what data | A home page assembled from a fixed widget catalogue |
| Fully server-driven | Nesting, layout containers and actions, not just order | A screen composed from sections, containers and an action vocabulary |
Most real systems sit in the middle. The server picks and orders widgets from a catalogue the client ships, and passes each one its data. Going further, into general-purpose containers and conditional logic in JSON, buys flexibility at a steep cost in debuggability, as the last sections explain.
Why teams build it
The strongest motivation is mobile release cycles. A native app change goes through store review, and users update when they choose, so versions from months ago stay in use. If the home page layout is compiled into the app, every merchandising change, experiment or seasonal campaign waits for a release and still misses everyone on an old version. When the server sends the layout, a change reaches every installed version that knows the widgets involved.
The other motivations apply on the web too:
- Experiments. Growth teams can test "carousel above the grid" against "grid above the carousel" by returning different layouts per variant, without a code change per test.
- Personalisation. The layout itself can differ per city, segment or user: a returning customer sees "order again", a new one sees onboarding offers.
- One backend for three clients. Web, iOS and Android render the same layout from the same service, so a campaign launches everywhere at once and the ordering logic lives in one place.
- Non-engineers composing pages. Merchandising and content teams arrange widgets in an internal tool, within the rules the schema enforces.
On the web, the release argument is weaker because you can deploy several times a day, and an open tab picks up new code on the next navigation. Say so in an interview. Web SDUI is usually justified by cross-platform consistency and by letting other teams own page composition, not by release speed.
Several companies have written about their systems. Airbnb described its Ghost Platform, which serves sections, screens and actions through a shared GraphQL schema to web, iOS and Android, in A Deep Dive into Airbnb's Server-Driven UI System. Swiggy described Dynamic Widget, an SDUI rendering engine that delivers UI changes in its mobile apps without an app release, building on an earlier system that orders widgets on a page, in A Deep Dive into Dynamic Widget. Both are worth reading for their terminology, but you do not need to cite them to answer well.
Designing the schema
A layout response for a food delivery home page might look like this:
{
"layoutId": "home-blr-variant-b",
"schemaVersion": 3,
"experiments": [{ "key": "home-hero", "variant": "b" }],
"root": {
"id": "root",
"type": "stack",
"version": 1,
"children": [
{
"id": "hero",
"type": "hero-banner",
"version": 2,
"props": {
"title": "Rainy day offers",
"imageUrl": "https://img.example.com/rain.avif",
"cta": { "label": "See offers", "action": { "type": "navigate", "url": "/offers/rain" } }
},
"tracking": { "slot": 0, "campaign": "rain" }
},
{
"id": "recs",
"type": "product-grid",
"version": 3,
"data": { "source": "/widgets/recs?slot=1", "load": "when-visible" },
"fallback": { "id": "recs-v1", "type": "product-grid", "version": 1, "data": { "source": "/widgets/recs?slot=1&v=1", "load": "when-visible" } }
}
]
}
}The choices behind it are the ones to talk through:
- Every node has a stable
id. React keys, analytics, error reports and experiment attribution all need it. typeandversiontogether name a widget contract.product-gridversion 3 may need props that version 1 never had. Versioning per widget, not per page, lets one widget evolve without touching the rest.- Props are data, never code. No JavaScript strings, no HTML, no expressions to evaluate. The moment the schema grows
ifconditions and loops, you are building a programming language with no debugger. - Actions are a closed vocabulary.
navigate,open-sheet,add-to-cart,track. The client has an action registry just like the component registry, and unknown actions do nothing and get reported. - Data can be inline or deferred. The hero carries its props directly because it is above the fold. The grid points at a data source to load when it scrolls into view.
- Design tokens, not raw styles.
"tone": "promo"maps to colours in the design system. Raw hex colours and pixel margins from the server bypass theming, dark mode and accessibility checks.
Validate the layout before it leaves the server, with JSON Schema, Zod or GraphQL types generated from one source of truth. An invalid layout should fail in the layout service's tests and logs, not on a user's phone. Building a schema-driven form with pluggable field types and a small Zod-style validator practise both halves.
Versioning and old clients
Versioning is where SDUI designs succeed or fail, and interviewers push on it hardest. The rule is simple to state: the server must never send a client something it cannot render, and when it does by mistake, the client must degrade quietly.
Three mechanisms work together:
- The client announces what it supports. It sends its platform, app version and the widget types and versions in its registry. Sending the whole list on every request is wasteful, so a build step can hash the registry manifest and the client sends just the hash; the server looks up the manifest by hash. A hash also makes a good cache key, as described below.
- The server filters. Each widget version declares a minimum client version or a required capability. The layout service drops widgets the client cannot render, substitutes an older version, or picks a different layout altogether.
- The client falls back. If a node's type or version is unknown anyway (a bug, a stale manifest), it renders the node's
fallbackif one is provided, or nothing. It never crashes the page or shows a broken box, and it reports the miss so you see it in monitoring.
Evolve widgets additively. Adding an optional prop is safe. Renaming or removing a prop, or changing its meaning, needs a new widget version, kept alive on the server until analytics show no client still requests the old one. Designing a page builder with versioned JSON documents and migrations and catching API contract drift both train this.
The component registry
The registry maps each type to a component and the versions it can render. On the web, register components with dynamic imports so a page only downloads the widgets its layout actually contains.
import { lazy, Suspense, type ComponentType } from "react";
import { ErrorBoundary } from "react-error-boundary";
type LayoutNode = {
id: string;
type: string;
version: number;
props?: Record<string, unknown>;
children?: LayoutNode[];
fallback?: LayoutNode;
};
const registry: Record<string, { versions: number[]; component: ComponentType<any> }> = {
"hero-banner": { versions: [1, 2], component: lazy(() => import("./widgets/HeroBanner")) },
"product-grid": { versions: [1, 2, 3], component: lazy(() => import("./widgets/ProductGrid")) },
stack: { versions: [1], component: lazy(() => import("./widgets/Stack")) },
};
export function RenderNode({ node }: { node: LayoutNode }) {
const entry = registry[node.type];
if (!entry?.versions.includes(node.version)) {
reportUnknownWidget(node.type, node.version);
return node.fallback ? <RenderNode node={node.fallback} /> : null;
}
const Widget = entry.component;
return (
// one broken widget must not take down the page
<ErrorBoundary fallback={null} onError={(error) => reportWidgetError(node, error)}>
<Suspense fallback={<WidgetSkeleton type={node.type} />}>
<Widget {...node.props} nodeId={node.id}>
{node.children?.map((child) => <RenderNode key={child.id} node={child} />)}
</Widget>
</Suspense>
</ErrorBoundary>
);
}Three details are worth saying aloud. Each widget sits in its own error boundary, so a bad prop in one carousel does not blank the home page; an error boundary with retry and reset covers the mechanics. Skeletons are sized per widget type so lazy loading does not cause layout shift. And widgets should validate their own props at the boundary, treating server data as untrusted input: render strings as text, and allow only https: and same-origin URLs in links and images so a bad layout cannot inject a javascript: URL.
The layout service and the BFF
The layout service is the brain. For one request it typically:
- Resolves who is asking: user segment, city, language, experiment assignments.
- Picks a layout template for the page and variant, often authored in an internal tool.
- Calls ranking or recommendation services to fill slots.
- Fetches the data that above-the-fold widgets need, in parallel, with a timeout per call.
- Filters by the client's capabilities, validates the result and returns it.
This is the backend for frontend pattern with one addition: it returns structure as well as data. Partial failure is handled here. If the offers service times out, drop the offers widget or substitute a static one, and return the rest of the page on time. A home page that waits for its slowest dependency is a slow home page. Designing a BFF for a page that calls nine services is the same problem.
Data fetching per widget
There are two broad approaches, and good designs mix them:
- Inline data. The layout response carries each widget's data. One round trip paints the page, which matters most on mobile networks. The cost is a slow, large response if every widget is inlined.
- Deferred data. A widget carries a data source and fetches it itself, either immediately or when it nears the viewport via an
IntersectionObserver. The layout comes back fast and below-the-fold widgets cost nothing until scrolled to.
Inline what is above the fold and defer the rest. Watch for the trap of twenty widgets each firing its own request on mount: batch deferred fetches into one call per scroll position, or stream the layout so later widgets arrive as their data is ready. Widget data should be normalised into the same client cache as the rest of the app, so a product shown in a grid and on its detail page is one entity, as in data fetching and caching.
Caching
Personalised layouts are hard to cache at a CDN, because the response depends on who is asking. Separate the parts:
- Layout skeletons per segment. Many users share a layout ("Bengaluru, returning user, variant B"). Cache by a key built from the page, segment, locale, experiment variant and registry hash. Do not vary the cache on the user id unless the layout really is unique per person.
- Personal data separately. "Order again" items come from a per-user deferred call that is not shared.
- The last layout on the device. Store the most recent layout locally and render it at once on the next start while fetching a fresh one: stale-while-revalidate for structure. Mobile apps also ship a bundled default layout for the first launch and for when the layout service is down.
Give layouts a short lifetime and an ETag, so a revalidation that finds nothing new is a cheap 304. Browser caching covers the HTTP side.
SEO and server rendering on the web
On the web, a layout fetched by client-side JavaScript produces an empty first paint and gives crawlers nothing until scripts run. Render the tree on the server instead: the server fetches the layout, renders each node with the same registry, and sends HTML. With React Server Components or any SSR framework this is natural, because the registry can be resolved on the server, and only interactive widgets need to hydrate. The layout service then sits behind your rendering server, not behind the browser. Keep URLs stable and meaningful even when the content is server-composed, and make sure titles, headings and structured data come from the layout so search engines see the same page users do. The trade-offs between SSR, streaming and static generation are in rendering strategies.
Analytics and experiments
SDUI makes analytics easier if you plan for it, and impossible to interpret if you do not. Every event a widget emits should carry the node id, widget type and version, slot position, layoutId and experiment variants. Log impressions when a widget is actually visible, not when it is in the response, as in logging product impressions once scrolling stops. Then "carousel in slot 2 converts better than slot 4" is a query, not an argument. Experiments that change layout must be assigned before rendering, on the server, or users see one layout and then jump to another: feature flags and A/B tests without flicker is the practice prompt.
Testing and operating it
SDUI moves bugs from compile time to run time, so testing shifts too:
- Schema tests on the server. Every template, for every variant, validates against the schema and renders against each supported registry manifest.
- Widget tests on the client. Each widget version renders correctly with its minimum and maximum props, and visual tests catch regressions.
- Contract tests between the two. Fixtures from the server are rendered by the client in CI.
- A preview tool that renders any layout on real clients before it goes live, so content teams see what they publish.
- A kill switch that returns a known-good layout when a new one misbehaves, and monitoring of unknown-widget and widget-error rates by type and client version.
The observability and testing guide covers rollouts and error tracking in general.
When not to use it
SDUI is an investment, and interviewers reward candidates who say when it does not pay off:
- Highly interactive tools. Editors, complex forms with cross-field logic and canvas apps are behaviour, not arrangement. Describing them in JSON recreates the code badly.
- One team owning a web app. If the same team writes the server and the client and deploys daily, a schema layer adds indirection without saving releases.
- Small products with few screens. The registry, the layout service, the authoring tool and the versioning rules cost months to build well.
- When debugging matters more than flexibility. "Why does this user see this layout?" needs tooling: request ids, layout ids and a way to replay a request. Without it, incidents take far longer.
The failure mode to name is the inner platform effect: the schema slowly gains conditions, variables and loops until it is a worse programming language owned by one team. Keep logic in the layout service, written in a real language, and keep the schema declarative.
How to talk about it in an interview
When a prompt involves a home page, storefront or campaign pages that change often, propose SDUI as an option and justify it with the requirement: "the app ships every two weeks and marketing changes this page daily". Then walk through it in this order:
- The schema: show one node with
id,type,version,props, actions and a data source. - The registry and the renderer, including the unknown-widget fallback and a per-widget error boundary.
- The layout service: segment, experiments, ranking, parallel data calls with timeouts, capability filtering.
- Versioning: client capabilities, minimum versions, additive changes, a bundled default layout.
- Performance: inline above the fold, defer the rest, cache by segment, keep the last layout on device, SSR on the web.
- Operations: validation, contract tests, preview, kill switch, analytics carrying layout and node ids.
Finish with the trade-off you are accepting: flexibility and faster iteration in exchange for a schema to maintain, harder debugging and a platform team to own it. Designing a config-driven widget builder and an insurance quote wizard with a server-driven form schema are full prompts to rehearse on, and the Shopify-style theme editor adds authoring on top.
Follow-up questions
How do you stop the server sending a widget an old app cannot render?
The client sends its capabilities: platform, version and its registry manifest, or a hash of it. Every widget version on the server declares what it requires, and the layout service filters or substitutes before responding. The client still checks each node and renders the fallback or nothing for anything unknown, then reports it, so a server mistake degrades one slot rather than the page.
Where should a widget's data come from: the layout response or its own request?
Above-the-fold widgets should get their data inline so the first paint needs one round trip. Below-the-fold widgets should fetch their own data when they approach the viewport, batched where several appear together. The decision belongs to the layout service per slot, so you can move a widget between the two without a client change.
How do you cache a personalised layout?
Split shared structure from personal data. Cache the layout by page, segment, locale, experiment variant and registry hash, which many users share, and fetch the truly per-user parts separately. On the device, render the last known layout immediately and revalidate in the background, with a bundled default for first launch and outages.
Does server-driven UI hurt SEO?
Only if the layout is fetched and rendered in the browser. Render it on the server with the same registry so crawlers receive full HTML, hydrate only interactive widgets, and derive titles, headings and structured data from the layout.
How do you test a system where the UI is decided at run time?
Validate every template and variant against the schema in the layout service's CI, render server fixtures with every supported client registry in contract tests, test each widget version on its own, and preview layouts on real clients before publishing. In production, watch unknown-widget and widget-error rates by client version, and keep a kill switch to a known-good layout.
When would you argue against server-driven UI?
When the screen is mostly behaviour rather than arrangement, such as an editor or a complex form; when one team owns client and server and deploys freely; or when the product is small. In those cases the schema, registry, versioning rules and authoring tools cost more than the releases they save.
Sources
Practise it
Each question opens in an editor with tests, so you can check your understanding by writing the code.
- Design a config-driven widget builder: widget schema, renderer registry and how client apps integrate itHard55 min
- Design an insurance quote wizard: server-driven form schema, save and resume across devices, validation and pricing callsHard55 min
- Design a plugin-based page builder: versioned JSON documents, migrations and sandboxed blocksHard50 min
- Build a schema-driven form with conditional fields and pluggable field typesHard60 minFree
- Design a theme editor like Shopify's: a live preview iframe, section schemas, undo and publishingHard55 min
- Design feature flags and A/B tests that cause no flicker or layout shiftHard60 min
- Design a backend-for-frontend (BFF) for a page that calls nine servicesHard45 min