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...

Edge-to-Edge UI in Android with React Native: How to Do It Right (2025 Update)

Intro Starting from 2024-25, Android apps are expected to embrace edge-to-edge UI — where your app content flows behind the system bars (status bar, navigation bar) for a fully immersive experience. Google is pushing for it hard, and React Native (especially with New Architecture and Expo SDK 53+) has made it much easier to implement. In this blog, I’ll walk you through: ✅ Why edge-to-edge matters for modern Android apps ✅ How to implement it correctly in React Native (Expo & Bare projects) ✅ Handling tricky parts like keyboard, gestures, and safe areas ✅ Real-world gotchas I ran into — and how to fix them Why Edge-to-Edge? Modern Android design guidelines (Material You) heavily prefer edge-to-edge layouts. It makes apps feel more native, more immersive, and makes better use of larger phone screens. Plus, starting Android 15, apps that don't adopt it might feel noticeably "outdated". How to Do It in React Native ๐Ÿš€ ...