Replacing FastAPI with Rust: Part 3 - Trying Actix

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • actix-web

    Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

  • Not the most elegant of solutions, but it worked. Now seems like a good time, by the way, to take away a point for "MUST have great documentation". While the docs for using actix-web as intended were good, I'm far off the beaten path at this point and will only go further. I didn't find any docs at all to help me with this nor later code, and instead spent a lot of time digging through source code and deciphering cryptic compiler errors.

  • paperclip

    Discontinued WIP OpenAPI tooling for Rust. [Moved to: https://github.com/paperclip-rs/paperclip] (by wafflespeanut)

  • I got actix-web + Paperclip working with AWS SAM. Development was time consuming, troubleshooting was frustrating, and the end result was fragile and ugly. In future blog posts I will be experimenting with other solutions and hoping for a much nicer result. I'll only return to the actix-web approach if other methods are somehow even worse.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • warp_lambda

    A super simple adapter crate to let you use warp filters with AWS lambda runtime

  • There is probably some standard way to get around this sort of stuff, but I couldn't figure it out, certainly not with messages as cryptic as the ones I was getting. So I turned to a crate I found called warp_lambda. That's right, I found a crate that allows you to run warp on AWS Lambda. As a reminder, rweb, the most promising option from a functional standpoint, is based on warp.

  • The code works... but barely. If you want to see the end result, I have put it up in a GitHub Repository where I also intend to add future experiments in other frameworks. If you haven't gathered as much from all of the text above, this code is fragile, slow, and in no way recommended for production. But if you're more experienced (or dedicated) than I am and want to try your hand at making it better, go for it!

  • rweb

    Yet another web server framework for rust

  • This crate has an implementation for the Handler trait which I used to model my own Handler trait for an actix-web Service. Using my own struct which implemented that trait suddenly made the "this is not Send" error messages simple enough to decipher. I was able to get the thing to actually compile, but it required using a few unwrap()s on errors which were not Send. I could probably go back and figure out how to wrap or map those errors to something simpler to make my implementation less fragile, but I was already annoyed enough at this implementation that I was headed toward rweb anyway.

  • fastapi

    FastAPI framework, high performance, easy to learn, fast to code, ready for production

  • Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts