Single page web app with DB interoperation

In short: I want to create a web app and check out the possible options.

The language should be compilable because I want to protect the source code. As a result, only Go, Haskell, and Rust come into question here. Go is not my taste, whereas Haskell is very fiddly (and I don't feel like all that monad stuff), especially when it comes to the front end. That's why I'm considering Rust, especially since Rust supports WASM and has a very good framework for web apps with Yew (judged at first glance). Are there any alternatives to Yew that are also worth considering?

I also need 100% interoperability with a Postgres database (a good native connector). What is recommended here and the general standard?

Since I've only created plain websites so far (html+css+php with a bit of JS in the frontend), I honestly have zero experience here. But as far as I read, the DB stuff has to take place in the backend/on the server, since no queries are possible from WASM?

Basically, the goal is that the Wepapp ends up being just a binary file that I put on the (linux) server without any additional installations (apart from the Postgres DB and a configuration file with DB credentials); and is accessible through a subdomain app.example.com (first login area, then redirection to the actual app with the functionalities/content available to the respective employee).

It would be awesome if I could actually do all of this in Rust, front and back end in the same language / from a single source.

I've collected some alternatives in this post:

That being said, I like all the cool stuff the Rust community is coming up with when it comes to (web-)frontends. There are a few cool projects like yew, leptos , sycamore, dioxus or tauri which I'd like to work more with.

Especially leptos is often mentioned as an alternative (the SSR capabilities look pretty cool, maybe you'd be able to write both your client and server using only leptos).


Both diesel and sqlx support postgres.


Yes, if you run your app as WASM in the browser you can't do anything you can't do in JS in the browser as well.

1 Like

I’m not sure if I understand the logic here. machine code can be disassembled and decompiled, and interpreted code like JS can be obfuscated to the point of being incomprehensible. You shouldn’t expect compilation to have any security effect on your code.

... that is completely clear to me. However, obfuscating is not the same as compiling into a binary. Besides, that's just one aspect. Another is that you simply end up with a binary file that is easy to deploy (and yes, before you object again, I know there is also pkg in JS; however, I read that there are problems with that and it is ultimately not the standard. That's why I want a language where this is simply the default case / natively).

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.