leptos-rs / start-spin

A starter template for Leptos and Spin

Home Page:https://spin-leptos-ssr-49mccqzz.fermyon.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leptos Logo

Leptos Spin SSR Starter Template

This is a template for use with the Leptos web framework and the Spin WASI platform.

Click here to see the deployed version of this starter.

Creating Your Repo

First, ensure that you have Rust 'nightly' with both the wasm and wasm32-wasi targets, along with cargo-generate

  • rustup toolchain install nightly --allow-downgrade
  • rustup target add wasm32-unknown-unknown
  • rustup target add wasm32-wasi
  • cargo install cargo-generate

If you don't have spin installed you can install it with

curl -fsSL https://developer.fermyon.com/downloads/install.sh | bash

Once you have the Spin CLI tool downloaded, we recommend putting the binary into a folder already on your path, eg

sudo mv spin /usr/local/bin/

For the full Spin CLI install instructions see here.


To generate your own repo from this starter template, run

cargo generate --git https://github.com/leptos-rs/start-spin

Then

cd {{project-name}}

to go to your newly created project.


Feel free to explore the project structure, but the best place to start with your application code is in src/pages/home.rs.

Additionally, Cargo.toml may need updating as new versions of the dependencies are released, especially if things are not working after a cargo update.

Running & Developing Your Project

Running

spin watch

will build and run your server as well as recompile your code after making changes.

Using

spin up

will build and serve your app on 127.0.0.1:3000 by default. To serve at a different address, use spin up --listen <ADDRESS>.

Release and Deployment

To deploy your app to Fermyon Cloud signup here first. For more information on Ferymon Cloud see here.

After you have your Fermyon cloud account and have logged in using spin login, running

spin build

will build your application for release. Running

spin deploy

will publish your app to Fermyon cloud.

If you would prefer to deploy your app on own machine or in a VM with Docker rather than on Fermyon Cloud, see the Spin in Docker setup instructions here.


If you would like to deploy your Leptos-Spin app via Kubernetes, see the setup instructions for Spin on Kubernetes here.

About

A starter template for Leptos and Spin

https://spin-leptos-ssr-49mccqzz.fermyon.app


Languages

Language:Rust 70.8%Language:Nix 19.8%Language:CSS 9.4%