Hacker News new | ask | show | jobs
by wrapperup 1052 days ago
If you want a job, it's probably going to be React. But for personal projects, I hear Svelte would be up your alley. SolidJS is another nice option if you want to get into JSX templating, and more into something like React hooks that actually makes sense and performs close to vanilla JS.

But recently (and maybe you're already familiar), a library called htmx started gaining popularity, which you might like. It doesn't require a build step, npm or node to use it. I'm using it with a Rust-based monolithic website to great success, but you can use it with any backend in any language you like.

2 comments

I've toyed with svelte a bit, but honestly it's just a foreign world. Like...how do I make this talk to a database?
Yeah with these frameworks, you usually need to pair it with a backend that talks to your database. Most of the code you write in these frameworks run on the client (but they employ some server rendering techniques for performance reasons, but generally you treat it like client code)

Astro is another one that is server-first, similar to PHP, so maybe you'll like that. It also has integrations with the popular frontend frameworks.

And if you don't like any of that, htmx is great!

>how do I make this talk to a database?

With an API, depending on the db too some have ready connectors.

>I'm using it with a Rust

How’s htmx+rust combo so far? Any issues? Pros/cons?

Mostly great, there is a lack of native Rust frontend tooling outside of Leptos/Dioxus for templated websites, such as static file handling and bundling. Previously, I used vite for this on a templated nodejs website.

But I am working on a simple web bundler crate similar to vite to alleviate that (check out the htmx discord!). It's missing the HMR part for assets that can be hot reloaded (it just refreshes your browser), but this will improve things quite a bit for anyone making templated SSR Rust sites.

Otherwise, the backend ecosystem is really fantastic in Rust, not much to complain about. Axum is great, and I'm using cornucopia for SQL. Having the type safety is a killer feature.

seems good for low-interactivity sites, especially if everyone is generally looking at the same content. i'd consider it for my company's front-of-site, sales sites, blogs, that sort of thing. i certainly wouldn't write discord, vscode, or even a simple no-code tool with it.
I think something like Twitter and Discord could be written in it, but something like Google Maps or VSCode, definitely not. For anything where you need server data rendered, it's perfect.

I'm currently writing a website that contains user generated content for a game, kinda like Steam Workshop.