Skip to content

About

Template for server-side Leptos apps on Spin

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

76 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Leptos Spin templates

wasip3_demo.mp4

This repository contains custom Spin templates for bootstrapping Leptos applications running on WASI. It provides two options for WASI runtimes, plus cloud provider templates:

  1. leptos-wasmtime: derived from the counter example in the leptos_wasi repository. A pure WASIp3 Guest component that can be served via standard HTTP triggers using either Wasmtime or Spin.

  2. leptos-spin: derived from the spin-counter example in the leptos_wasi repository. A WASIp3 component built with the Fermyon spin-sdk using key-value triggers.

  3. leptos-cloudflare: derived from the cf-counter example in the leptos_wasi repository. Streaming SSR inside a Cloudflare Worker with server functions backed by a Durable Object - no Spin, no WASI component: the same Leptos application source compiles to wasm32-unknown-unknown for workerd.

  4. leptos-aws: derived from the aws-counter example in the leptos_wasi repository. SSR inside AWS Lambda as a native Rust binary - no wasm at all: server functions persist the counter in DynamoDB with atomic increments, and static assets are embedded in the deployment zip.

  5. leptos-gcp: derived from the gcp-counter example in the leptos_wasi repository. SSR on Google Cloud Run - or any container platform - as a single self-contained binary: server functions persist the counter in Firestore transactions, progressive SSR streaming reaches the client, and the Dockerfile is the whole deploy artifact.

  6. leptos-azure: derived from the azure-counter example in the leptos_wasi repository. SSR on Azure Container Apps as one self-contained binary: server functions persist the counter in Azure Table Storage with ETag optimistic concurrency, and the example carries its own SharedKey-signed REST client since no maintained first-party Tables crate exists.

  7. leptos-netlify: derived from the netlify-counter example in the leptos_wasi repository. The entire application - SSR, server functions, backend - compiled to one wasm module running in the Netlify Edge isolate, with progressive SSR streaming through standard Fetch API types. Counter in Upstash Redis with server-atomic increments.

  8. leptos-vercel: derived from the vercel-counter example in the leptos_wasi repository. The same one-wasm-module shape as leptos-netlify on Vercel Edge - validated inside the edge-runtime npm package, the same isolate implementation Vercel ships.

Installation

To install these templates from the Git repository:

spin templates install --git https://github.com/akamai-developers/leptos-spin --upgrade

Creating a New Project

To create a new project using one of the templates, run:

Option 1: Using the Standard WASIp3 Template (Wasmtime/Spin)

spin new <project-name> -t leptos-wasmtime

Option 2: Using the Spin SDK (WASIp3) Template

spin new <project-name> -t leptos-spin

Option 3: Using the Cloudflare Workers Template

spin new <project-name> -t leptos-cloudflare

spin new is only the scaffolder here - the generated project deploys with wrangler deploy and never touches Spin. See the template's README for prerequisites (cargo-leptos, worker-build, wrangler 4.x).

Option 4: Using the AWS Lambda Template

spin new <project-name> -t leptos-aws

Same scaffolding-only relationship: the generated project builds with cargo lambda build and deploys with cargo lambda deploy. See the template's README for prerequisites (cargo-lambda, cargo-leptos) and the DynamoDB table setup.

About

Template for server-side Leptos apps on Spin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages