Oliphaunt

Build With WASM

Use the WASM/WASIX runtime family with shipped runtime assets, app data, lifecycle, and dump/restore flows.

Use the WASM SDK when an application needs the WebAssembly/WASIX runtime family. It is first-class and independent from native liboliphaunt SDKs.

WASM is its own runtime family

Use this guide for the WASM/WASIX runtime. Native desktop and mobile apps use the native SDK pages when they embed liboliphaunt.

WASM setup path

WASM/WASIX runtime family

oliphaunt-wasix
WASIX

Install

cargo add oliphaunt-wasix

Target

WASM/WASIX hosts

SDK owns

WASM runtime behavior, WASIX assets, dump and restore flows.

Verify first

Load WASM runtime assets, open a root, and prove dump or restore for data movement.

Install the WASM package for WASIX hosts.
Open a WASM runtime root and run SQL through WebAssembly.
Use dump/restore when moving data across runtimes or versions.

Install

Install the WASM package when your application targets a WASIX host. The Rust crate is the API surface; package-manager-resolved WASIX runtime artifacts are the release boundary for consumer applications.

[dependencies]
oliphaunt-wasix = "0.1"

Open and query

Create the WASM database handle, choose storage, run SQL, and close it when the app no longer needs the runtime.

use oliphaunt_wasix::Oliphaunt;

fn main() -> anyhow::Result<()> {
    let mut db = Oliphaunt::builder().temporary().open()?;

    let rows = db.query("SELECT 1::text AS value", &[], None)?;
    let value = rows.rows[0]["value"].as_str();

    db.close()?;
    Ok(())
}

Create app data

Use the WASM API for local SQL work in supported WASIX hosts:

db.query(
    r#"
    CREATE TABLE IF NOT EXISTS notes (
        id bigserial PRIMARY KEY,
        title text NOT NULL,
        body text NOT NULL,
        created_at timestamptz NOT NULL DEFAULT now()
    )
    "#,
    &[],
    None,
)?;

db.query(
    "INSERT INTO notes (title, body) VALUES ('First note', 'Stored in a WASM PostgreSQL root')",
    &[],
    None,
)?;

let notes = db.query("SELECT id, title FROM notes ORDER BY id DESC LIMIT 20", &[], None)?;

Use dump/restore when moving data between WASM hosts or across runtime families.

Configure

Configure persistent or temporary storage, runtime mode, durability, and import/export paths through the WASM API.

Choose a mode

WASM runtime behavior differs from native runtime behavior. Use the runtime page for storage, proxy/server compatibility, and host persistence details.

Handle lifecycle

Persistent roots are locked while open. A second open against the same root returns a lock error so one runtime owns the directory at a time.

Select extensions

Install exact WASIX extension packages for the SQL extensions your app uses. The base runtime package does not include optional extension payloads.

Back up, dump, and restore

Use SDK APIs for backup/restore and dump/restore flows. Prefer dump/restore when moving data across runtimes or versions.

This guide is complete when

Use these checks before moving from a first query to application code.

Runtime assets

A WASM/WASIX host loads the WASM runtime assets before opening a root.

First query

The app opens a WASM root and runs SQL through the WASM runtime.

Data movement

Dump, restore, and upgrade flows use the WASM runtime tooling documented for that runtime.

Runtime family

The app treats WASM as its own runtime family with separate assets and build rules.

Open the WASM API map

Troubleshooting

Check storage backend behavior, runtime asset availability, target AOT asset selection, extension artifacts, host capability errors, and SQLSTATE-bearing PostgreSQL errors.

On this page