Re:Show HN: htmgo - build simple and scalable systems with g...
by klabb3 on Sunday September 29, 2024 @05:43AM
(#41686148)
> I love web dev using rust! I use sveltekit and proxy all requests to /api to a rust backend
I think this most people would call this backend-, api- or service development. Especially if your api endpoint does not do anything web specific except http.
Anyway, how do you share types between the backend and frontend? Are you rawdogging json?
Re:Show HN: htmgo - build simple and scalable systems with g...
by j45 on Sunday September 29, 2024 @09:27AM
(#41687241)
Rust could probably generate the HTML.
Re:Show HN: htmgo - build simple and scalable systems with g...
by Prosammer on Monday September 30, 2024 @11:36AM
(#41698394)
I've been playing with loco.rs to do this! Really cool, let's you use htmx or sveltekit (or whatever you want)
Re:Show HN: htmgo - build simple and scalable systems with g...
by sureglymop on Monday September 30, 2024 @12:09PM
(#41698796)
Sounds interesting! Do you have an example project? It seems to be quite opinionated.
Re:Show HN: htmgo - build simple and scalable systems with g...
by Prosammer on Monday September 30, 2024 @12:32PM
(#41699091)
Yeah quite opinionated! I don't have an example project at the moment, but here's a youtube video from loco.rs that someone might find interesting: https://loco.rs/casts/007-htmx/
Re:Show HN: htmgo - build simple and scalable systems with g...
by sureglymop on Monday September 30, 2024 @12:07PM
(#41698772)
Yeah, that makes sense. I've only had fullstack web dev jobs using node, thus the phrasing but you're totally right.
I use the ts-rs crate, which adds a derive(TS) macro for types in rust and generates typescript types. It works so far but my side projects are only medium sized. But I'm sure there are other options too.
1. A development experience with instant visual feedback for the frontend. Even more so when using tailwind.
2. A stable, safe and performant backend.
The downside is that a node process has to be running and doing the ssr, though that is an okay trade off for me because my project is mainly the api, having a reference implementation of the frontend is just a nice extra.
I've also experimented with implementing the reverse proxy in rust itself and using a unix socket and other IPC mechanisms to push the data to the SSR layer.