Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leptos-rs/start-spin
A starter template for Leptos and Spin
https://github.com/leptos-rs/start-spin
leptos rust spin template
Last synced: 19 days ago
JSON representation
A starter template for Leptos and Spin
- Host: GitHub
- URL: https://github.com/leptos-rs/start-spin
- Owner: leptos-rs
- Created: 2024-01-18T20:55:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-20T05:12:45.000Z (11 months ago)
- Last Synced: 2024-04-18T02:57:13.611Z (9 months ago)
- Topics: leptos, rust, spin, template
- Language: Rust
- Homepage: https://spin-leptos-ssr-49mccqzz.fermyon.app
- Size: 68.4 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-leptos - leptos-rs/start-spin - Starter (Starter Templates / Official)
README
# Leptos Spin SSR Starter Template
This is a template for use with the [Leptos][leptos] web framework and the [Spin][spin-install] WASI platform.
[Click here to see the deployed version of this starter](https://spin-leptos-ssr-49mccqzz.fermyon.app).
## 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
```bash
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
```sh
sudo mv spin /usr/local/bin/
```For the full [Spin CLI install instructions see here][spin-install].
To generate your own repo from this starter template, run
```sh
cargo generate --git https://github.com/leptos-rs/start-spin
```Then
```sh
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
```sh
spin watch
```will build and run your server as well as recompile your code after making changes.
Using
`.
```sh
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## Release and Deployment
To deploy your app to [Fermyon Cloud signup here first][spin-signup]. For more information on [Ferymon Cloud see here][spin-cloud-info].
After you have your Fermyon cloud account and have logged in using `spin login`, running
```sh
spin build
```
will build your application for release. Running```sh
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][docker-spin].
If you would like to deploy your Leptos-Spin app via Kubernetes, see [the setup instructions for Spin on Kubernetes here][k8s-spin].
[leptos]: https://github.com/leptos-rs/leptos
[spin-install]: https://developer.fermyon.com/spin/v2/install
[spin-signup]: https://cloud.fermyon.com/
[spin-cloud-info]: https://www.fermyon.com/cloud
[docker-spin]: https://www.fermyon.com/blog/spin-in-docker
[k8s-spin]: https://developer.fermyon.com/spin/v2/kubernetes