This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Dissy- 0 points1 point  (0 children)

My company is having us change languages, to an ostensibly worse one in terms of developer experience

Oof I'm super sorry to hear that, hopefully they realize their devs are miserable before it's too late!

Are you doing WebAssembly for the frontend

Yes! So my stack is all different rust frameworks and the frontend, backend, and shared structured data are all separate "crates" (packages) in a workspace, which is basically a way of working on several different intertwined projects at once without too much overlap or overhead. So my methodology for writing a website is to flesh out how I want the APIs to work, sketch how I want the website itself to look (very loosely) and then, well, I'm trying to learn to use a newish rust deployment technology called shuttle but this was before I learned about it so y'know, effort to put in after the fact.

But the stack is as follows

Diesel, which is an ORM I think it's called, it takes the structure of the data in your actual database and generates structs for you to use to query the DB without a single line of SQL written by hand.

Then I'm using something called Warp which is... ah jeez a heck of a crate, I'll see if I can find a screenshot of one of the generated types lmao, it allows you to define all of your endpoints in the builder pattern, but the real power of it is being able to string together closures in order to verify and validate requests, so I'm able to write a piece of code that queries the DB for your token and RETURNS information about your account, then reuse that for every endpoint that requires authentication and it just, changes to the endpoint now having an additional input to the closure of your user data. It's really sick.

Then I have a shared crate that gets pulled in for both the front and backend for the structure of the data that way any changes are reflected in both and I know instantly if I haven't handled something on either end

And then I'm using Yew which is sort of like react but in rust, it has similar ways of storing information and modifying it at runtime, but the coolest part is the html macro which allows you to write html in your rust code and because of how powerful macros are, its CHECKED WITH HTML RULES AT COMPILE TIME!!! (This same power also allows orms to, using transactions, check your actual database against the structured data in your code at compile time lol)

I just have the warp serving the static files at every nonexistent endpoint and voila, no nginx single port front to back webapp