Base project template for building SPA UIs with Svelte powered by Rust/WASM for business logic
Svelte project bootstrapped with create-svelte
.
Tailwind CSS style utility classes generated and imported automatically on vite builds.
Rust is a strongly typed general perfect programing language. Install here
This project uses 'wasm-pack' to bundle Rust code for web deployment. Wasm-pack must be installed for RSW (see below) to work.
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
This project uses 'RSW' to watch and build your rust project via wasm-pack. The 'vite-plugin-rsw' actually watches your crate and implements hot reload along side your Svelte and Typescript code.
[[crates]]
name = "my-wasm-crate"
link = true
## The above is also what needs to be edited if you want to rename the
## placeholder my-wasm-crate in this template
export async function load() { await init() greet() } // The above code shows that your npm package name matches both the crate // name and directory name as specified in the rsw.toml. If you rename the // placeholder my-wasm-crate your npm package name is updated to match.
- Additional crates can be added and configured automatically via rsw
```shell
yarn rsw new <new-crate-name>
[[crates]]
name = "<new-crate-name>"
# <npm|yarn|pnpm> link
# ⚠️ Note: must be set to `true`, default is `false`
link = true
const config: UserConfig = {
plugins: [sveltekit(), ViteRsw()],
server: {
fs: {
allow: ["./
export default config;
- Once registered in rsw.toml and allowed in vite.config.ts your crate can be imported as an npm module
```ts
import init, { foo, bar} from "<my-wasm-crate>"
await init() // Wasm has to be loaded before exported functionality is called
foo()
bar()
yarn dev
yarn build