One of the important but tedious things in SPA development is to make sure that the API calls the frontend makes are actually implemented in the backend and that frontend and backend agree on the types of the functions offered by the API.
Running Rust both on server and client implies that we can trivially share the types that represent values exchanged between frontend and backend (e.g. by putting the types in a shared crate). This is nice and doesn’t involve any extra work.
Now, I want to go a step further than this: I want the compiler to statically check that the frontend only accesses URLs on the backend that are actually implemented by the backend, and also that frontend and backend agree on the types of values being passed between them. It is clearly possible to come up with a common API specification language and, from that, generate some code for frontend and backend (see, e.g. haskell-servant), so that the type checker will enforce this.
Question: does anyone here know of anything like this in the Rust ecosystem? Has anyone here done this in some way or another?