The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

What is this Series?

I am going to produce a series of blog posts attempting to create a method for replacing FastAPI applications with Rust for my particular use case. I don’t know what this will lead to just yet; it may end up being a tutorial, it may end up being a development log as I create the pieces of the ecosystem that are missing, it may end up being only one more post if I find something that magically solves all my issues.

Check out the requirements section below for exactly what I’m trying to achieve!

Some Background

I have been using FastAPI as…


The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

This post is part of a series. If you haven’t already, you may want to read the previous post before continuing.

The last blog post was a bit long, so I figured I’d take a bit of a break and tackle a shorter topic. In this post, we’ll take a look at two different methods to deploy our Rocket application to AWS Lambda: the SAM CLI and AWS CDK.

Prerequisites

If you want to follow any of the instructions below, you’ll first need an AWS account to experiment on. I did this on an account where the free tier has already…


The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

This post is part of a series. If you haven’t already, you may want to read the previous post before continuing.

In the previous post, I decided that Rocket is the best candidate to replace FastAPI with two big caveats:

  1. It requires nightly Rust, and therefore unstable features.
  2. It is not async, and therefore not compatible with my favorite option for handling SQL: SQLx.

Both of these issues are fixed on the master branch of the Rocket repository, which will become Rocket 0.5 once released. However, hosting a Rocket application on AWS Lambda requires a crate called rocket_lamb which will…


The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

This post is part of a series. If you haven’t already, you may want to read the previous post before continuing.

After investigating a few more options, I’ve finally decided on a framework to use. Here’s how I got there, step by step.

rweb

As planned, I started with rweb. This framework was ranked second of the three options I considered in part 2 of this blog series. As a short reminder, this framework is built around warp and seems to provide most of the features I’m looking for. My main reservations are about the maintenance and community around this project.


The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

This post is part of a series. If you haven’t already, you may want to read the previous post before continuing.

TL;DR

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.

I will say that most of my struggles were related to running actix-web on AWS Lambda. …


The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
The Rust mascot ‘Ferris the Crab’ holds the logos for FastAPI and Rust and is smooshing them together.
Cover image created by me using Ferris the Crab, the Rust logo, and the FastAPI logo.

This post is part of a series. If you haven’t already, you may want to read the previous post before continuing.

Intro

After the first post (which was very accurately dubbed a “teaser” in a comment on Dev.to), I was really itching to keep talking about this project. So without further ado, here is part 2! This time around we’re going to explore a few of the existing options in the Rust ecosystem to see how close we can get to our FastAPI replacement.

rweb: The Promising Upstart

The very first project I came across when searching for the FastAPI of Rust was rweb. This…


A diagram showing the flow of Markdown in Next.js to GitHub Actions vis git push where Prettier is run, and finally to Vercel
A diagram showing the flow of Markdown in Next.js to GitHub Actions vis git push where Prettier is run, and finally to Vercel

Why?

After I decided I wanted to write some blog content again, I had to decide whether to make my own website or just stick with Dev.to as I have done in the past. Clearly I decided to create my own website (thus this post), but why? Here are the reasons:

  1. I wanted to store all my blog posts in source control. I write them in Markdown which is an easy enough format to control, and I’m very much used to GitHub for storing my data for programming projects, so why not use GitHub to store the markdown of my blog…

Dylan Anthony

The Lead Software Engineer for Triax Technologies. Topics include Rust, Python, code quality, and developer productivity.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store