Using Rust Back End to Serve an SPA
nguyenhuythanh.com
Using Rust Back End to Serve an SPA
1–10 of 14 posts
Re: Using Rust Back End to Serve an SPA
#2Re: Using Rust Back End to Serve an SPA
#3Re: Using Rust Back End to Serve an SPA
#4Just serving static files from Rust is not that interesting. It definitely does not sound easier to me, since you are coupling deployment of both BE and FE with no resource optimization to get. Also, since built SPAs are essentially static files, their deployment could be just uploading these files to your CDN.
Re: Using Rust Back End to Serve an SPA
#5Re: Using Rust Back End to Serve an SPA
#6[flagged]
Re: Using Rust Back End to Serve an SPA
#7Your usecase can be useful for "local web applications" where you ship a binary and you get a local webui - but at that point, why not just build a Tauri app? (not electron as you would be shipping an extra browser instead of reusing the system one)
Re: Using Rust Back End to Serve an SPA
#8Are there any approaches which implement server-side rendered SPAs with Rust? In that case Rust would render the HTML for the first load and server JSON APIs for changes in the SPA. Rendering the HTML is performance-intensive in my experience, using Rust could save up quite some computational resources. Just serving static files from Rust is not that interesting. It definitely does not sound easier to me, since you a…
Yes, frameworks like Dioxus (https://github.com/dioxuslabs/dioxus) implement next.js-like "fullstack" SPAs in Rust (the client-side code compiles to WASM).
> Rendering the HTML is performance-intensive in my experience, using Rust could save up quite some computational resources.
The server-side performance is indeed much better than JS alternatives (client-side performance is more or less the same).
Re: Using Rust Back End to Serve an SPA
#9Are there any approaches which implement server-side rendered SPAs with Rust? In that case Rust would render the HTML for the first load and server JSON APIs for changes in the SPA. Rendering the HTML is performance-intensive in my experience, using Rust could save up quite some computational resources. Just serving static files from Rust is not that interesting. It definitely does not sound easier to me, since you a…
Re: Using Rust Back End to Serve an SPA
#10Are there any approaches which implement server-side rendered SPAs with Rust? In that case Rust would render the HTML for the first load and server JSON APIs for changes in the SPA. Rendering the HTML is performance-intensive in my experience, using Rust could save up quite some computational resources. Just serving static files from Rust is not that interesting. It definitely does not sound easier to me, since you a…
I think there is Dioxus and Leptos if you want full-Rust solutions for SPAs. You're right that CDN is another thing that I forgot considering, too. Can you elaborate more on "coupling deployment of both BE and FE with no resource optimization"
The link to Leptos is https://github.com/leptos-rs/leptos for those who need it.