Skip to main content

Server-Driven UI in React Native: How Flipkart & Blinkit Power Their Dynamic Homepages

Server-Driven UI in React Native: Flipkart & Blinkit Style

Ever wondered how apps like Flipkart or Blinkit update their homepages without an app update?
It's all possible thanks to Server-Driven UI (SDUI).

๐Ÿง  What Is Server-Driven UI?

Instead of hardcoding the UI in the app, you fetch a JSON configuration from the backend that describes the UI layout and components. The app then renders components dynamically based on this data.

๐Ÿ“ฆ Sample JSON

{
  "type": "VerticalLayout",
  "children": [
    {
      "type": "Banner",
      "image": "https://example.com/banner.jpg",
      "action": {
        "type": "navigate",
        "target": "ProductScreen",
        "params": { "id": "1234" }
      }
    },
    {
      "type": "ProductCarousel",
      "title": "Top Deals",
      "products": [
        {"id": 1, "title": "Item A"},
        {"id": 2, "title": "Item B"}
      ]
    }
  ]
}

๐Ÿ› ️ Renderer Example in React Native

const handleAction = (action) => {
  if (action?.type === 'navigate') {
    navigation.navigate(action.target, action.params);
  }
};

const renderComponent = (component) => {
  switch (component.type) {
    case 'Banner':
      return (
         handleAction(component.action)}>
          
        
      );
    case 'ProductCarousel':
      return (
        
          {component.title}
           {item.title}}
          />
        
      );
    case 'VerticalLayout':
      return (
        
          {component.children.map((child, index) => (
            {renderComponent(child)}
          ))}
        
      );
    default:
      return null;
  }
};

๐Ÿ”€ Navigating from JSON Components

You can define navigation actions directly in JSON using a consistent contract. The renderer interprets and executes those using React Navigation.

{
  "type": "button",
  "title": "Shop Now",
  "action": {
    "type": "navigate",
    "target": "ShopScreen",
    "params": {
      "category": "electronics"
    }
  }
}

Your app should support a universal handleAction method that handles navigation, deep links, modals, and other behaviors as per the JSON definition.

⚙️ How It Works: Flow Diagram

  1. ๐Ÿ“ฒ App starts
  2. ๐Ÿ”„ Fetches UI schema JSON from server
  3. ๐Ÿง  Parses JSON and maps it to UI components
  4. ๐Ÿ“ Attaches actions like navigation based on JSON
  5. ๐Ÿ“ฆ Re-renders UI on schema change without needing app updates

✅ Benefits

  • Real-time updates without app releases
  • Backend A/B testing of layouts
  • Dynamic navigation powered by backend logic

๐Ÿšจ Challenges

  • Initial setup takes time
  • Need strong backend + caching strategy
  • Validation, type safety & fallback handling required

๐Ÿงช Real-World Use Cases

App Use Case
Flipkart Home screen banners, carousels, deals
Blinkit Dynamic categories, offers, seasonal content
Netflix Category rows like Trending, New Releases

๐Ÿ“Œ Best Practices

  • Design a component contract between backend and frontend
  • Support standardized action types like navigate, modal, toast
  • Use TypeScript types/interfaces to validate JSON schema
  • Set up fallback UI for unknown types or errors
  • Cache schema locally to improve performance

๐Ÿš€ Conclusion

Server-Driven UI is future-ready — giving you flexibility, speed, and control over content. Adding action management like navigation brings dynamic interactivity with no need for manual updates.

๐Ÿ”— Tip: Combine with React Navigation,Redux or Context to manage global state across JSON-defined views.

Comments

Popular posts from this blog

⚠️ React Native 0.79 (New Architecture) – Common Issues & Quick Fixes

React Native 0.79 (New Architecture) – Common Issues & Fixes With React Native 0.79 (part of Expo SDK 53 ), the New Architecture — which includes TurboModules , Fabric , and JSI — is now enabled by default. While this delivers better performance and platform-native alignment, many developers are encountering critical issues while upgrading or starting fresh projects. ๐Ÿ” Brief: What’s Going Wrong? 1. Third-Party Library Crashes Libraries like react-native-maps or @stripe/stripe-react-native might crash due to incompatibility with TurboModules or Fabric rendering. 2. Build & Runtime Errors Common issues include build failures related to CMake, Hermes, or JSI, and runtime UI bugs — especially on Android with edge-to-edge layout behavior. 3. Component Rendering Issues Blank screens, flickering components, or gesture conflicts due to changes in how the new rendering system manages views. ✅ Solutions & Fixes 1...

React Native Expo (2025 Edition)

Expo in React Native: Everything You Need to Know (2025 Edition) Everything You Need to Know About Expo in 2025 ๐Ÿš€ Expo is a framework and platform for universal React applications. It simplifies the development and deployment process of React Native apps with powerful tools and services. As of 2025, Expo has matured into an all-in-one toolkit that supports everything from development to distribution. ๐Ÿ“ฆ What is Expo? Expo is a set of tools built around React Native to help you build native iOS, Android, and web apps using JavaScript and React. It removes native dependencies, making it easier for JavaScript developers to build and deploy native apps quickly. ๐Ÿงฐ Key Services Provided by Expo Expo Go: Preview your app without needing to build a native binary. Expo Dev Client: Customizable development client for testing native modules. EAS Build: Build your app in the cloud for iOS and Android. EAS Submit: Submit builds to...

Expo SDK 53 Beta Now Live – Explore New Features Today

New Release: Expo SDK 53 Beta Now Available for Developers Here are the key highlights from the Expo SDK 53 release notes that are particularly relevant for your interest in performance improvements, new features, and support for various modules: ๐Ÿš€ Performance & Architecture 1. New Architecture is Now Default All new projects ( npx create-expo-app ) will now use the New Architecture by default. This includes Hermes , Fabric , and TurboModules for both iOS and Android. You can still disable the new architecture by setting EXPO_ENABLE_NEW_ARCHITECTURE=false . 2. Startup Time Improvements Thanks to the New Architecture and general optimizations, startup performance has improved. Support for React Native 0.73 , bringing improved performance, bug fixes, and updated UI features.