Which HTTP remote call architecture to select for a CLI app?

Hello!

This is an open-ended question to learn about your experience in writing an HTTP interface to a CLI app.

I have a CLI app at GitHub - iesahin/xvc: A robust (🐢) and fast (🐇) MLOps tool for managing data and pipelines in Rust (🦀) to manage binary data and ML pipelines on top of Git repositories. I want to write a server to operate on remote machines/VMs. The server will mainly receive an HTTP call and run the appropriate command, similar to Xvc's Python bindings.

There seems to be three different possible approaches and I'm not sure which is better: REST, GraphQL or gRPC. I used all of these in other languages but I don't know which Rust libraries are more mature and easier to develop.

My main use case is getting a set of commands and converting to XvcCLI struct that's used by clap. There may be some exceptions in the commands for security but the use case is converting to structs and calling the appropriate methods.

What do you recommend as an approach here? I want to write as minimum boilerplate as possible and don't want to duplicate these CLI structs elsewhere.

Thanks a lot for your answers.

I have not used GraphQL, but REST and gRPC have great support in the ecosystem. For writing REST clients you can use reqwest, and for writing gRPC clients you can use tonic.

I don't think there is an objective way to determine which protocol is "better". If you want to use tonic, then you might need to go deeper into async rust, which can be somewhat gnarly when you have streaming requests/responses.

If you want to reduce boilerplate, I don't think there should be any difference. Regardless of chosen protocol you can create an interface, and have some matching function, which takes your CLI arguments, and then invokes proper method.