Skip to content

    Frontend System Design

    Mobile and Cross-Platform Front Ends

    Compare mobile web, WebView, React Native, Flutter and Kotlin Multiplatform by who draws the pixels and what code is shared, then design a shared core.

    By Published 12 min read

    • frontend-system-design
    • mobile
    • cross-platform
    • react-native
    • flutter
    Share

    Standard lessonintermediateFrontend System Design

    Before this: Component-Based Architecture

    What you'll learn: By the end of this lesson you will be able to name the five common ways to put a front end on a phone, say for each one who draws the pixels and how its code reaches platform features, design a shared core with thin platform adapters, list what every mobile front end must handle that a web page can ignore, and choose an approach for a team and a product.

    A theatre company wants to tour one play to many cities. It can hire a local cast in each city, which looks native but means rehearsing the play again and again. It can bring its own troupe, set and lighting, which is identical everywhere but ignores the local house. Or it can put the script in a shared binder and let each city stage it. A cross-platform front end makes the same choice: who performs, and what travels in the binder.

    This lesson builds on component-based architecture. The running example is the shopper app of the ShopStream grocery marketplace: a product page, a cart and a checkout, which must work on iOS and Android and also exists as a website. Later lessons in this track go deeper on the choice framework, React Native architecture, hybrid apps and mobile web performance; they are named here only in plain text.

    Verified on 2026-12-01 against the React Native, Flutter, Capacitor, Kotlin Multiplatform, Android WebView and MDN documentation. No mobile device, emulator or cloud was available. The one Node script on this page was run; every platform snippet was not run.

    The core idea

    Two decisions define a cross-platform front end, and they are independent.

    1. Who draws the pixels? The browser engine, a web view inside a native app, the platform's own native views, or a rendering engine that ships inside your app.
    2. Where is the line between shared code and platform code? Everything shared, only the business logic shared, or only some modules shared.

    Every approach below is a point in that grid. None is "best"; each is a trade of control, consistency, team skills and the cost of reaching platform features.

    Five ways to put a front end on a phone

    Approach Who draws the UI Your language Reaching platform features
    Mobile web / PWA The browser engine JavaScript or TypeScript Web APIs only
    WebView hybrid (for example Capacitor) A web view inside a native shell JavaScript or TypeScript Plugins with native code
    React Native The platform's native views JavaScript or TypeScript Native modules
    Flutter Flutter's own engine Dart Platform channels, FFI
    Kotlin Multiplatform (KMP) Native views, or Compose Multiplatform Kotlin expect and actual, or interfaces

    Mobile web and PWAs. MDN defines a progressive web app as one "built using web platform technologies" that provides "a user experience like that of a platform-specific app": it can run on many platforms from one codebase, be installed, work offline and operate in the background. The installable PWAs lesson covers the manifest and push, and service workers cover the offline half.

    WebView hybrids. A web view is a browser component that a native app embeds. Android's documentation says WebView "lets you display web pages as a part of your activity layout" and does not include "the features of a fully developed web browser, such as navigation controls or an address bar". Capacitor describes itself as "a cross-platform native runtime" that creates "Web Native apps" in "a native container", with a plugin API for Swift on iOS and Java on Android. Your UI is still HTML, CSS and JavaScript; the shell and plugins are the native part.

    React Native. You write React components; the framework creates native views. Its documentation says: "At runtime, React Native creates the corresponding Android and iOS views for those components", so a View becomes a ViewGroup on Android and a UIView on iOS, and Text becomes a TextView or UITextView. Because the views are the platform's own, the documentation says the apps "look, feel, and perform like any other apps".

    Flutter. Flutter does not use the platform's controls. Its documentation says it "has its own implementations of each UI control, rather than deferring to those provided by the system", written in Dart, with an engine "mostly written in C++" that renders through Impeller, which ships with the app.

    Kotlin Multiplatform. KMP shares code rather than a UI toolkit. JetBrains' overview says you can "share isolated modules, such as networking or storage", or "all of your business logic while keeping the UI native", and optionally share UI with Compose Multiplatform. Native screens (SwiftUI, UIKit or Android views) can stay.

    Who draws the UI in each approachWeb code to Browser engine; Web code to WebView in a shell; React components to Native views; Dart widgets to Own rendering engine; Browser engine to Phone OS (web APIs); WebView in a shell to Phone OS (plugins); Native views to Phone OS (native modules); Own rendering engine to Phone OS (channels, FFI)Web codeWeb codeBrowser engine: mobile web, PWABrowser enginemobile web, PWAWeb codeWeb codeWebView in a shell: hybridWebView in ashellhybridReact componentsReactcomponentsNative views: React NativeNative viewsReact NativeDart widgetsDart widgetsOwn rendering engine: FlutterOwn renderingengineFlutterPhone OS: screen, sensors, pushPhone OSscreen, sensors,pushweb APIspluginsnative moduleschannels, FFI

    Figure 1. Four ways to reach the same phone. How to read this: each row is one approach. The left box is the code you write and the middle box is what turns it into pixels. The labels on the right are how that approach calls the operating system.

    Crossing the boundary

    Whatever you choose, your code eventually needs the camera, secure storage or push tokens. How that call is made differs.

    Flutter's documentation says a platform channel serializes data: "Data is serialized from a Dart type like Map into a standard format, and then deserialized" in Kotlin or Swift. It adds that its foreign function interface "can be considerably faster than platform channels, because no serialization is required". React Native's New Architecture "removes the asynchronous bridge between JavaScript and native and replaces it with JavaScript Interface (JSI)", which "allows JavaScript to hold a reference to a C++ object", so that "you can directly invoke methods without serialization costs". The documentation says the New Architecture is enabled by default from React Native 0.76.

    sequenceDiagram accTitle: Two ways a cross-platform app calls native code accDescr: In the message style, shared code sends a serialized message to the platform side, which deserializes it, does the work and sends a serialized reply. In the direct-reference style, shared code holds a reference to a native object and calls its method without serializing the arguments. participant S as Shared code participant P as Platform code Note over S,P: Message style, for example a Flutter platform channel S->>P: serialized message P->>P: deserialize, do the work P-->>S: serialized reply Note over S,P: Direct reference, for example React Native JSI S->>P: call a held reference, no serialization P-->>S: result

    Figure 2. Two kinds of boundary. How to read this: both reach the platform. The first copies data through a message, so keep calls coarse. The second can call finely, but needs native objects exposed to the runtime.

    The architectural rule survives either way: keep boundary calls few, coarse and asynchronous, and never put one in a scrolling or animation loop without measuring.

    What a mobile front end must handle

    A web page can often ignore these. A phone app cannot.

    • Process lifecycle. The operating system may end a backgrounded app. State that lives only in memory is gone at the next launch, so save drafts and carts as the user works. See state persistence and synchronization.
    • Connectivity. Mobile networks drop and return. Design for reads from a local copy and writes queued for later, as in offline-first sync.
    • Back and navigation. The platform's back gesture or button must do what users expect, including inside a web view, where your code has to ask whether there is history.
    • Platform differences. React Native offers Platform.OS and Platform.select for small differences, and .ios. or .android. file extensions for larger ones.
    • Distribution. An installed app updates through the store and the user's device, not at your deploy. Old versions keep calling your API for a while. Treat the API as a contract with versions you cannot recall.
    • Push. On the web it needs a service worker and permission (see the PWA lesson); native apps use the platform's own push service.

    Illustration 1: a shared core with thin adapters (minimal example)

    Keep the code that decides things (prices, totals, cart rules) free of platform calls, and reach storage through a small interface, a port. Each platform supplies an adapter. KMP's documentation recommends exactly this style where it can: it says to "rely on standard language constructs wherever possible" and recommends interfaces with dependency injection in many cases, instead of expect and actual declarations.

    A shared core with platform adaptersPlatform UI to Shared core (events); Shared core to Storage port; Storage port to Web adapter; Storage port to Native adapterPlatform UI: native, web or FlutterPlatform UInative, web orFlutterShared core: cart rules, totals, syncShared corecart rules,totals, syncStorage port: get, setStorage portget, setWeb adapterWeb adapterNative adapterNative adapterevents

    Figure 3. The binder travels, the cast is local. How to read this: the middle boxes are shared and testable in Node. Only the left and right edges know which platform they run on.

    The script below models the core with two stand-in adapters (one fast, one delayed) over one backing map. Real adapters would call browser or native storage, and no such adapter was run. It was run with Node 26, which strips the TypeScript types.

    interface StoragePort {
      get(key: string): Promise<string | null>;
      set(key: string, value: string): Promise<void>;
    }
    function createCart(storage: StoragePort) {
      let lines: { sku: string; cents: number; qty: number }[] = [];
      return {
        async load() { lines = JSON.parse((await storage.get("cart")) ?? "[]"); },
        async add(line: { sku: string; cents: number; qty: number }) {
          lines = [...lines, line];
          await storage.set("cart", JSON.stringify(lines)); // persist on every change
        },
        total: () => formatPrice(lines.reduce((sum, l) => sum + l.cents * l.qty, 0)),
      };
    }

    Adding two units at 129 cents and one at 349 cents, then building a fresh cart over the same storage, printed:

    before the app is killed: 6.07
    fresh instance, nothing loaded: 0.00
    after load through the other adapter: 6.07

    The middle line is the mobile lesson: a new process starts empty until it loads. The same core worked through both adapters because it only knew the port.

    Illustration 2: the shopper app (realistic example)

    The ShopStream shopper app has a product page (photo, price, an Add button), a cart and checkout. The rules that matter (price rounding, promotion eligibility, cart merging after sign-in, the order of checkout steps) are the same on every platform, so they belong in the shared core. The screens differ: a native-feeling scroller on a phone, keyboard-heavy forms on the web. The camera for barcode scanning and push tokens are platform adapters.

    For a small piece of platform-specific UI, React Native's documented Platform.select fits (not run here):

    const styles = StyleSheet.create({
      container: {
        flex: 1,
        ...Platform.select({
          ios: { backgroundColor: "red" },
          android: { backgroundColor: "green" },
          default: { backgroundColor: "blue" },
        }),
      },
    });

    Illustration 3: a failure, rotating a web view (edge case)

    A hybrid app shows the checkout form in an Android WebView. A shopper rotates the phone half way through typing. Android's documentation explains that configuration changes such as rotation "cause a WebView object's activity to be destroyed and a new activity to be created, which also creates a new WebView object that loads the destroyed object's URL". The page reloads and the typed form values vanish. The documented remedy is saveState in onSaveInstanceState() and restoreState on recreation; a web-side remedy is to persist the form as the user types, which also covers the process being ended.

    Choosing an approach

    flowchart TD accTitle: Choosing a cross-platform approach accDescr: If the product does not need installation or deep device features, mobile web or a PWA is enough. If a web team must ship in stores quickly with few device features, a WebView hybrid fits. If the app needs native look and feel and the team knows React, React Native fits. If a pixel-identical custom UI matters most, Flutter fits. If native screens are required and logic is shared across platforms, Kotlin Multiplatform fits. S["Mobile product"] --> Q1{"Needs store presence or
    deep device features?"} Q1 -->|no| W["Mobile web or PWA"] Q1 -->|yes| Q2{"Native look and feel,
    and a React team?"} Q2 -->|yes| R["React Native"] Q2 -->|no| Q3{"One custom UI that looks
    the same everywhere?"} Q3 -->|yes| F["Flutter"] Q3 -->|no| Q4{"Native screens with
    shared logic?"} Q4 -->|yes| K["Kotlin Multiplatform"] Q4 -->|no| H["WebView hybrid"]

    Figure 4. A first-pass choice. How to read this: it is a starting point, not a verdict. Team skills, existing code and the features you need can override any branch.

    Trade-offs

    Approach Gain Cost Wrong when
    Mobile web / PWA One codebase, no store Only web APIs You need device features the web lacks
    WebView hybrid Reuse web code, store presence A browser engine per app; web view memory and lifecycle care UI must feel fully native
    React Native Native views, React skills A native layer to maintain The team has no JavaScript
    Flutter Consistent rendering, one UI A new language; UI is not the platform's controls You must match each platform's look exactly
    KMP Native UI plus shared logic Screens written per platform unless Compose is used The team wants one UI codebase

    Build it

    This lesson has no lab. The Node script above is a teaching model with no repository folder and no golden file.

    In practice: the ShopStream shopper app

    This is a realistic scenario, not a case history. It is a composite built from common patterns, and every number is an illustrative assumption.

    The situation

    ShopStream has a React and TypeScript web team of six (illustrative). The website converts well, but shoppers ask for push alerts when the courier is near, barcode scanning for reorders, and an icon on the home screen. There is no budget for three separate teams.

    Starting architecture

    Starting architecture: web onlyWeb app to ShopStream API (HTTPS); ShopStream API to Backend servicesWeb app: components and fetch calls mixedWeb appcomponents andfetch calls mixedShopStream APIShopStream APIBackend servicesBackendservicesHTTPS

    Cart rules live inside components, so they cannot be reused outside the web app.

    Options considered

    Option Gain Cost Wrong when
    A. PWA only No store, one codebase No scanning on some devices; push limited to what the platform allows Store presence is a goal
    B. WebView hybrid Reuse most web code Web view lifecycle and memory care The app must feel native
    C. React Native with a shared core Native views, team skills, shared rules A native layer and a second UI The team will not own native tooling
    D. Two native apps Best platform fit Three codebases for the same rules Team of six, one budget

    The decision

    Option C. First extract the cart, pricing and checkout rules into a framework-free package with ports for storage, the API client and device features, as in Figure 3. The website and the React Native app both depend on it. Treat this as one defensible answer for this team, not a rule.

    Rollout and verification

    Ship the extraction on the website first and verify with the existing tests. Add the app screen by screen, behind a store-side staged release, and compare cart totals between web and app for the same inputs in a shared test fixture.

    The 2 a.m. failure

    A pricing fix ships on the web within minutes, but app users on older versions still compute the old total at checkout and the API rejects some orders.

    First checks: which app versions call the checkout endpoint; whether the server validates the total instead of trusting the client; whether a minimum-version signal exists. Mitigation: make the server the authority on totals and return a clear "update required" response for old versions. Follow-up: a version policy; later lessons on version skew and flags in this track cover it in depth.

    Architect's notes

    • Share decisions, not pixels: rules and data shapes travel well; UI conventions rarely do.
    • Keep ports small. A storage port with two methods is easy to fake in tests.
    • Measure boundary calls before putting them in a hot loop.
    • Persist as the user works. A mobile process can end at any time.
    • Own the native layer you choose; every approach has one.

    Common mistakes

    • Choosing by popularity instead of team skills and product needs.
    • Putting business rules in screen components, so they cannot be shared.
    • Trusting the client's total, with old app versions in the field.
    • Ignoring the back gesture in a web view.
    • Treating a PWA, a hybrid and a native app as one set of capabilities.

    Key takeaways

    • Cross-platform choices differ in who draws the pixels and where shared code stops.
    • Web and hybrid apps use the browser engine; React Native uses native views; Flutter draws its own; KMP shares logic and can keep native UI.
    • Boundary calls cost something; keep them few and coarse.
    • Mobile adds lifecycle, connectivity, back navigation, versions and push that web pages can often ignore.
    • A shared core behind small ports is the most reusable part of any approach.

    Practice exercises

    Exercise 1 (30 min). Extend the Node script with a remove method and a test that a fresh instance sees the removal. Which adapter methods does it need?

    Exercise 2 (1 hour). List ten features of the ShopStream shopper app. For each, mark it shared core, platform adapter or platform UI, and justify the marks that are not obvious.

    Official documentation

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments