I understanding wanting to call out to Rust from JS/TS, but I don't think I understand wanting the reverse. Isn't a major goal of Rust not to have "custom behavior" that is invisible to the compiler?
Or a function host that executes jobs at scale? You only need to program the security, sandboxing, scheduling, and distribution of functions that can be invoked.
I haven't looked into the details of this so I'm not sure if its a suitable replacement for embedding lua (binary size would be my first concern..does this embed v8?) But I would much prefer TypeScript as a configuration language than Lua.
That is ... exactly what windmill is https://github.com/windmill-labs/windmill
The orchestrator is built from scratch in rust using postgresql to store the state. The steps when in typescript are run in deno: https://github.com/windmill-labs/windmill/blob/main/backend/... and the transforms between the steps (piping outputs of any node to the input of any node) are actually javascript expressions run by deno JsRuntimes: https://github.com/windmill-labs/windmill/blob/f3ec9ca09dc37...
OMG. That's ridiculous.
Write the code in C or Zig, and use Lua for scripting, and you're down to under 1MB for the final binary.
I know what SSR is and you can do it[1] in Rust, where you write type-safe, compiled Rust code and send HTML/CSS/WASM to the browser. SSR was originally developed in things like Perl and PHP -- there's nothing language-specific about it.
> Besides being less efficient than JS at manipulating the DOM
Some applications manipulate DOM a lot (and WASM isn't slow enough for a well-written app to be noticeably slower to a user) and some applications do a lot of processing before changing the client. WASM will be dramatically faster at the latter.
Yeah, but that way your frontend team is forced to develop in Rust, instead of develop in JS/TS. What I want to do is enable FE devs/team to do their job (writing JS/JSX) happily ignoring the server, and at the same time do SSR on the server happily ignoring how FE devs/team implemented the view.
You might notice, "ok but they need a contract to know which is the data shape that the server is going to provide to the JS/TS render() call"; yep, that's one of the challenges of what I'm trying to do :D