Looking for Sycamore v0.9? Check out our new website!

Getting Started

This documentation assumes the developer is already familiar with Rust programming. To learn more about Rust, check out the Rust Book.

Install Rust

First, you’ll need to install Rust. Follow the official instructions to get started.

You will also need the wasm32-unknown-unknown target installed. This installs the necessary tools to compile your code to WebAssembly.

rustup target add wasm32-unknown-unknown

Minimum Supported Rust Version (MSRV) and Rust edition

The minimum supported Rust toolchain is v1.63.0. Sycamore is not guaranteed to (and probably won’t) compile on older versions of Rust.

Sycamore only works on Rust edition 2021. Even though most crates written in edition 2021 are backward compatible with older editions, this is not the case for Sycamore because Sycamore’s proc-macro generates code that is only compatible with edition 2021. Furthermore, the disjoint capture in closures feature greatly improves the ergonomics when working with Sycamore’s reactivity.

Install Trunk

Trunk is the recommended build tool for Sycamore. If you are from JS land, Trunk is like webpack or rollup but specifically tailored towards Rust + WASM apps.

You can use one of the following command to install Trunk on your system:

# Install via homebrew on Mac, Linux or Windows (WSL).
brew install trunk

# Install a release binary (great for CI).
# You will need to specify a value for ${VERSION}.
wget -qO- https://github.com/thedodd/trunk/releases/download/${VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-

# Install via cargo.
cargo install --locked trunk

For more information, head over to the Trunk website

Create a new Sycamore project

Create a new Rust project using cargo:

cargo new my-project
cd my-project

You now need to add Sycamore to your new project’s dependencies. Add the following to your Cargo.toml file in your project folder:

sycamore = "0.8"

Note: Sycamore is currently being developed at a rapid pace. To have access to the latest features, consider using a git dependency instead.

However, breaking changes are introduced all the time. It is therefore recommended to also specify a specific commit hash to prevent your code from randomly breaking. You can find the latest commit hash here (to the right of each commit).

# Make sure you update the rev to the latest commit hash.
sycamore = { git = "https://github.com/sycamore-rs/sycamore", rev = "fc640d313e66f9a6af422fae44f4f72fa86280cc" }

You should now be all set for your Sycamore adventure!