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’s New Architecture in Action: Real-World Benefits & Migration Tips

Intro React Native’s New Architecture — featuring Fabric, TurboModules, and the Codegen system — has officially moved past the “experimental” tag. With Expo SDK 53+ adopting it by default and major libraries like react-native-reanimated , react-native-gesture-handler , and @stripe/stripe-react-native now supporting it, 2025 is the year to take it seriously. But what does it really offer in practice? And how do you migrate smoothly? In this blog, I’ll break down: What the New Architecture actually brings to the table Real-world performance & developer experience gains Migration tips (with Expo & bare React Native workflows) Gotchas and stability issues I’ve personally faced — and how I fixed them What Is the New Architecture? The New Architecture in React Native introduces: Fabric: A new rendering system, enabling asynchronous and concurrent rendering. TurboModules: Faster and more efficient native modul...