Most Python web frameworks make you choose between testability and convenience. You either have clean code with complex test setup, or you use global state and hope your tests don’t interfere with each other. FastAPI’s Depends() solves this elegantly. Here is an example how you would use it in your API: What’s happening here: Type-safe –… Continue reading How Dependency Injection makes your FastAPI Code Better Testable
Articles on FastAPI
From Backend to Frontend: Connecting FastAPI and Streamlit
By Zach Merrill on 29 April 2025
In my previous Pybites article, I showed how I built and deployed a book tracking API using FastAPI, Docker, and Fly.io. That project taught me a lot about backend development, containers, and deploying modern APIs. But a backend alone isn’t enough—users need an interface. And FastAPI’s Swagger UI, while useful for testing, just isn’t user-friendly… Continue reading From Backend to Frontend: Connecting FastAPI and Streamlit
FastAPI Deployment Made Easy with Docker and Fly.io
By Zach Merrill on 18 March 2025
For the PDM program I worked on a FastAPI project to track books using the Google Book API and also provide AI powered recommendations using Marvin AI. As the project came closer to deployment, I knew that I wanted to try out containerization for a reliable and repeatable way to deploy. I chose Docker due… Continue reading FastAPI Deployment Made Easy with Docker and Fly.io
Deploying a FastAPI App as an Azure Function: A Step-by-Step Guide
By Bob Belderbos on 17 June 2024
In this article I will show you how to deploy a FastAPI app as a function in Azure. Prerequisites are that you have an Azure account and have the Azure CLI installed (see here). Setup Azure First you need to login to your Azure account: It should show your subscriptions and you select the one… Continue reading Deploying a FastAPI App as an Azure Function: A Step-by-Step Guide
