What are you gaining by writing something like that in java/type-script rather than like rust and webassembly?
To me javascript is in a sort of uncanny valley where you probably want to be either making a real app and compiling it to wasm or using something like htmx.