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

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 ๐Ÿš€ ...

React Native Expo (2025 Edition)

Expo in React Native (2025 Edition): Real-World Experience Expo in React Native (2025 Edition): Real-World Experience, Pros, Cons & Use Cases ๐Ÿš€ I’ve been working with React Native for several years and have shipped multiple production applications using both bare React Native and :contentReference[oaicite:0]{index=0} . In 2025, Expo is often misunderstood — some developers still think it’s only for beginners, while others treat it as a magic solution for everything. This article is not a documentation rewrite. Instead, I’m sharing how Expo actually behaves in real projects, where it shines, where it struggles, and when it makes sense to use it. What Is Expo (In Simple Terms)? Expo is a framework and ecosystem built on top of React Native that helps you build iOS, Android, and web apps faster by reducing native setup and handling builds, updates, and deployments for you. In 2025, Expo has evolved into a production-ready platform used by st...