Skip to main content

Execution and Testing Playbook

🛠️ Execution & Testing Playbook

We have provided a unified Makefile inside examples/counter-app to compile, package, reset, and launch our Leptos WASM application using simple target flags. This shields you from compiling custom target configurations manually. Run these commands from examples/counter-app:
The Makefile is the canonical setup path. It derives runtime env vars from the public backend variables and selects the correct Cargo features, Spin manifest, and Wasmtime host permissions. If you wire the runtime manually, preserve these boundaries: DATABASE_URL and DATABASE_AUTH_TOKEN are internal runtime env values. Set the public backend-specific variables in .env; pass the internal values yourself only when bypassing the Makefile. Spin manifests must allow outbound hosts for every backend family you plan to demonstrate:
Use spin.redis.toml when realtime=redis; it adds the Redis trigger sidecar and exposes redis_url / redis_channel Spin variables. Wasmtime does not use that sidecar; it needs Preview 3, HTTP, TCP, inherited networking, DNS lookup, ./target/site/pkg mounted at /, and ./data mounted at /data.

1. Build and Run under Wasmtime (Bare Component Runtime)

Running under Wasmtime is incredibly useful for standard system deployment, local orchestration, and target compatibility checks.

2. Build and Run under Fermyon Spin (Microservices Runtime)

Running under Fermyon Spin leverages Spin-specific host integrations for SQLite, Postgres, MySQL, and Redis.
realtime=redis is a Redis wake transport, not a request to use Redis as the event store. It is supported with every supported db backend, including db=mysql. Use db=redis only when Redis should also be the durable event, checkpoint, and read-model store. Spin gRPC support is controlled by transport=<mode>:
To prove Redis realtime from a terminal command to the browser, start Redis and the app, then open http://localhost:3000/:
Read the current view:
Trigger a REST command and watch the browser count update without refresh:
Trigger the same proof through gRPC:
To see the raw SSE frame, keep this running in a second terminal before running either command:
Expected SSE frames include:

3. Reset a Backend without Serving

The fresh target resets the selected backend schema, tables, or files and then exits. It does not build or start the application.
Once launched, open your web browser to http://127.0.0.1:3000 to interact with your secure, full-stack, optimistic-updating, Event-Sourced Leptos application!