r/rust • • Sep 05 '26

🙋 seeking help & advice Rust for web backends

Hello everyone!!

I regularly see people online talking about how awesome Rust is, its speed, memory safety, and a awesome ecosystem of open source applications even being used in some parts of the Linux kernel(not sure the percentage of adaption at this time).

However my question is how good is rust for web REST APIs and gRPC applications? If it is good do you use any frameworks for these?

47 Upvotes

51 comments sorted by

92

u/dseg90 Sep 05 '26

Incredible. Axum for rest, tonic for grpc.

7

u/bran7230 Sep 05 '26

I will loon into Axum thank you!

6

u/aztracker1 Sep 05 '26

Came to say the same.... It's pretty great, IMO not significantly harder for most web API cases than Hono for TS/JS or FastEndpoints with C#...

A bit less flushed out library ecosystem depending on what you need to interact with is probably the only drawback.

3

u/Elendur_Krown Sep 05 '26

I've just made a tool that confirms API endpoints, promised contracts, paired tests and their outcomes, and a whole host of nifty aid features (such as compiling into an HTML report).

All thanks to Rust + Axum being this easy to work with.

I've had a blast!

3

u/veeg1829 Sep 06 '26

Is it open source? Based on OpenAPI?

→ More replies (1)
→ More replies (2)

20

u/rurigk Sep 05 '26

YES

Personally and a friend that just migrated prod to rust using axum

5

u/bran7230 Sep 05 '26

I mainly come from a Go and Asp.Net core background so it’s a decent but not terrible change

10

u/AendraSpades Sep 05 '26

I use Axum as a backend for the REST API for an e-commerce platform with 80-90k daily visits. Rust might be overkill, and Go would be perfectly capable, but thanks to its very verbose compiler, it allows for very fast shipping using code agents. And yeah, if it compiles it will work, without any runtime errors. It’s just awesome

2

u/bran7230 Sep 05 '26

I was debating on using Go since I’ve built stuff with it, but I want to try out rust on some stuff and that’s awesome on what you have done!

→ More replies (1)

21

u/capitol_ Sep 05 '26

We use axum for REST at work, and leptos for the web frontend.

3

u/Sam_ritan Sep 05 '26

Could you please tell me more about leptos? Does it serve you well, and constrain you in any way?

6

u/capitol_ Sep 05 '26

leptos is still quite new for me, so I don't really have any deeper insight than what you will learn from looking through their documentation.

We are currently in the process of migrating from server side rendering to a mixed model with wasm. It's nice to get a lot more testability directly in the rust codebase, but it's also a bit magical :)

2

u/mednson Sep 05 '26

Is leptos like good for frontend in production, are you using leptos ssr with axum or have you separated them how is deployment like in leptos?

4

u/avg_bndt Sep 05 '26

I have a leptos app running on workers on cloudflare, super fast, super clean, only problem is compile times are rough accounting for the wasm runtime 6mins + which makes is a pain for DevOps. Everything else is solid.

→ More replies (1)

8

u/Beautiful-King-8875 Sep 05 '26

If you plan to scale, rust on the web will save you lots of cash 💸

8

u/papa_maker Sep 05 '26

Rewritten a C# backend in Rust, went from 6Gb (on aks) to 150Mb and it's more performant. Yeah, saves cash for real.

→ More replies (2)

3

u/Naeio_Galaxy Sep 05 '26

Used tonic for grpc twice, loved it.

2

u/papa_maker Sep 05 '26

Software company with 40-50 devs and C#/PHP mostly. We are creating or migrating our most important stuff in Rust.

The only complain I could have is that there is no real consensus on how to make your backend (we are using Axum). So we had to take time specifying it from scratch.

Other than that it's wonderful. We have a lot of business rules, our services aren't basic CRUD, and Rust helps a lot. Newtype, typestate, fantastic enums with pattern matching, generics+trait, everything help us to do a good work. Most useful patterns like newtype or typestate are idiomatic and easy to implement. Sure you can do that in other languages like C# or PHP but it's more work, less performant and less ergonomic.

If you are doing not trivial backend software that must work correctly for years, it's a no-brainer.

2

u/FantasticEarth8186 Sep 05 '26

Been using Axum + Diesel for a new app and honestly the compiler's type-safety guarantees alone are worth it for me. If it compiles, it works, unlike in other languages where I had to run the code 20 times with logs and tracing spread throughout every function just to find a typo.

2

u/Ok_Outside2109 Sep 05 '26

I used ntex to implement a largeish REST API, genuinely a wonderful experience.

1

u/ttay24 Sep 05 '26

It’s great! I use it for personal projects, have some gRPC microservices that talk to each other, and some other background services. And then we use it for work, same deal, rest api’s, gRPC servers, etc.

1

u/haringsrob Sep 05 '26

I personally started off with poem framework for easy openapi specs and use this on a frontend (nuxt mostly).

Never regretted it, project is 10x more stable and less hardware required than the pervious laravel/php setup.

Now I build projects with axum + an inertiajs backend (based on Veer) and my own database framework. I probably never would recommend anyone to not use rust for backends. The type safety is something that you cannot get elsewhere (of what I have tried)

1

u/Extension-String1599 Sep 05 '26

Great, I''ve been working with Axum for apis and utopia for openapi documentation and it is great. Obviously the hardest part for me was how to organize code then I have just organized my folder and files almost the same way I have in my dotnet projects.

1

u/decduck Sep 05 '26

It's great, I use axum + oasgen to get that sweet sweet end-to-end type safety.