Are we web yet?
You can build stuff!
Rust has a mature HTTP stack and various frameworks enable you to build APIs and backend services quickly. While increasingly more databases drivers become available, ORMs and connections to external services (like search or worker queues) are still scarce. Looking farther, it doesn't necessarily get better. Though there is significant support for base needs (like data compression or logging ), a lot more web-specific needs are still unmet and immature.
Can I replace my Rails/Django/Flask already?
Well, probably not yet. While the basics are there, many of the handy utility libs that make working with many popular frameworks so quick and easy are still missing. If your service primarily provides an API to be consumed by other computers, requires little external services and you are happy with writing most SQL yourself, then Yes, You Can! Otherwise, we would not recommend it just yet.
What should I replace it with?
The frameworks of choice of the community are iron, conduit and nickel, best run with a postgres or mysql backend accompanied by redis – all these drivers seem to be fairly mature. If you want to wrap that into an ORM rustorm and diesel are at your disposal – both are still fairly young though. Rocket is a newer framework focused on ease-of-use, expressability and speed .
If you need to (or want to) go lower in the stack, those frameworks all use the fairly stable and mature hyper http stack, if you want it slimmer tiny_http might be an option and for the async-fans rotor has you covered. If you need HTTP2, you have to turn to solicit as none of the other stacks supports it just yet.
After you’ve set up your rust and worked yourself through “The Book”, we highly recommend taking a look at fully annotated source code of the clippy-service, an iron-based microservice, which shows how to use many common features like redis database connections or JSON parsing. Otherwise you might want to check any of these blog posts (ordered latest published first):
- Using Stainless with Rocket
- REST in Rust
- Connecting a webservice to a database in Rust
- Let’s Build a Web Server in Rust
- Creating a basic webservice in Rust
- Build an API in Rust with JWT Authentication using Nickel.rs
learn more about the state of web developer in rust by topic:
- HTTP Clients
- Content Management Systems
- Compression Libs
- Database Support
- En- & Decoding
- Web Development Frameworks
- JSON Support
- External Services
- Lower Web-Stack
- Templating in rust
- Web Utils
- External Web APIs
- : everything is awesome™: stable, tested and mature
- : stuff's pretty great
- : getting there, stable but still maturing
- : not yet stable, but progressing
- : unstable/incomplete, needs work
- : barely there, needs serious work
- : basically non-existant