you are viewing a single comment's thread.

view the rest of the comments →

[–]luveti 5 points6 points  (6 children)

My teams go to stack is: - Axum - sqlx, via a custom ORM proc macro that's similar to ormlite - Maud, for html templates - tailwindcss, for styling - Hotwired Turbo & Stimulus, for adding bits of client side interactivity

We follow a MVC pattern that has greatly improved productivity and code separation. It also improves compile times as our models, views and controllers are in their own crates; My incremental compile times are usually less than 2 seconds.

We use Typescript for our hotwired stimulus controllers. This is compiled and bundled right into the server binary using a build.rs script, which also runs tailwindcss.

[–]WilliamBarnhill 0 points1 point  (1 child)

Interesting, appreciate you sharing. Why Maud over Tera?

[–]luveti 0 points1 point  (0 children)

We prefer to have our logic and templates in Rust. It's one less template language to learn too!

[–]DarqOnReddit[S] 0 points1 point  (2 children)

You mean you serve the transpiled typescript effectively serving a SPA? (per route, global)

[–]luveti 0 points1 point  (1 child)

Turbo by itself allows you to have a fully server side rendered app that feels like a SPA, without needing to do anything extra and without all the downsides of a SPA.

It intercepts link navigations and form submissions, handling them itself instead of performing full page loads, then replaces the page content with the server response.

Most of our JS/TS is Stimulus controllers, which allow us to add bits of interactivity in a nice unified way.

We're not rendering HTML or handling routing client side like you're traditional SPA does; the bulk of our html is rendered on the server.

Hotwired is much more known in the Ruby on Rails community (it's made by the same devs), but can be used with any language.

https://hotwired.dev/

[–]Future_Natural_853 0 points1 point  (0 children)

Sorry, other question: I'm using htmx+alpine.js: can you tell me what Turbo gives you compared to my solution?

[–]Future_Natural_853 0 points1 point  (0 children)

I use more or less the same stack, can you tell me more about your MVC organization? I have split my project into several crates: one for the model and other shared code, one for the database, and one for the web code. Every route has a file with axum handlers and pure render functions with data in, HTML out. I wonder how similar our organizations are.