frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Using Rust Back End to Serve an SPA

https://nguyenhuythanh.com/posts/rust-backend-spa/
12•thanhnguyen2187•1d ago

Comments

vilunov•1d ago
Are 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 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.

nicoburns•1d ago
> Are 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

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).

thanhnguyen2187•1d ago
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"
OutOfHere•1d ago
How would you compare the two (Dioxus and Leptos)?

The link to Leptos is https://github.com/leptos-rs/leptos for those who need it.

thanhnguyen2187•1d ago
There are some comparisons at their repository

> Dioxus vs Leptos

> Leptos is a library for building fullstack web-apps, similar to SolidJS and SolidStart. The two libraries share similar goals on the web, but have several key differences:

> Reactivity model: Leptos uses signals to drive both reactivity and rendering, while Dioxus uses signals just for reactivity. For managing re-renders, Dioxus uses a highly optimized VirtualDOM to support desktop and mobile architectures. Both Dioxus and Leptos are extremely fast.

> Different scopes: Dioxus provides renderers for web, desktop, mobile, LiveView, and more. We also maintain community libraries and a cross-platform SDK. Leptos has a tighter focus on the fullstack web with features that Dioxus doesn't have like islands, <Form /> components, and other web-specific utilities.

> Different DSLs: Dioxus uses its own custom Rust-like DSL for building UIs while Leptos uses an HTML-like syntax. We chose this to retain compatibility with IDE features like code-folding and syntax highlighting. Generally, Dioxus leans into more "magic" with its DSL including automatic formatting of strings and hot-reloading of simple Rust expressions.

For Go, sadly I don't know any framework in the scope of Rust land's Dioxus/Leptos. You continue to have two choices:

- Either to go down the SSR route (and add HTMX for a more SPA-like experience, and use Templ for HTML templating)

- Or to use Go in the backend and something else for the frontend (NextJS or SvelteKit or React Router, you name it; I went with SvelteKit as it fits my needs well, and seems to be "the most popular niche" frontend framework)

Hope it helps

jokethrowaway•1d ago
Dropping the static files on a CDN (eg. cloudflare pages) is pretty straightforward, cheap (and free), and doesn't impact your backend in terms of complexity or performance.

Your 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)

thanhnguyen2187•1d ago
Thanks for the suggestion! I did not consider Tauri as it seems to be one machine only, while I'm developing my project to be a web app for multiple local machines.
sshine•1d ago
Tauri will render a window with a web app inside on one machine. But that web app can communicate with a local backend that is either hosted by the same program, or some other program, locally or remotely.

Free Completeness Checks for Query Params with Java Enum Switch Expressions

https://nocodefunctions.com/blog/enum-completeness-check-api-client/
1•seinecle•2m ago•0 comments

Tesla's robotaxi rollout is alarming the public, new report shows

https://www.thestreet.com/technology/teslas-robotaxi-rollout-is-alarming-the-public-new-report-shows
1•breadwinner•11m ago•1 comments

Judge rejects claim AI chatbots protected by First Amendment

https://www.legalnewsline.com/florida-record/judge-rejects-claim-ai-chatbots-protected-by-first-amendment/article_3e867593-e791-4f0c-92e1-dd0e0741cb51.html
1•speckx•12m ago•0 comments

Does Money Buy Happiness?

https://knowledge.wharton.upenn.edu/article/does-money-buy-happiness-heres-what-the-research-says/
1•simonebrunozzi•18m ago•0 comments

Show HN: I made a bot that trades volatility on earnings

https://github.com/ProgramComputer/earnings-trade-automation
1•paulmon•19m ago•0 comments

For Some Recent Graduates, the A.I. Job Apocalypse May Already Be Here

https://www.nytimes.com/2025/05/30/technology/ai-jobs-college-graduates.html
2•demirbey05•20m ago•1 comments

Created my first SaaS. Already messed up

https://chatcloser.ai
1•unkinhead•26m ago•1 comments

Legacy Update

https://legacyupdate.net/
1•LeoPanthera•29m ago•0 comments

CCD Co-Inventor George E. Smith Dies at 95

https://www.universitycube.net/news/ccd-co-inventor-george-e-smith-passes-away-95-05-31-2025--74189653-c0e2-489c-86c7-71d852a5200b
2•NaOH•29m ago•1 comments

We still can't stop plagiarism in undergraduate computer science (2018)

https://kevinchen.co/blog/cant-stop-plagiarism-in-computer-science/
1•wonger_•33m ago•0 comments

Catching the Silent Threat: How Dynamic Analysis Revealed an NPM Attack Chain

https://safedep.io/digging-into-dynamic-malware-analysis-signals/
1•abhisek•35m ago•0 comments

Peeking Behind the Code–IRS Just Open-Sourced Direct File

https://www.forbes.com/sites/andrewleahey/2025/05/30/peeking-behind-the-code-irs-just-open-sourced-direct-file/
2•tldrthelaw•37m ago•0 comments

My front row seat on 'Inside the NBA'

https://www.nytimes.com/athletic/5531128/2024/07/19/inside-the-nba-tv-show-tnt-praises/
1•herbertl•39m ago•0 comments

Gene-edited pig kidneys moving long-stymied field of xenotransplantation forward

https://www.science.org/content/article/can-gene-edited-pigs-solve-organ-transplant-shortage
3•bookofjoe•39m ago•1 comments

Google Photos API changes from March 2025 (2024)

https://github.com/gilesknap/gphotos-sync/issues/511
2•jandeboevrie•43m ago•0 comments

Google as you know it is slowly dying

https://www.vox.com/technology/414673/google-search-ai-mode-chatgpt-gemini
3•rntn•44m ago•0 comments

PURL Administration

https://purl.archive.org/
1•xanthine•45m ago•1 comments

Show HN: Judgement – Multiplayer online card game with hidden easter eggs

https://playjudgement.vercel.app/
1•sukhmeetsingh•47m ago•0 comments

Confidence Unlocked: A Method to Measure Certainty in LLM Outputs

https://medium.com/@vatvenger/confidence-unlocked-a-method-to-measure-certainty-in-llm-outputs-1d921a4ca43c
1•efavdb•49m ago•0 comments

More than half of top mental health TikToks contain misinformation

https://www.theguardian.com/society/2025/may/31/more-than-half-of-top-100-mental-health-tiktoks-contain-misinformation-study-finds
3•mmarian•54m ago•0 comments

SyntheMol-RL: reinforcement learning framework for designing novel antibiotics

https://www.biorxiv.org/content/10.1101/2025.05.17.654017v1
1•turkeytotal•55m ago•1 comments

Twin modelling reveals partly distinct genetic pathways to music enjoyment

https://www.nature.com/articles/s41467-025-58123-8
1•marojejian•56m ago•1 comments

China Plans Major Nuclear Expansion with 10 New Reactors

https://oilprice.com/Alternative-Energy/Nuclear-Power/China-Plans-Major-Nuclear-Expansion-with-10-New-Reactors.html
1•PaulHoule•56m ago•0 comments

Unexpected Gotchas in Making a Game Deterministic

https://www.jfgeyelin.com/2025/05/unexpected-gotchas-in-making-game.html
3•Jyaif•59m ago•0 comments

QuantumAccel: A High Performance Quantum-Inspired Logic Library in Rust+Python

https://github.com/fikayoAy/quantum_accel
1•AyodeleFikayomi•59m ago•1 comments

Why don't nearly half of Americans have any investments?

https://www.investmentnews.com/ria-news/why-dont-nearly-half-of-americans-have-any-investments/257620
3•nlolks•1h ago•2 comments

Ask HN: Would you use a platform that deploys Docker Compose apps?

5•jsbroks•1h ago•4 comments

Copy from a Simpler Language

https://tidyfirst.substack.com/p/copy-from-a-simpler-language
1•vinipolicena•1h ago•0 comments

Golden Algebra: A unifying mathematical framework

https://github.com/TristenHarr/goldenalgebra
1•tristenharr•1h ago•1 comments

Me at the Zoo

https://en.wikipedia.org/wiki/Me_at_the_zoo
1•simonebrunozzi•1h ago•0 comments