Help about Things to consider while building apis for Mobile App

After hitting hard with NodeJs with 100s of runtime errors, i decided to make a try with Rust for building Apis for mobile app.

Can anyone please suggest packages that i need and things to consider? I am totally new to Rust. At start finding it little bit hard but things are going on.

All suggestions and advices are welcome.

1 Like

What kind of API do you want to build for your moblie app? Popular choices are RESTful, RPC (like gRPC, Json-RPC or Cap'n Proto) or GraphQL. Plus protocols like websockets or XMPP for bidirectional message transfer. If we know what kind of API you want to build, recommending packages will be a lot easier.

This is simple REST api, which will return json data from mariadb.

Maybe later sockets will implement.

Thank you for your reply :slight_smile:

Good API choice. In this case I'd recommend a simple axum web server, plus the db driver of your choice. I like sqlx (+ sea-orm if you want an ORM), but diesel (+ diesel-async) is also popular.

Thank you so much for the advice. I was thinking to use tokio but you gave a me good option :raising_hands:

Thank you so much.

tokio is an asynchronous runtime. It is used by most major web server implementations in Rust, including axum. Writing your own web server from scratch using only tokio's IO primitives could be a good learning project for understanding how one can implement a HTTP server, but certainly using a ready-made framework like axum will give you lots and lots of functionality out of the box and provide you with simple-to-use abstractions, allowing you to focus on implementing your API, not on reinventing the wheel.

Thank you so much. Vital information :blush: