Loading...
Loading...
Loading...
Loading...
Loading...
Before diving into how Server-Driven UI frameworks define components and their DSL (Domain-Specific Language), it's important to understand the concept of configurability.
In traditional app development, developers make components reusable by exposing props, styles, and behaviors allowing the same component to be used in different contexts with different configurations.
Flash builds on this same principle. The component constructs and DSL used in Flash are a direct extension of how we already think about reusable components in code. Instead of defining configurations in code, we now define them as structured data (typically JSON) that can be interpreted by the app at runtime.
By understanding configurability, you’ll better appreciate how server-driven components are designed, how much flexibility they offer, and how product teams can control UI behavior without additional development effort.
In the following sections, we’ll explore configurability through simple examples. We’ll start by creating a basic UI component, gradually make it configurable, and then use that foundation to define the Flash component construct and ultimately the DSL that powers it.
React Native components require three fundamental properties to render:
Styles - Defines the appearance of the component.
Data - Provides content or values for the component.
State - Manages dynamic changes in the component.
This document explores how to define a Domain-Specific Language (DSL) for Server-Driven UI (Flash), the reasoning behind its structure, and how to build a renderer capable of dynamically interpreting and rendering components.
But before we dive into Flash, let’s step back and look at how we build configurable components in our codebase today. We’ll start by implementing a basic SimpleComponent
that renders static text, and then gradually enhance it to support configurability.
This component always renders "Hello World", and styles are hardcoded.
To improve reusability, we pass styles and data as props:
Now, the component can render any text with configurable styles.
The above component is reusable and supports configurable styles and data. But we can take it a step further by making the component’s children dynamic, allowing even greater flexibility and composition.
To allow rendering child elements dynamically:
Example Usage:
The `SimpleComponent` is now reusable and supports configurable styles, data and children.
In other words, we can also say that for a component to be configurable it should supports configurations for styles, children and data.
Such configurable component should take following three parameters as input:
styles: Applied to the root component.
children: Elements to be rendered inside the component.
data: Dynamic values for the component.
Earlier, we discussed how to make components configurable in the codebase. During that process, we established a fundamental principle: configurable components should accept styles, children, and data as inputs.
When these configurations are supplied by a server, we refer to the component as server-driven. Flash compliant components must adhere to this construct and take styles, children and data as inputs.
To support server-driven configurations, the app must fetch these inputs from a remote source. For the app to correctly interpret and render these configurations at runtime, they must adhere to a predefined contract between the server and the mobile client. This contract is known as the DSL (Domain-Specific Language).
On the client side, the mobile app requires an interpreter and renderer that can understand this DSL and dynamically render the appropriate components on the device.
DSL is JSON representation of the component construct. It contains key and values which are necessary to define server driven components. Below is the basic version of Flash DSL.
name: React Native component name (e.g., View, Text, Image) or a custom component.
styles: Styling properties for the component.
data: Dynamic content for the component.
components: Child components, following the same structure recursively.
Real-world mobile apps often involve complex layouts such as Tabs, Bottom Tabs, and Lists. In React Native, both simple elements like Text
and complex structures like Tabs
are treated as components. What makes components like Tabs
special is that they understand how to render their children—for example, Tabs
will always lay out its children in a tabular format.
Similarly, Flash handles complex layouts using the concept of special components that know how to interpret and render their children. In Flash, these special components are called Inflaters.
As Inflaters are also components, they follow the same server driven component construct.
A DSL representation for a TabLayout might look like this:
TabLayoutInflater
is a component which renders components given input to it in Tabular format.
By introducing Inflaters
, we enable the DSL to define not just how components look, but how they behave making complex layouts configurable without changing app code.
The Flash DSL and component construct allow developers to configure a component’s styles, hierarchy, and data. With the help of Inflaters, even complex layouts can be defined in a server-driven manner.
However, in real-world mobile apps, components often encapsulate business logic, state management, and user interactions. The current Flash DSL does not support configuring business logic directly. But what if these logic-heavy components also need to be configurable in terms of styles, data, and children?
The Flash framework is designed with this in mind. Components that include business logic but still require configurability are supported using the same Flash component construct. We refer to these as Business Components
or Pre-Baked Components
.
Let’s understand this with an example.
Consider an CardComponent
, which includes business logic such as fetching data via an API and updating internal state on a button click. It also contains a Button
and a TabNavigator
as children.
While the Flash DSL doesn't (yet) support configuring the business logic itself, it does support configuring the JSX structure of the CardComponent
. To make this possible, the component must follow the Flash component construct—that is, it should accept styles, children, and data as input.
Lets make CardComponent
Flash compliant. It can be done in following steps
Update the method signature to follow the flash component construct
Use TabLayoutInflater
in-place of Tab.Navigator
Pass the styles, data and components to TabLayoutInflater
Here's the updated CardComponent:
The CardComponent can now have capabilties
Re-order Tabs FirstTabComponent, SecondTabComponent
Add new Tab
Change Title of Tab
Change styles of Tab
Flash is designed to offer maximum flexibility to developers. It allows them to choose the level of configurability that best fits their needs. Developers can make an entire screen configurable, or just a specific section of the screen. They also have full control over how deeply nested the configurability should go whether it’s at the screen level, component level, or within individual child components.
Server-Driven UI (SDUI) is a technique where the server defines the structure, style, and behavior of the user interface. This enables a highly dynamic and adaptable UI that can be updated without requiring a new app release. Flash Client, a Server-Driven UI (SDUI) framework for React Native, allows developers to leverage server-defined configurations to render dynamic components, layouts, and behaviors directly in the app.
In this section, we’ll explore how to make specific parts of the UI compatible with SDUI, using Flash Client SDK to allow for greater flexibility and remote configuration.
In addition to layout flexibility, SDUI empowers you to control user behavior through configuration—enabling dynamic workflows, feature toggles, and contextual experiences. This approach opens up opportunities for experimentation, reduces the need for frequent app releases, and accelerates the overall development cycle.
Consider a scenario such as a ticket booking platform where the content changes frequently, but the placement of UI elements and the overall visual structure remains consistent. SDUI is valuable in this case: rather than hardcoding layouts, configuration related to the screen is delivered over the air, allowing the server to define the screen’s layout dynamically.
SDUI also enables:
Real-time UI updates.
Customizable UI components.
Reduced app release frequency.
Rapid experimentation with UI changes.
Flash Client integrates this SDUI paradigm to ensure flexibility in app development. Read more about the capabilities of Flash Client SDK for rendering dynamic components and layouts.
A UI element in Flash Client refers to any component used to define the layout and design of a screen. Examples include View, Text, Button, and Image, which serve as the fundamental building blocks of the user interface. These elements can be customized, styled, and updated dynamically based on the configurations provided by the server.
In Flash Client, these UI elements are described in JSON format, enabling developers to dynamically alter layouts and styles at runtime through backend configurations.
Behavior defines the dynamic aspects of a UI element, such as events (e.g., taps, scrolls, or input changes) and the corresponding actions that should be triggered in response. Flash Client enables the definition of behavior in a highly configurable manner, linking events to actions such as navigating to a new screen, opening deep links, or displaying alerts.
Events and Actions will soon be a part of the Flash Client SDK. This feature will allow the server to specify actions that should occur when a specific event happens within the UI. For example:
Event: A button is clicked.
Action: Navigate to a new screen.
Event: A list item is tapped.
Action: Open a deep link or trigger a custom behavior.
This capability will enable developers to configure and control user interactions entirely from the server, providing flexibility in creating dynamic and context-sensitive user experiences.
Note: The full Event and Action functionality is scheduled for release soon, and will be integrated into future SDK versions, enabling the app to dynamically respond to user inputs based on remote configurations.
The Flash Client SDK does not directly call the app or the API to fetch configuration data. Instead, the app provides the necessary data (such as layout configuration, UI components, styles, behaviors, etc.) to the SDK from an external source (like an API or local configuration storage). The SDK is then responsible for rendering the UI and managing the dynamic behavior based on the provided configuration.
Process Flow:
App Fetches Configuration: The app makes the API calls to fetch the required configuration (e.g., layout, style, event-action mappings) from an external source. The Flash Client SDK relies on the app to provide this data.
Flash Client SDK Receives Configuration: The app passes the configuration data to the Flash Client SDK, which interprets and renders the UI components dynamically.
Rendering Components: Once the configuration data is provided to the SDK, the Flash Client SDK uses FlashComponent and Inflaters to render UI components dynamically according to the provided configuration.
Event and Action Handling: The SDK uses the provided configuration to manage events and corresponding actions (e.g., button clicks, taps), ensuring that the UI responds dynamically to user interactions.
The Flash Client SDK itself does not initiate the fetching of configuration data but relies entirely on the app to supply the necessary data for rendering the UI and defining behaviors.
Flash Client SDK Overview
The Flash Client SDK is a powerful tool designed to manage configuration delivery and provide contextual configurations suited to the runtime environment. It is not responsible for fetching the data itself but relies entirely on the app to supply the necessary configuration. The SDK includes:
Component Registration: Register custom components for dynamic rendering.
Dynamic Layout & Behavior Rendering: Use provided configurations to manage layouts and behaviors.
Helper Utilities: Ensure easier integration with the app.
Type-Safe Interfaces: Guarantee proper usage of configuration data.
Validation Mechanisms: Ensure that the provided configuration data is correct.
The SDK’s core functionality revolves around rendering dynamic layouts (via FlashComponent and Inflaters) and managing dynamic behavior (via events and actions). However, for all of this to work, the app must provide the necessary configuration data at runtime.
Configurability refers to the ability of UI components and behaviors to be dynamically driven by server-provided configuration. In the context of Flash, configurability allows components to adapt their data, styles, and interactions based on JSON or similar config formats without requiring code changes or app updates. This includes making visual elements configurable through styling, functional behavior through events and actions, and structural flexibility through overrides.
By enabling configurability, developers can create flexible, testable, and version-aware UI experiences that are controlled remotely from the server.
Behaviour defines how UI components respond to user interactions. It consists of:
Events: Triggers such as onPress, onChange, or onScroll
Actions: The side effects or logic executed in response, such as navigation, API calls, or analytics
By making behavior configurable, Flash enables dynamic user flows, feature toggles, and personalized interactions—without hardcoding logic into the app.
Wrap your existing UI component in a way that allows it to consume configuration from the Flash system. This includes:
Accepting configProps for data and styles
Applying the received styles to the component’s layout
Rendering dynamic values based on the config-driven data
This wrapper ensures the component can adapt its appearance and behavior without code changes.
Once the component is made configurable, register it with the Flash system using a unique componentName. This makes it available for use in templates created via the dashboard.
Registered components must follow the expected schema and can now be referenced and configured dynamically at runtime by the server.
Events define how a component responds to user interactions (e.g., taps, changes, scrolls). In Flash, events are made configurable inside the component, and their configuration is tightly coupled with the component’s wrapper. Events are not configured separately in templates, they are defined and registered as part of making the component configurable.
If a component doesn’t use any events, this step can be skipped.
Inside the component wrapper, wire up the event handler to read from configProps.events.
Ensure the event follows the standard schema defined for that event type so that the Flash engine can interpret and execute it consistently across different components.
This enables you to pass arguments, trigger actions, and compose conditional flows all from config.
Register each event used by the component using a unique name, so the Flash system can map and handle it correctly.
If an event with the same name is already registered globally (with the same schema), re-registration is not needed.
Multiple events can be registered if the component supports more than one interaction.
Actions define the side effects or operations that occur in response to events such as navigation, API calls, logging, or custom logic. In the Flash system, actions are configured and registered independently of components and events.
Design your action to accept arguments and callbacks from config and execute the desired logic. Ensure the action supports:
Arguments from config
Optional success and failure actions
Nested execution when needed
This structure allows actions to be chained or wrapped for retry/fallback logic.
Register each action using a unique identifier via the Flash action registry. This makes the action available across all components and templates.
Since actions are decoupled from components, they can be reused across the app. The SDK uses the registered action name in the config to resolve and execute the correct logic when triggered by an event.
UI defines the visual structure and presentation of the screen. It includes such as buttons, cards, inputs, images, and layout containers. These components are configured via server-supplied data and styling properties, enabling the app to render screens dynamically while maintaining platform-specific theming and consistency.
Components are the fundamental building blocks of the UI in Flash. They represent reusable visual elements such as Button, Text, Image, Card, etc., which are used to construct layouts and interactive screens.
To use components in Flash, they must go through specific steps: making them configurable (Flash compliant) and then registering them. This process ensures the components can respond to server-driven configuration for styling, data, and behaviour.
A component refers to a standard React (or React Native) component that is static in nature it uses hardcoded props and styles and behaves the same way every time it is rendered.
A configured component is a wrapper around such a component that makes it Flash compatible It can:
Dynamically apply styles from config
Render data passed from config
Attach configurable events and actions
This transformation allows the component to be controlled remotely through the server.
Example:
A configured component is capable of consuming server driven configuration, but it is not yet known to the Flash system until it is explicitly registered.
A registered component is a configured component that has been linked to a unique componentName using the registerComponent() method. Once registered, it becomes available for use in templates created on the Flash dashboard.
In short:
A configured component can read and apply config
A registered component is a configured component that the Flash system can recognize and render dynamically
To create a Flash template in realtime from backend, we need basic building blocks. It is not always possible to create complex templates with only building blocks which has complex ui or stateful logic. So, along with basic building blocks, we also need project specific prebaked components whose ui and logic is written in codebase. Similar to basic building blocks, we register prebaked components and make them available in the dashboard during template creation in realtime.
BaseComponent
Stateless components with no children.
Text
, Image
, Toast
BaseComponentWithChildren
Stateless, layout-like components that support children.
View
, Pressable
PreBakedComponent
Project-specific, complex components with custom logic, no children.
CardComponent
, TeamCard
PreBakedComponentWithChildren
Complex project components that also support nesting/children.
Accordion
, TabLayout
, Modal
These types allow balancing flexibility (basic blocks) with performance and logic encapsulation (prebaked).
Every UI element that is rendered in your app via Flash is described using a JSON object. This schema defines the structure, style, behavior, and children of a component — all of which are interpreted by the Flash renderer on the client side.
Let’s break down each field:
name
string
This must match the registered name of a component (via registerComponent
). Example: "FooterButtonFlash"
components
Component[]
Nested or child components, used by layout-type components like View
, ScrollView
, etc.
styles
Style
Styling config like margin, padding, color, etc., applied to the root of the component.
overrides
Overrides
Style or prop overrides targeted via nativeID
inside the component.
data
PropData
Dynamic props to control content and behavior (text, image source, backend data etc.).
dataId
string
(optional)
Can be used for fetching external data via binding systems.
Render the component registered as FooterButtonFlash
Pass data.text
to it
Style the outer wrapper with padding and background color
Override styles for inner FlashText
using nativeID="footer-button-title"
This is a union of style objects similar to React Native's StyleSheet
.
It supports keys like:
margin
, padding
, flexDirection
→ from ViewStyle
color
, fontSize
, fontWeight
→ from TextStyle
resizeMode
, tintColor
→ from ImageStyle
These styles are applied to the root of the component, unless used in overrides
.
This is the data prop passed to the component.
It's fully dynamic and recursive — it can contain primitives, objects, or arrays.
Used to drive:
Text or image content
Test IDs, flags, booleans, etc.
Props inside data
are typically used inside the component like:
Overrides allow the server to reach deep inside a component and override:
Its props
Its styles
This is possible only if that inner component uses nativeID
.
nativeID
is a identifier that says: “You can target this element with overrides.”
Example Use Case
Imagine a card component that has a title and a subtitle. You want to override the color of the subtitle only in one use case without changing the entire card component.
You can assign nativeID="card-subtitle"
and override it like:
⚠️ If
nativeID
is missing, overrides will have no effect.
To make the component configurable, the component should take configProps
. configProps
is passed as props to the component and has flash data.
In mobile development, creating responsive and dynamic user interfaces is a fundamental challenge. Developers typically rely on various layout patterns to organize and present content effectively. However, as applications grow in complexity, there's a growing need for UIs that can adapt in real time without requiring app updates.
Key challenges include:
Dynamically reordering components
Adding new components on the fly
Changing layout or placement without releasing a new version
The Flash framework addresses these needs by leveraging JSON-based layout configurations sent from the server.
To support these dynamic capabilities and maintain a robust UI system, we introduce Inflaters. Inflaters are responsible for understanding and rendering the JSON-based layout data received from the server. They are core components in the Flash system that enable powerful layout-driven configurations, such as reordering components or adding new ones dynamically.
This document explores Inflaters in more detail.
Common layout types in mobile apps include:
Tab layouts
Stack layouts
List layouts
Scroll layouts
These help structure content and enhance user experience. However, adapting these layouts dynamically based on server data is where the real challenge lies.
Inflaters are responsible for interpreting the layout structure defined in server responses and rendering components accordingly. This allows UIs to be updated or changed remotely—without the need for app redeployment.
Flash provides several generic inflaters:
TabLayoutInflater: Renders child components as tabs
StackLayoutInflater: Renders components in a vertical stack
ListInflater: Renders components in a scrollable list (vertical, horizontal, or nested)
ScrollInflater: Renders components inside a scrollable container
These inflaters enable the Flash Client SDK to support flexible, layout-driven UIs across a variety of use cases.
As explained in the Flash Components section, every Flash-compatible component manages its own configuration. Inflaters play a key role when it comes to enabling dynamic layout capabilities, such as reordering elements or adding new ones.
Components that require any of these layout capabilities should use inflaters to interpret and apply the layout configuration provided by the server. The specific inflater used depends on the desired layout behavior.
To demonstrate this, we walk through an example of enhancing SportsListComponent
using ListInflater
, enabling it to support reordering and component insertion.
Example: Regular FlatList Component
To illustrate how inflaters work, let's look at an example of a ListInflater.
Inflaters receive a list of components from the server as part of the layout configuration. These components define the structure and content that should be rendered dynamically.
Data from existing APIs is transformed to match the format expected by inflaters. This transformation ensures that inflaters can properly associate data with each component and render them accordingly.
The style
prop applies styling to the parent container of the inflater. This enables layout-level styling while maintaining flexibility for child components.
The overrides
prop allows components to override specific layout or style properties of nested children. This adds a layer of customization on top of the default configuration.
Inflaters also support nested scrollable elements. If a child item needs to scroll (horizontally or vertically), its layout should include the appropriate configuration from the server. This enables complex nested structures—like scrollable carousels inside a vertical list.
Below is a summary of the current inflater types supported by the Flash framework:
ListInflater: Uses FlatList
to dynamically render lists of child components.
ScrollInflater: Uses ScrollView
to enable vertical or horizontal scrolling of child components.
TabInflater: Organizes child components into swipeable or clickable tabs.
StackInflater: Renders components in a vertically stacked format.
These inflaters provide the flexibility required to design dynamic, data-driven layouts with minimal hardcoding.