Getting Started
There are two ways to get started with Ankurah: using a template or setting up manually.
Starting from a Template
The quickest way to get started is to use our React + Sled template with cargo-generate:
cargo generate https://github.com/ankurah/react-sled-template
This will create a new project with:
- A Rust server using the Sled storage backend
- A React frontend with TypeScript
- WASM bindings pre-configured
- WebSocket communication between client and server
- Example models and UI components
After generating your project:
cd your-project-name
./dev.sh
This starts watchers for the Rust server, wasm-bindings, and React app. Open your browser to http://localhost:5173. Press Ctrl+C to stop and all watchers will exit cleanly.
Tip: More templates will be added soon for different use cases!
Need help? Join the Ankurah Discord!
Manual Setup
If you want to set up Ankurah from scratch, follow these steps:
Prerequisites
-
Install Rust:
-
Install Cargo Watch (useful for development workflow):
cargo install cargo-watch -
Install wasm-pack:
-
Install Bun (npm/node might work, but Bun is faster):
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
-
Compile the Wasm Bindings (keep this running):
Navigate to the
wasm-bindingsexample directory:cd examples/wasm-bindings wasm-pack build --target web --debugOr in development mode with auto-rebuild:
cargo watch -s 'wasm-pack build --target web --debug' -
Run the React Example App (keep this running):
cd examples/react-app bun install bun dev -
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
-
Install Trunk (build tool used by Leptos):
cargo install trunk -
Run the Leptos Example App (keep this running):
cd examples/leptos-app trunk serve --open
Note: For the Leptos app, there is no need to build the Wasm bindings crate separately.
How It Works
In the example setup:
- The "server" process is a native Rust process whose node is flagged as "durable", meaning that it attests it will not lose data.
- The "client" process is a WASM process that is also durable in some sense, but not to be relied upon to have all data.
- The demo server currently uses the Sled backend, but Postgres is also supported, and TiKV support is planned.
- WebSocket connections enable real-time bi-directional communication between nodes.
Next Steps
- Check out the Examples page for more code samples
- Learn about the Architecture to understand how Ankurah works
- Read the Glossary to understand key terminology
- Join the Discord to ask questions and share your projects!