Awesome FastAPI extensions and add ons
Episode Deep Dive
Guest Introduction and Background
Michael Herman is the creator behind testdriven.io and a seasoned Python developer deeply involved in the community. He has worked on various projects including Monitar (a machine learning governance platform) and has a strong background in DevOps, Django, Kubernetes, AWS ECS, and more. In this episode, he returns to Talk Python to discuss his Awesome FastAPI list and the many powerful extensions that integrate with FastAPI.
What to Know If You're New to Python
Here are a few core suggestions mentioned or implied during the episode to help you get ready for this topic:
- Python basics (variables, loops, and functions) make it easier to grasp frameworks like FastAPI.
- Understanding virtual environments helps you install and isolate FastAPI and its add-ons.
- Familiarity with HTTP basics (GET, POST, etc.) will give you context on building RESTful APIs.
Key Points and Takeaways
- Why FastAPI Stands Out
FastAPI is beloved for its modern Python features: type hints,
async
/await
, Pydantic data models, and automatic generation of OpenAPI docs. These capabilities bring clarity to your code, faster development, and robust validation out of the box. It’s also built atop Starlette for high performance and has a growing ecosystem of extension libraries. - Michael Herman’s Awesome FastAPI List
Michael curates an “Awesome List” of third-party libraries and add-ons that highlight FastAPI’s ecosystem. This collection covers admin panels, authentication, ORMs, testing tools, background tasks, and more—offering a curated overview so developers don’t have to hunt down packages one by one.
- Links and Tools:
- FastAPI Admin & Admin Panels
FastAPI Admin provides Django-like admin functionality with a CRUD interface for your database models. While it’s simpler than Django’s built-in admin, it’s perfect for quick, internal tools and controlling database objects without writing custom forms or additional routes.
- Links and Tools:
- Authentication Extensions
Packages like FastAPI Users handle JWT tokens, OAuth2, cookie-based sessions, and other common auth flows. This allows quick setup of login endpoints, user models, and password handling, freeing developers to focus on application logic rather than boilerplate security code.
- Links and Tools:
- Popular ORMs and Async Support
Beyond SQLAlchemy, FastAPI works smoothly with async-friendly ORMs such as Tortoise ORM, Gino, and others. This is crucial when leveraging
async
for highly concurrent APIs. The built-in Pydantic integration also pairs neatly with these ORMs, ensuring type-safe conversions.- Links and Tools:
- Code Generation and Clients
Tools like FastAPI Code Generator and various OpenAPI-based generators scaffold CRUD endpoints, client libraries, and Pydantic models from an existing API spec. This automated approach helps teams quickly bootstrap consistent APIs or build robust client libraries that are type-hint friendly.
- Links and Tools:
- Profiling and Performance
FastAPI Profiler layers profiling middleware on top of your app, so you can see where performance bottlenecks lie. Combined with standard Python profiling tools or packages like Py-Instrument, this lets you visualize and optimize route performance, especially in async scenarios.
- Links and Tools:
- Email and Background Tasks
Sending emails can be time-consuming and can block request processing. Extensions like FastAPI Mail enable async or background-scheduled emails with minimal configuration. Tools like Celery can also be layered on for more advanced queue-based solutions.
- Links and Tools:
- Deployment and Hosting You can deploy FastAPI nearly anywhere: from containers in Heroku or DigitalOcean to a full Kubernetes cluster. A common approach is using Uvicorn or GUnicorn with Uvicorn workers behind Nginx. Because it’s so lightweight and async-based, FastAPI is relatively easy to containerize and scale.
- Comparison with Flask and Django Django has a built-in admin and a more monolithic structure, while Flask is minimal and highly extensible. FastAPI, however, emphasizes modern Python features (like type hints, async) and auto-documented endpoints. Deciding if you need to migrate depends on your project scope: if you already use Django or Flask effectively, you might stick with them; but if you crave async concurrency, better typing, and built-in validation, FastAPI is a strong option.
Interesting Quotes and Stories
"If you're really into Pydantic, then I would definitely check out FastAPI." — Michael Herman
"It's not that I'm super against that, but I think there's still a lot of value in having some of the stuff on the server side. I don't think everything has to be a spa." — Michael Kennedy
Key Definitions and Terms
- Pydantic: A Python library for data validation and settings management using Python type annotations.
- OpenAPI: A specification for building, documenting, and consuming RESTful APIs, often powers the interactive docs in FastAPI.
- Async / Await: Python features that let you write concurrent code using coroutines, crucial for I/O-bound scaling.
- Dependency Injection: A design pattern where dependencies (e.g., database connectors) are “injected” into a function or class, making testing and decoupling easier.
Learning Resources
If you’d like to deepen your Python knowledge (including topics for those just getting started), here are some courses from Talk Python Training.
- Python for Absolute Beginners: Perfect if you’re brand new to programming and want a solid Python foundation.
- Modern APIs with FastAPI and Python: Learn how to build and deploy real-world APIs with FastAPI.
- Full Web Apps with FastAPI: Discover how to serve server-side HTML, create user logins, and more with FastAPI.
You can also explore Michael Herman’s testdriven.io for additional courses and TDD-focused tutorials.
Overall Takeaway
FastAPI’s success is driven by a combination of modern Python features, excellent developer ergonomics, and a rapidly growing ecosystem of extensions that provide everything from admin dashboards to advanced profiling. Whether you’re new to Python web frameworks or considering migrating from Django or Flask, FastAPI offers a highly productive environment for building robust, async-ready web services and full-blown applications.
Links from the show
awesome-fastapi list: github.com
FastAPI: fastapi.tiangolo.com
TestDriven.io: TestDriven.io
Monitaur: Monitaur.ai
FastAPI 3-course bundle: testdriven.io/talkpython
Thonny: thonny.org
hotwire-django: github.com
Chameleon decorator for FastAPI: github.com
Jinja2 decorator for FastAPI: github.com
Catch Talk Python Live Streams: talkpython.fm/live
Watch this episode on YouTube: youtube.com
Episode transcripts: talkpython.fm
--- Stay in touch with us ---
Subscribe to Talk Python on YouTube: youtube.com
Talk Python on Bluesky: @talkpython.fm at bsky.app
Talk Python on Mastodon: talkpython
Michael on Bluesky: @mkennedy.codes at bsky.app
Michael on Mastodon: mkennedy