On of the challenges of writing RPC endpoints is how to orchestrate all of the downstream API calls your endpoint makes. Ideally, you would make network calls in parallel, avoid fetching which is not needed, and have robust error handling for each of the network calls. It can be hard to do all of these things while still keeping your code organized.
I wrote a blog post outlining a pattern that I've been using to make this easier using a combination of functional programming and structured concurrency. It contains lots of code examples. Please take a look and let me know what you think.