leptos-rs / book

The home for the Leptos book, which can be found deployed at https://book.leptos.dev
MIT License
73 stars 60 forks source link

"Deployment" Chapter - add starter templates for deploying to Deno & Cloudflare #5

Open diversable opened 9 months ago

diversable commented 9 months ago

In the long term, starter templates should be added to cargo-leptos to make the 'getting started' experience as smooth as possible. In the meantime, there have been questions from users in Discord about how to deploy Leptos websites/apps to multiple platforms.

So, as a follow-up to https://github.com/leptos-rs/leptos/issues/2032: We should refactor the "Deployment" chapter to separate CSR app deployment from SSR app deployment.

In the CSR deployment chapter, add:

https://github.com/diversable/leptos-spin-CSR

In the SSR deployment chapter, add a template for AWS Lambda: see below

Deploying to WinterCG-enabled environments (Deno Deploy, Cloudflare,etc): see https://github.com/leptos-rs/leptos/releases/tag/v0.5.0

Also, look into creating templates for:

cf. 'gbj' comment on Discord: """ It would be great to also have Deno Deploy, Cloudflare, Spin starters. The easier we make it for people the better """

CorvusPrudens commented 9 months ago

Here's a template repo for deployment to AWS Lambda. It's based on the axum starter template, as it is overall very similar. It includes a GitHub action that handles the deployment automatically (as long as the user has provided sufficient AWS credentials as repository secrets).

If there are any ways it can be improved, please let me know! The build steps in particular may not be ideal. I've suggested a change to cargo-leptos that would remove the need for compiling the server binary twice using the build steps in this template, but it may very well be the case that this can be avoided properly in userland.