Mastering SDUI: A Deep Dive into Server-Driven UI

Anupam Singh
AndroIDIOTS
Published in
14 min readDec 29, 2023

What is Server-Driven UI (SDUI)?

If you ask GPT this it what it spits out

Server-Driven UI is a revolutionary paradigm shift in mobile app development. Unlike traditional approaches where the client-side dictates the app’s appearance and behavior, SDUI empowers the server to control these aspects. In simpler terms, the server becomes the mastermind behind the app’s user interface.

In the part 1 of this series

we will use Bytes, a short 3 page app, of landing screen, category screen and article screen to explain the concept of SDUI.

Bytes : landing page, category, articles

What is a Mobile App in SDUI?

In the realm of Server-Driven User Interface (SDUI), a mobile app(or any frontend for that matter) can be viewed as a combination of two core components: User Interface (UI) and Logic, which can be further subdivided as follows:

User Interface (UI):
The visual layer of SDUI is composed of several building blocks:

UI Components: These building blocks include buttons, forms, and interactive elements, all expertly orchestrated by the server for dynamic rendering.

Tokens and Values: Tokens play a vital role, representing essential pieces of information needed for secure communication with the server. They encompass color tokens, typography tokens, spacing tokens, and other data crucial for personalized content retrieval.

Spatial Arrangement: Spatial considerations revolve around the positioning and layout of UI elements on the mobile app’s screen. The server assumes control of this spatial arrangement to ensure an organized and user-friendly interface.

Logic:
The Logic component of the mobile app can be further divided into two primary aspects:

1.UI Logic: client-side ui logic is responsible for managing user interactions such as button clicks or form submissions. For example, when a user taps the “Submit” button on a registration form, the UI logic validates the input data, generates an HTTP request to the server, and displays a success message upon a successful response.

2.Business Logic: Business logic, a fundamental component, can be segmented into two critical facets:

a. Actions: Actions encompass the execution of specific tasks or operations within the app, often instigated by user actions. These actions, in turn, trigger requests to the server, leading to updates or data retrieval. For instance, when a user clicks the “Purchase” button, it triggers an action that communicates with the server to complete the transaction and update the user’s account balance.

b. Rules: Rules consist of predefined conditions and logic set by the server, governing the behavior of the app’s UI. These rules are instrumental in ensuring consistency, safeguarding data integrity, and delivering a seamless user experience. For example, a rule could dictate that a user who is a member of the platform will see different pricing than a non-member.

What is SDUI system ?

In SDUI : Server takes the front role in frontend development

A Server-Driven User Interface (SDUI) system is an architectural approach where the responsibility for presentation and user interface rendering is shifted from the client-side (mobile app or web browser) to the server-side. In this system, the server dynamically generates and controls various aspects of the user interface, including spatial layout, rendering, order of elements, logic, and values.

How does a typical SDUI system looks like?

A Server-Driven User Interface (SDUI) system typically comprises several key components that work together to deliver dynamic and server-controlled user interfaces. Here’s an overview of these components:

1.Design System: The design system defines the visual and interactive guidelines for the user interface, including elements like typography, colors, spacing, and UI components. It serves as the foundation for creating consistent and appealing UIs.

2.SDUI JSON (JavaScript Object Notation): SDUI JSON is a structured data format used to describe UI elements, layout, content, and behavior. It allows the server to transmit instructions and data to the client app for rendering the user interface dynamically.

3.Renderer: The renderer is responsible for interpreting and rendering the SDUI JSON received from the server. It translates the instructions in the JSON into actual UI elements and components displayed on the user’s device.

4.Page UI: Page UI represents the user interface as it appears on the user’s screen. It consists of various UI components, such as buttons, forms, text fields, and images, organized according to the layout defined by the SDUI JSON.

5.SDUI Backend Configuration: The SDUI backend configuration includes settings and rules that govern how the SDUI system operates. It specifies how the server should generate UIs, respond to user interactions, and handle data requests.

6.Data Source: The data source provides the necessary data and content for the SDUI system. This may include user-specific information, real-time updates, product listings, or any other data needed to populate the UI components.

7.BFF (Backend for Frontend) Layer: The BFF layer acts as an intermediary between the SDUI backend and the client app. It may perform tasks such as authentication, data aggregation, and request routing to ensure efficient communication between the client and server.

lets elaborate each part

What is Design System?

A design system typically consists of:

1.Typography: Typography is a foundational element that defines fonts, font sizes, line spacing, and text styles used throughout the UI. It ensures readability and maintains a cohesive visual identity.

2.Color Tokens: Color tokens represent a set of predefined colors used consistently in the UI. They include primary and secondary color schemes, background colors, text colors, and other variations. Color tokens allow for easy theming and brand consistency.

3.UI Components: UI components are the fundamental building blocks of the user interface. They encompass buttons, forms, input fields, checkboxes, and other interactive elements, each designed with specific styles and interactions defined by the design system.

4.Spacing and Layout: Guidelines for spacing, margins, padding, and grid layouts help maintain alignment and visual hierarchy in the UI. These rules contribute to a structured and balanced user experience.

bytes design system

What is SDUI JSON?

SDUI JSON (Server-Driven User Interface JSON) is a structured data format used for defining and controlling a user interface. It enables dynamic UI updates through server-client communication. Here are the main aspects:

UI Elements: Describes components like buttons, images, and their properties.
Layout: Specifies the arrangement and positioning of elements.
Data Binding: Connects UI components to real-time data sources.
Interaction: Defines how elements respond to user actions.
Styling: Includes themes, colors, and visual properties.
Navigation: Guides user movement between screens.
Logic and Rules: Implements business logic and behavior.
Responsiveness: Ensures adaptability to different devices.
Localization: Supports multiple languages and regions.

What is Renderer?

A Renderer is a key component responsible for interpreting and transforming SDUI JSON (JavaScript Object Notation) data received from the server into a fully rendered and interactive user interface on the client-side, such as a mobile app or web application.

Here’s how a renderer functions within an SDUI system:

Receiving SDUI JSON: The renderer receives SDUI JSON data from the server. This JSON contains instructions, data, and configurations for rendering the user interface.

Interpreting SDUI JSON: The renderer interprets the SDUI JSON, understanding the structure and content of the UI elements, their layout, behavior, and any associated data bindings.

Generating UI Components: Based on the SDUI JSON instructions, the renderer generates the actual user interface components, including buttons, text fields, images, and more. It applies the defined styling and layout rules to create a visually coherent UI.

Data Binding: The renderer establishes data bindings, connecting UI components to real-time data sources or dynamic content specified in the SDUI JSON. This ensures that the UI displays up-to-date information.

Handling User Interactions: Interactive components within the rendered UI, such as buttons and forms, are equipped with event listeners and logic to respond to user interactions, such as clicks or input submissions.

Displaying the UI: The renderer displays the fully rendered and interactive user interface on the user’s device screen, allowing users to interact with the application as intended.

Dynamic Updates: As the server can send updated SDUI JSON at any time, the renderer is designed to handle dynamic updates, ensuring that the UI reflects changes in real-time data or instructions.

What is Page UI?

Page UI refers to the user interface that is generated and displayed on the client-side based on the instructions and data received from the server. It represents the actual visual layout and components that users interact with when using a mobile app or web application.

Here are key characteristics of Page UI in SDUI:

Dynamic Generation: Page UI is dynamically generated based on the SDUI JSON (JavaScript Object Notation) instructions received from the server. These instructions define the structure, layout, content, and behavior of the user interface.

User-Facing Elements: Page UI includes all the user-facing elements and components of the application, such as buttons, forms, text fields, images, menus, and any other interactive or informational elements.

Layout and Styling: The layout and styling of Page UI are determined by the instructions provided in the SDUI JSON. This includes specifying how elements are positioned, their sizes, margins, padding, colors, fonts, and other visual attributes.

Data Binding: Page UI is often populated with real-time data through data binding. Data bindings connect UI components to data sources, ensuring that the displayed content is up-to-date and reflects changes on the server.

Interactivity: Interactive elements within the Page UI, such as buttons, links, and input fields, are designed to respond to user actions. Event handling and user interaction logic are defined to provide a responsive and intuitive user experience.

Navigation: Page UI may also include navigation elements, such as menus, tabs, or buttons that allow users to move between different screens or sections of the application.

Real-Time Updates: Page UI is capable of receiving real-time updates from the server. This enables dynamic changes to the UI without requiring users to manually refresh the application

What is SDUI Config?

In SDUI , the configuration or SDUI config encompasses various components:

Page Level Unresolved Config: This facet involves page-level settings that may incorporate dynamic or unresolved elements. It allows for conditional behavior, flexible styling, and data binding based on real-time conditions.

Skeleton of Components: SDUI config serves as a foundational blueprint, defining the initial arrangement of UI components on a page. This structural ‘skeleton’ sets the stage for the user interface layout.

Static Component Values: For UI elements with unchanging values, the config provides a straightforward specification. For instance, it can define default button labels, like ‘Submit,’ ensuring consistency.

Static Component Action: Similarly, static actions for UI components are defined. This includes specifying default actions triggered by user interactions, irrespective of dynamic variables.

Contains Reference to Values to be Resolved: The configuration may include references to values awaiting resolution at runtime. These references depend on conditions, user attributes, or dependencies. An example could be determining text color based on a user’s membership status.

Saved Config: SDUI config can be saved and versioned, allowing for change tracking and rollback capabilities. This ensures that historical records of config modifications are maintained.

Example: A config which works for membership

{
"page": "User Profile Page",
"layout": {
"structure": "2-column layout",
"components": [
{
"type": "Image",
"source": "user-avatar.jpg",
"position": "left-column"
},
{
"type": "Text",
"content": "Welcome, [UserName]!",
"position": "right-column"
}
]
},
"dynamicConfig": [
{
"element": "Text",
"property": "content",
"value": "Hello, [UserName]!",
"condition": {
"ifUserIsMember": {
"value": "Welcome, [UserName]!",
"elseValue": "Join now and enjoy exclusive benefits!"
}
}
},
{
"element": "Image",
"property": "source",
"value": "premium-avatar.jpg",
"condition": {
"ifUserIsMember": true
}
}
],
"generatedBy": "Admin Dashboard",
"savedConfig": "v1.2",
"description": "Config for the user profile page"
}

What is DataSource?

A datasource in the context of Server-Driven User Interface (SDUI) is essentially the source of data for your application. It could be a database like MySQL or MongoDB, an API, or any other data store that provides information to populate your app’s user interface.

Any datasource works in SDUI

What is BFF Layer?

BFF (Backend For Frontend): Abbreviated as BFF, which stands for “Backend for Frontend,” the BFF layer serves as an intermediary layer specifically designed to cater to the frontend’s needs in an SDUI architecture.

Hydration from SDUI Page Config: Within the BFF layer, all UI components are “hydrated” or populated with data from the SDUI page configuration. This means that the SDUI page config, which defines the structure and behavior of the user interface, is used to populate UI components with the necessary data.

Dynamic Reference Resolution: The BFF layer is responsible for resolving dynamic references at runtime. This involves retrieving data from database values and referencing SDUI component configurations and logic to ensure that the UI elements are updated with the most current and relevant information.

Extra Business Logic: In addition to data retrieval and reference resolution, the BFF layer can incorporate extra business logic specific to the frontend’s requirements. This logic can include validation checks, order adjustments, experiments, and personalization features that enhance the frontend’s functionality and user experience.

Do we understand SDUI System?

Phew that took forever

What are the Use Cases of SDUI system?

Internet-Driven Pages: SDUI is well-suited for web applications, websites, and mobile apps that rely on real-time data and content updates from the internet. Examples include news websites, social media platforms, and e-commerce sites where content needs to be frequently refreshed without requiring app updates.

Content-Rich Apps: Applications that serve a wide range of content, such as news articles, images, videos, or product listings, can benefit from SDUI. It enables seamless content updates, personalized recommendations, and dynamic user experiences.

SDUI : Any Other Benefits?

A/B Testing: SDUI enables seamless A/B testing and experimentation. Different UI configurations, content variations, or feature flags can be dynamically applied to specific user segments without the need for app updates. This allows for data-driven decision-making and optimization of user experiences.

Easy Configurations using Remote Configs at BFF Layer: Remote configuration management becomes simplified with SDUI. Changes to UI behavior, styling, or content can be managed centrally at the BFF (Backend For Frontend) layer, allowing for rapid adjustments without deploying new app versions.

Personalization: SDUI empowers applications to deliver personalized content and experiences to users. Data-driven insights can be used to customize UI elements, recommendations, and user journeys based on individual preferences and behavior.

Leveraging BFF Layer and Pre-Processing of Data: The BFF layer in SDUI can preprocess and optimize data before it reaches the client, reducing the workload on the client-side and enhancing overall performance. Data can be transformed, aggregated, or enriched to match the frontend’s specific needs.

New Pages Instantaneously: With SDUI, it’s possible to introduce entirely new pages or views instantly without the need to ship code updates to the app stores. If the same UI components are reused, the configuration can be adjusted to create new pages dynamically.

Consistency Across Platforms: SDUI promotes UI consistency across different platforms, including web, Android, and iOS. By defining UI components and behavior on the server side, the same user experience can be maintained across various devices and operating systems.

Release Management: SDUI simplifies the release management process. Updates, fixes, and enhancements can be implemented on the server side without requiring users to download and install new app versions. This streamlines the release cycle and reduces user friction.

Rollback Faulty Releases: In the event of issues or bugs in a release, SDUI allows for quick rollbacks. The server configuration can be reverted to a previous state, ensuring that users have a stable and reliable experience while issues are addressed.

Are there any challenges with SDUI?

while Server-Driven User Interface (SDUI) offers various advantages, it also presents certain challenges and considerations that developers and organizations should be aware of:

Complexity at Backend: Implementing SDUI can introduce complexity at the backend, particularly when managing dynamic UI configurations, data processing, and handling various client requests. It requires robust server infrastructure and logic.

Backward Compatibility: Maintaining backward compatibility with older versions of the client app can be challenging when making changes to SDUI configurations. Ensuring a smooth transition for existing users is essential.

Versioning to Prevent Errors: Effective version control and management are crucial to prevent errors and inconsistencies in SDUI configurations. Different levels of versioning may be needed, including component level, BFF level, SDUI config level, and app version level.

Accessibility: Ensuring accessibility for users with disabilities is essential, especially for large-scale consumer apps. SDUI implementations need to adhere to accessibility standards to provide an inclusive user experience.

Load Time: SDUI configurations, particularly when complex, can impact app load times. Optimizing the delivery and processing of SDUI data is necessary to maintain a responsive user experience.

Modularization: Breaking down the UI into modular components can be challenging but is essential for SDUI flexibility. Proper modularization allows for reusability and scalability.

Development and Maintenance: Developing and maintaining SDUI configurations, especially in large and evolving applications, can require ongoing effort and resources. It’s essential to have processes in place for efficient development and updates.

Anyone Uses it?

Yes, Server-Driven User Interface (SDUI) is on the rise, and an increasing number of companies are adopting this approach to enhance the flexibility and efficiency of their applications. Here are a few examples of companies that have embraced SDUI:

Reddit:

Tinder:

Robinhood:

Airbnb:

Can i ever use SDUI?

What do Tinder, Reddit, Robinhood, and Airbnb have in common?

They shared a combination of resources: Time, Money, and Expertise.

Time , Money and Expertise is all you need to build an SDUI system

So question how can anyone use SDUI it they dont have all 3??

access to SDUI a loosing battle??

That is why we built Digia

We recognized that not everyone has the resources or expertise to implement a Server-Driven User Interface (SDUI) system. That’s why we developed Digia, a mobile app development platform. With Digia, anyone can harness the capabilities of an SDUI system, making dynamic and responsive mobile app development accessible to a wider audience

Check it out at here

--

--