Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Run the Repository Examples

Most projects should start from the template, then follow A Synchronized Feature, End to End. This page is for contributors and readers who want to run the smaller example applications maintained inside the Ankurah repository. It is not a from-scratch project setup guide.

Get the source

git clone https://github.com/ankurah/ankurah
cd ankurah

Prerequisites

Server Setup

Start the example server (keep this running):

cargo run -p ankurah-example-server

Or in development mode with auto-reload:

cargo watch -x 'run -p ankurah-example-server'

React Example App

  1. Compile the WASM bindings in a second terminal:

    Navigate to the wasm-bindings example directory:

    cd examples/wasm-bindings
    wasm-pack build --target web --dev
    

    The one-off build exits when it finishes. For automatic rebuilds, keep this watcher running instead:

    cargo watch -s 'wasm-pack build --target web --dev'
    
  2. Run the React example app in a third terminal, starting again from the repository root:

    cd examples/react-app
    bun install
    bun dev
    
  3. Test the app:

    Load http://localhost:5173/ in one regular browser tab, and one incognito browser tab to see real-time synchronization in action!

    Note: You can also use two regular browser tabs, but they share one IndexedDB local storage backend, so incognito mode provides a better test of multi-node synchronization.

Leptos Example App

The maintained Leptos example is the standalone template; the older in-tree example is excluded from the Ankurah workspace. Clone ankurah/leptos-template and follow its README to run it. It uses Trunk to build and serve, and does not require building the Wasm bindings crate separately.

How It Works

In the example setup:

  • The server is a durable node: it retains complete event history for the data it stores and answers other nodes’ retrieval requests.
  • The browser is an ephemeral node. IndexedDB persists its synchronized working set across reloads, but the node is not expected to retain the system’s full history.
  • The demo server currently uses the Sled backend; Postgres, SQLite, and (in the browser) IndexedDB are also supported.
  • The WebSocket connector carries subscriptions, state, and events between the browser and server.

Next Steps