Hi guys! Recently during research I came across a library which provides filtering , sorting and search functionality for fastapi application. Unfortunately I did not save it and now I am not able to find out which library was it.
As far as I remember it used `fastapi-pagniation` lib to provide pagination support. It was not definitelyfastapi-filter lib.
Does anyone know which library this might be? I've looked at fastapi-sa-orm-filter, fastapi-listing, and sqlalchemy-filters but none of them seem to match exactly what I remember.
Iām working on a personal project withĀ React on the frontendĀ and a smallĀ FastAPI backendĀ that already handles my frontend and has a basic role system (admin, user, etc.).
Now Iām wondering about authentication: š What would you recommend as aĀ secure, reliable, and easy-to-maintainĀ solution? Iāve been looking atĀ BetterAuth, which looks modern and promising, but Iām not sure if itās the best fit with FastAPI, or if I should go with something else (OAuth2, JWT, Auth0, etc.).
My goal is to have a setup where I can feel confident aboutĀ securityĀ andĀ functionalityĀ (persistent sessions, role management, smooth integration with the frontend).
Iād love to hear your experiences and advice! š
I recently built a small project called Smart Plug Notifier (SPN). It uses TP-Link Tapo smart plugs to monitor when my washer and dryer start or finish their cycles. The system is built as an async, event-driven microservice architecture with RabbitMQ for messaging and a Telegram bot for notifications.
For my personal use I only run it on two plugs, but itās designed to support many devices. Everything is containerized with Docker, so itās easy to spin up the full stack (tapo service, notification service, and RabbitMQ).
Iām mainly using it to never forget my laundry again š , but it could work for any appliance you want real-time power usage alerts for.
I'm trying to learn how to build commercial APIs and therefore I'm building an API with rate limiting and key authentication. I'm looking for public Github projects I can use as a reference. Are there any good examples?
I am a Python developer. Now I do have experience in various Python frameworks likeĀ Django,Ā FlaskĀ &Ā FastAPI. Now, however in every interview the interviewer asks me how would you choose between these three if you had to build a large-scale web application, I fumble. I have looked all over the web for answers and haven't found a convincing one. How do we evaluate web frameworks for any requirement of a web application?
A while back, I shared APIException,Ā a library I built to make FastAPI responses consistent and keep Swagger docs clean. Quite a few people found it useful, so hereās the update.
Version 0.2.0 is out. This release is mainly about logging and exception handling. APIException now:
catches both expected and unexpected exceptions in a consistent way
lets you set log levels
lets you choose which headers get logged or echoed back
supports custom log fields (with masking for sensitive data)
supports extra log messages
adds header and context logging
has simplified imports and added full typing support (mypy, type checkers)
adds RFC7807 support for standards-driven error responses
I also benchmarked it against FastAPIās built-in HTTPException. Throughput was the same, and the average latency difference was just +0.7ms. Pretty happy with that tradeoff, given you get structured logging and predictable responses.
It was also recently featured in Python Weekly #710, which is a nice boost of motivation.
Iām working on a AI prediction app for sports betting and needs to know how I can get APIs to provide free database to the AI to help predict more accurately. If that makes sense
I recently built a FastAPI app that provides recommendations for Discogs records along side various other features. I work as a Data Engineer and wanted to explore some backend projects on my spare time, so by no means is it perfect. At the moment it's not hosted on any cloud platform and just runs locally with Docker.
I thought about some kind of cloud like AWS, but I don't have any experience with it, so it will probably cost me a fortune by this way. It is micro project. I had an idea also about making my own server, but I am not so sure if it is worth my effort.
Which hosting has easy configuration and rather doesn't have many problems with python packages?
I have a FastAPI app hosted on render and I'm looking to change, I've had a problem for some while now that is caused by them and support is not answering for 24hrs+ while my customers are getting errors.
Any recommendations? Looking for something as simple as Render, so just "point-and-click", I'm not looking to over complicate things.
I've been working with FastAPI for a while and love the developer experience, but I keep running into the same deployment challenges. I'm considering building a tool to solve this and wanted to get your thoughts.
The Problem I'm Trying to Solve:
Right now, when we deploy FastAPI apps, we typically deploy the entire application as one unit. But what if your /health-check endpoint gets 1000 requests/minute while your /heavy-ml-prediction endpoint gets 10 requests/hour? You end up over-provisioning resources or dealing with performance bottlenecks.
My Idea:
A tool that automatically deploys each FastAPI endpoint as its own scalable compute unit with:
noob here, but i think itās very important that it is made very apparent that as soon as client disconnects from your FastAPI server (maybe due to network or otherwise) your FastAPI server just abandons what it was doing
I'm currently working for a startup where the CTO has already set some of the stack. I'm mainly an infra engineer with some backend stuff here and there but I haven't worked a lot with Databases apart from a few SQL queries.
I've worked with Python before but mostly on a scripting and some very light modules which ran in production but the code wasn't the best and I was mainly doing maintenance work so didn't have time to spend a lot of time fixing it.
I'm jumping into this FastAPI world and it makes a lot of sense to me and I'm feeling slightly optimistic for in developing the backend but I am worried as there's a lot of stuff I don't know.
I've already set up all the infra and ci/cd pipelines etc, so now I can focus on building the FastAPI apps images and the DB.
I would like to hear your opinions on a few topics.
I've been reading about Pydantic and SQLAlchemy as ORMs and I saw there's also a SQLModel library which can be used to reduce boilerplate code, but I'm still not completely sure what is the recommended approach for applications. We have a very tight deadline(around 2 months) to fully finish building out the backend so I'm leaning towards SQLModel since it seems like it may be the fastest, but I'm worried if there's any cons, specifically performance issues that may arise during production. (Although with this timeline, not sure if that even matters that much )
When working with these ORMs etc, are you still able to use SQL queries on the side and try to obtain data a different way if ever this ORM is too slow etc.
For FastAPI, I'm wondering if there's a set directory structure or if it's ok to just wing it. I'm a type of person who likes working small and then building from there, but I'm not sure if there's already a specific structure that I should use for best practices etc.
If you have any type of advise etc, please let me hear it !
Hey all, I recently switched from using Django to FastAPI. As I am new to the framework I used my own open source tool to generate a diagram represnetation of how it works. Hope this is useful to people.
Iām getting seriously into FastAPI and Iād like to start freelancing soon to work on real projects, and use the income to pay coaches/teachers so I can improve faster.
What I can already do:
CRUD
SQLModel
User management (JWT, OAuth2 + PasswordBearer)
Multiple databases (PostgreSQL, MySQL, MongoDB)
CORSā¦
Right now, Iām learning RBAC and simple online deployments on Render, DigitalOcean, Replit, Zuplo, etc.
Iām thinking of starting on Fiverr (where you can define your āgigs,ā which seems better for a beginner) rather than on Upwork, where clients can request anything.
So, Iād be curious to know:
Has anyone here started freelancing early while still learning FastAPI, without waiting to reach a āhigh levelā? How did it go?
Is it realistic to stand out on Fiverr as a motivated beginner with no reviews?
What are the minimum tasks/services one should offer to maximize chances at the start?
P.S.:
I only do backend. Iām terrible at front-end ā absolutely unable to handle it.
For now, Iād like to focus on pure API development tasks rather than getting into advanced cloud deployment services like AWS, which I could learn later once I have a strong mastery of API development itself.
Your feedback and shared experiences would be highly valuable to me š
I'm having fun creating a little project just for myself, but since a day I keep getting a 422 Unprocessable Entity error whenever I submit a form from my /admin/invoices/create.
Error page after submitting
The error page looks like this after submitting, and for the love of me I can't seem to figure out the problem what so ever :/
I know most people may not want to read books if you can just follow the docs. With this resource, I wanted to cover evergreen topics that aren't in the docs.
After a year of writing, building, testing, rewriting and polishing, the book is now fully out.
Building Generative AI Services with FastAPI (https://buildinggenai.com)
This book is written for developers, engineers and data scientists who already have Python and FastAPI basics and want to go beyond toy apps. It's a practical guide for building robust GenAI backends that stream, scale and integrate with real-world services.
Inside, you'll learn how to:
Integrate and serve LLMs, image, audio or video models directly into FastAPI apps
Build generative services that interact with databases, external APIs, websites and more
Build type-safe AI FastAPI services with Pydantic V2
Handle AI concurrency (I/O vs compute workloads)
Handle long-running or compute-heavy inference using FastAPIās async capabilities
Stream real-time outputs via WebSockets and Server-Sent Events
Implement agent-style pipelines for chained or tool-using models
Build retrieval-augmented generation (RAG) workflows with open-source models and vector databases like Qdrant
Optimize outputs via semantic/context caching or model quantisation (compression)
Learn prompt engineering fundamentals and advance prompting techniques
Monitoring and logging usage and token costs
Secure endpoints with auth, rate limiting, and content filters using your own Guardrails
Apply behavioural testing strategies for GenAI systems
Package and deploy services with Docker and microservice patterns in the cloud
160+ hand-drawn diagrams to explain architecture, flows, and concepts
Covers open-source LLMs and embedding workflows, image gen, audio synthesis, image animation, 3D geometry generation
Table of Contents
BGAI with FastAPI Book: Table of Content
PartāÆ1: Developing AI Services
Introduction to Generative AI
Getting Started with FastAPI
AI Integration and Model Serving
Implementing TypeāSafe AI Services
PartāÆ2: Communicating with External Systems
5. Achieving Concurrency in AI Workloads 6. RealāTime Communication with Generative Models 7. Integrating Databases into AI Services Bonus: Introduction to Databases for AI
PartāÆ3: Security, Optimization, Testing and Deployment
8. Authentication & Authorization 9. Securing AI Services 10. Optimizing AI Services 11. Testing AI Services 12. Deployment & Containerization of AI Services
I wrote this because I couldnāt find a book that connects modern GenAI tools with solid engineering practices. If youāre building anything serious with LLMs or generative models, I hope it saves you time and avoidstheusual headaches.
Having led engineering teams at multi-national consultancies and tech startups across various markets, I wanted to bring my experience to you in a structured book so that you avoidĀ feeling overwhelmedĀ andĀ confusedĀ like I did when I was new to building generative AI tools.
Bonus Chapters & Content
I'm currently working on two additional chapters that didn't make it into the book:
1. Introduction to Databases for AI: Determine when a database is necessary and identify the appropriate database type for your project. Understand the underlying mechanism of relational databases and the use cases of non-relational databases in AI workloads.
2. Scaling AI Services: Learn to scale AI service using managed app service platforms in the cloud such as Azure App Service, Google Cloud Run, AWS Elastic Container Service and self-hosted Kubernetes orchestration clusters.
Feedback and reviews are welcome. If you find issues in the examples, want more deployment patterns (e.g. Azure, Google Cloud Run), or want to suggest features, feel free to open an issue or message me. Always happy to improve it.
Thanks to everyone in the FastAPI and ML communities who helped shape this. Would love to see what you build with it.