Native implementations

This page explains how native integrations use the Webview Bundle format on each platform.

Rust core

The Rust core (wvb) reads .wvb files, manages builtin and remote sources, handles resource requests, and downloads and installs updates. Sharing this logic keeps format handling and version selection consistent across hosts.

Platform and runtime support

Each integration calls the core through the following interface:

HostCore interfaceWebview integration
Node.js / Electronnapi-rs native addonElectron protocols and preload communication
TauriRust crateTauri plugin and custom URI schemes
AndroidUniFFI Kotlin bindingsWebViewClient request interception
iOSUniFFI Swift bindingsWKURLSchemeHandler
Deno DesktopDeno FFI shared libraryRoutes served with Deno.serve()

Protocol handling

For an app://app.wvb/index.html request, the default bundle resolver uses the first hostname segment, app, as the bundle name, and the path resolver selects /index.html. The native host reads the entry's data, content type, and headers from the bundle and returns an HTTP response to the webview.

Bundle resolver (UriBundleResolver)

The bundle resolver supports the following modes:

  • hostname: uses the URI's hostname.
    • segment: the segment type or index to select from the hostname. Defaults to first.
    • allowWvbSuffixOnly: accepts only hostnames ending in .wvb. Defaults to false.
  • pathname: uses the URI's pathname.
    • segmentIndex: the index of the pathname segment to use. Defaults to 0.

For example, select a bundle by hostname or pathname:

import type { UriBundleResolver } from '@wvb/node';

// `https://app.wvb/index.html` -> bundle "app"
const byHostname: UriBundleResolver = { type: 'hostname' };

// `https://cdn.example.com/my-app/index.html` -> bundle "my-app"
const byPathname: UriBundleResolver = { type: 'pathname', segmentIndex: 0 };

Path resolver (UriPathResolver)

The path resolver supports the following modes:

  • exact: uses the URI's pathname as-is.
  • directory_index: appends /index.html to extensionless paths.
    • Examples: / → /index.html, /about → /about/index.html.
    • Used for static sites or multi-page applications (MPAs).
    • Matches Astro's format: 'directory' and Next.js's trailingSlash: true options.
  • html_extension: appends .html to extensionless paths.
    • Examples: / → /index.html, /about → /about.html.
    • Matches Astro's format: 'file' and Next.js's trailingSlash: false options.

During development, a proxy handler forwards HTTP requests to the frontend server. In a deployed app, a bundle handler reads local resources.

IntegrationDevelopment serverBundle resources
ElectronproxyProtocol()bundleProtocol()
TauriProtocolConfig::proxy()ProtocolConfig::bundle()
AndroidWebViewBundleProtocol.local()WebViewBundleProtocol.bundle()
iOS.local(scheme:hosts:).bundle(scheme:)
Deno Desktop{ proxy: URL } route{ bundle: NAME } route

Android and Deno Desktop protocols

Android uses http or https. Android WebView restricts resource requests and link resolution for custom URL schemes. To maintain compatibility with web standards, bundle resources are also served through HTTP(S) URLs that work with the same-origin policy. For details, see Android's documentation on handling custom URLs and loading in-app content.

Deno Desktop uses route-based request handling with Deno.serve() to match its available APIs. The route configuration selects the bundle, and the request URL's pathname determines the resource path within that bundle.

On this page