Key Takeaways
- Unified Stack Superiority: Combining Next.js 15 for a high-performance PWA and Kotlin Multiplatform (KMP) for native mobile apps provides the optimal blend of discoverability, user experience, and development efficiency for ONDC Buyer Apps.
- Core Architectural Pillars: A successful ONDC Buyer App is built on three pillars: a decoupled ONDC Gateway Service, a real-time Data Ingestion Pipeline, and an AI-driven Personalization Engine.
- Data is the Differentiator: Generic ONDC discovery is a commodity. The competitive edge lies in using a unified data strategy to hyper-personalize the user journey, re-ranking search results, and providing relevant recommendations.
- Next.js 15 for Peak Web Performance: Leverage Partial Prerendering (PPR) for instantly loading static shells of product pages while dynamically streaming personalized content, and Server Actions for secure, efficient mutations.
- Kotlin Multiplatform for Native Excellence: Share critical business logic, networking layers (for Beckn protocol calls), and data models between iOS and Android to accelerate development while delivering a true native UX.
- DPDP-Compliant by Design: Architect the Customer Data Platform (CDP) and event schemas with consent management as a foundational element, ensuring compliance with India's DPDP Act from day one.
The ONDC Opportunity Demands a New Architectural Paradigm
The Open Network for Digital Commerce (ONDC) is not merely another e-commerce channel; it's a fundamental democratization of digital commerce in India. It unbundles the monolithic platform model, creating an open, interoperable network. For businesses, this presents a monumental opportunity to build Buyer Apps that can aggregate sellers and services from across the ecosystem.
However, entering this new arena comes with a significant challenge: how do you compete? With discovery becoming standardized through the Beckn protocol, the new battleground for user acquisition and retention is the user experience. Simply presenting a raw, unfiltered firehose of ONDC search results is a recipe for user churn. The winning ONDC Buyer Apps of 2026 will be those that deliver hyper-personalized, context-aware, and performant experiences that rival and even surpass today's walled-garden marketplaces.
This requires a new architectural blueprint—one that is inherently data-driven, performant across platforms, and efficient to build and scale. The thesis of this guide is that a unified stack, leveraging Next.js 15 for the web/PWA and Kotlin Multiplatform (KMP) for native mobile apps, provides the definitive framework to achieve this.
Core Philosophy: The Unified Data-Driven Stack for ONDC
A unified stack isn't just about code sharing; it's about creating a cohesive ecosystem where data flows seamlessly, driving a consistent and personalized user experience regardless of the touchpoint.
Why Next.js 15 for the Web/PWA Front-end?
Your web presence is the top of your funnel. It must be exceptionally fast, SEO-friendly, and capable of converting visitors effectively. Next.js 15 is purpose-built for this reality.
- Peak Performance with Partial Prerendering (PPR): ONDC category and product discovery pages are a perfect use case for PPR. The static shell of the page (header, footer, layout) is served instantly from the edge, while dynamic, personalized components (product recommendations, user-specific pricing) are streamed in. This delivers an unparalleled perceived performance, crucial for retaining impatient users.
- Efficient Mutations with Server Actions: Operations like adding an item to the cart, updating a shipping address, or initiating an ONDC
/select call can be handled directly via Server Actions. This simplifies the codebase by co-locating front-end and back-end logic, reducing the need for separate API endpoints and improving security.
- Unbeatable SEO for Discovery: While ONDC is a network, users will still discover your Buyer App through traditional search engines. The robust server-side rendering (SSR) and static site generation (SSG) capabilities of Next.js ensure your pages are perfectly indexed, driving organic traffic.
Why Kotlin Multiplatform (KMP) for Native Mobile Apps?
For high-engagement users, a native mobile app is non-negotiable. It offers superior performance, access to platform-specific features (like push notifications for order updates), and a more integrated user experience. KMP is the most pragmatic and powerful choice for this.
- Share What Matters, Specialize Where Needed: The core logic of an ONDC Buyer App—networking layers for Beckn API calls, data models for products and orders, cart management, state management, and validation rules—is platform-agnostic. With KMP, you write this logic once in a
shared Kotlin module and it compiles to both JVM bytecode for Android and native binaries for iOS.
- True Native Performance & UI: Unlike web-view-based frameworks, KMP allows you to build your UI using the native toolkits: Jetpack Compose for Android and SwiftUI for iOS. This ensures zero-compromise performance, fluid animations, and adherence to platform design conventions, which is critical for user trust and conversion.
- Accelerated Time-to-Market: By eliminating the need to write and maintain two separate codebases for the entire application logic, you drastically reduce development time, minimize bugs, and ensure feature parity between your iOS and Android apps.
The Data-Driven Core: Unifying User Signals
The most critical component is the data pipeline. Without a unified view of the customer, personalization is impossible.
- The Problem: A user searches for "running shoes" on your Next.js website, browses a few options, but doesn't buy. Later, they open your native iOS app. Do you treat them as a new user? Or do you greet them with a curated list of running shoes based on their previous browsing session?
- The Solution: Implement a central, event-driven data pipeline. Both the Next.js app (using a server-side SDK to avoid ad blockers) and the KMP native apps push standardized events (e.g.,
user_searched, product_viewed, added_to_cart) to a single ingestion point. This data feeds a Customer Data Platform (CDP) that builds and enriches a single, unified profile for each user across all platforms.
The Architectural Blueprint: A Component-by-Component Breakdown
This architecture is designed as a set of decoupled microservices, enabling independent scaling and development.

The ONDC Gateway Service
This service acts as the brain of your ONDC operations, abstracting the complexity of the Beckn protocol from your front-end applications.
- Role: A single, secure entry point for all ONDC interactions. It is the only component that speaks the Beckn protocol directly.
- Technology Stack: Built with a high-performance, asynchronous framework like Ktor (Kotlin), or gRPC with a Go/Rust implementation for maximum throughput.
- Core Functionality:
- Authentication & Signing: Manages the cryptographic signing of all outgoing ONDC requests as required by the network.
- Protocol Translation: Translates simple requests from your front-ends (e.g.,
POST /api/search?q=shoes) into the verbose, structured JSON required by ONDC's /search endpoint.
- State Management: Manages the state of asynchronous ONDC transactions (e.g., tracking an order from
/init to /confirm to /status).
- Webhook Handling: Receives and processes asynchronous callbacks from the ONDC network (e.g., an order update from a Seller App).
The Data Ingestion & Processing Pipeline
This is the central nervous system of your data-driven strategy. It must be scalable, real-time, and built with compliance in mind.
- Event Ingestion: Use a managed streaming service like AWS Kinesis or a self-hosted Kafka cluster. Define a strict, unified event schema (e.g., using Protocol Buffers) for all user interactions.
- Real-Time Processing: Leverage serverless functions (AWS Lambda, Google Cloud Functions) or a stream processing framework (Apache Flink) to consume events. These processors will:
- Clean & Validate: Ensure data quality.
- Enrich: Add context like user location, device type, or session information.
- Route: Send raw events to a data lake (e.g., AWS S3) for analytics and processed user profile updates to your CDP's database.
- The Customer Data Platform (CDP): This is not an off-the-shelf product but a purpose-built service. It consists of:
- Profile Store: A fast database (e.g., PostgreSQL with JSONB, or a dedicated key-value store like Redis) that stores the latest state of each user's profile.
- Identity Resolution: Logic to merge anonymous user sessions with logged-in user profiles.
- DPDP Compliance Layer: An API for managing user consent, handling data access requests, and processing erasure requests, ensuring full compliance with the DPDP Act.
The Real-Time Personalization Engine
This is where you turn raw data into a competitive advantage. It integrates directly with the ONDC Gateway to enhance, not just pass through, the discovery experience.

- Function: An API service that takes a user ID and a set of ONDC search results as input and returns a re-ranked, personalized list.
- Core Logic:
- The ONDC Gateway receives a search request from a user.
- It forwards the request to the ONDC network and gets back a generic list of products.
- Crucially, before returning the list to the user, the Gateway calls the Personalization Engine with the user's ID and the generic results.
- The Personalization Engine fetches the user's profile from the CDP (e.g., past purchases, viewed categories, brand affinity).
- It applies ML models (e.g., collaborative filtering, learning-to-rank models) to re-order the product list, boosting items the user is most likely to be interested in.
- The enhanced, personalized list is returned to the user's app.
This feedback loop turns a generic discovery platform into a curated shopping experience, dramatically increasing conversion rates.
Implementation Deep Dive: Connecting the Pieces
Shared Logic with Kotlin Multiplatform
Structure your KMP project to maximize code sharing. A typical module setup would be:
shared: Contains all platform-agnostic code.
commonMain: The core Kotlin logic. This is where you'd define your Beckn API client (using Ktor), data classes for ONDC objects, and business logic repositories.
androidMain: Android-specific implementations (actual declarations).
iosMain: iOS-specific implementations (actual declarations).
androidApp: The Android application module, consuming the shared module.
iosApp: The Xcode project for the iOS app, consuming the shared module as a framework.
// Example in shared/src/commonMain/kotlin/com/induji/ondc/data/Models.kt
import kotlinx.serialization.Serializable
@Serializable
data class ONDCItem(
val id: String,
val descriptor: ONDCDescriptor,
val price: ONDCPrice
)
@Serializable
data class ONDCDescriptor(
val name: String,
val images: List<String>
)
// This data class is used by both the iOS and Android apps without duplication.
High-Performance Discovery with Next.js 15
In your Next.js app, a product search page can leverage React Server Components (RSCs) and PPR.
// app/search/[query]/page.tsx
import { Suspense } from 'react';
import { ProductGridSkeleton } from '@/components/skeletons';
import { PersonalizedProductGrid } from '@/components/PersonalizedProductGrid';
// This is a React Server Component
export default async function SearchPage({ params }: { params: { query: string } }) {
return (
<div>
<h1>Results for "{decodeURIComponent(params.query)}"</h1>
{/* The skeleton is rendered instantly on the server */}
<Suspense fallback={<ProductGridSkeleton />}>
{/* PersonalizedProductGrid fetches data and streams in the result */}
<PersonalizedProductGrid query={params.query} />
</Suspense>
</div>
);
}
// components/PersonalizedProductGrid.tsx
export async function PersonalizedProductGrid({ query }: { query: string }) {
// This fetch call goes to your internal ONDC Gateway, which handles
// personalization before returning the results.
const products = await fetch(`${process.env.GATEWAY_URL}/search?q=${query}`, {
// Pass user identity for personalization
headers: { 'Authorization': 'Bearer ...' },
next: { revalidate: 60 } // Cache results for 60 seconds
}).then(res => res.json());
return (
// Render the actual product grid
);
}
Orchestrating the Transaction Flow (Beckn Protocol)
The checkout flow involves a sequence of asynchronous calls. Your Gateway must manage this state.

- User App -> Gateway (
/select): User selects items. Gateway calls ONDC /select to confirm item availability and pricing from multiple sellers.
- Gateway -> User App: Gateway returns a
transaction_id and the confirmed quotes.
- User App -> Gateway (
/init): User confirms shipping details. Gateway calls /init with the chosen quote and user details.
- Gateway -> User App: Gateway confirms the order is ready for payment.
- User App -> Gateway (
/confirm): After successful payment, the app calls the Gateway, which triggers the final ONDC /confirm call.
- ONDC Network -> Gateway Webhook (
/on_status): Hours or days later, the seller's system updates the order status (e.g., "shipped"). This hits a webhook on your Gateway. The Gateway then updates your internal database and sends a push notification to the user's native app.
Frequently Asked Questions (FAQ)
Q1: Why not just use a PWA with Next.js and skip native apps entirely?
A PWA is an excellent starting point and essential for acquisition. However, for retention and high-engagement use cases, native apps provide a superior UX through better performance, offline capabilities, and deeper OS integrations like push notifications and background services, which are critical for providing real-time ONDC order updates.
Q2: How does this architecture handle the asynchronous nature of ONDC fulfillment updates?
The ONDC Gateway is designed for this. It exposes webhook endpoints (e.g., /on_status, /on_update) that ONDC provider platforms can call. When a webhook is received, the Gateway uses a message queue (like RabbitMQ or AWS SQS) to trigger background workers. These workers update the order status in the primary database and can trigger other services, like a push notification service to alert the user on their mobile device.
Q3: What's the best way to manage shared state between the Next.js and KMP apps?
The single source of truth is always your back-end services (the CDP and your application database). State on the clients (both web and mobile) should be treated as a temporary, cached copy. For complex state management within the KMP shared module, libraries like moko-mvvm or simple state flows can be used to provide a consistent state management pattern for both iOS and Android developers.
Q4: Can we use a different framework like Flutter or React Native instead of KMP?
Yes, but KMP offers unique advantages in this context. Unlike React Native, KMP allows for truly native UI development with SwiftUI and Jetpack Compose, avoiding abstraction penalties. Compared to Flutter, KMP provides a more gradual adoption path; you can share just the networking layer or the entire business logic, and it integrates seamlessly with existing native codebases. For an organization with existing Kotlin/Android expertise, KMP is a natural and powerful extension.
Q5: How does this data-driven approach comply with the DPDP Act?
Compliance is architected from the ground up. The central CDP is key. Every piece of personally identifiable information (PII) is tied to a user's consent record within the CDP. The data ingestion pipeline checks for valid consent before processing any event. The CDP exposes internal APIs for data fiduciaries to handle user requests for data access, correction, or erasure, ensuring you can meet your legal obligations systematically.
Ready to Build a Winning ONDC Buyer App?
The ONDC landscape is a greenfield opportunity, but success requires more than just protocol compliance. It demands a sophisticated, data-driven, and high-performance architecture. The complexity of integrating a unified front-end strategy with Next.js 15 and Kotlin Multiplatform, a real-time data pipeline, a personalization engine, and the asynchronous Beckn protocol requires expert architectural guidance.
Don't navigate this complex ecosystem alone. Partner with a team that has deep expertise in building scalable, enterprise-grade solutions.
Contact Induji Technologies today for a comprehensive consultation and quote on your ONDC Buyer App strategy.