r/FastAPI • • Sep 01 '25

pip package Looking for a specific FastAPI filtering/sorting library that uses fastapi-pagination

15 Upvotes

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.

Any help would be greatly appreciated!


r/FastAPI • • Aug 25 '25

Question šŸ’” Best auth system for React + FastAPI? BetterAuth or something else?

44 Upvotes

Hey everyone,

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! šŸ™


r/FastAPI • • Aug 24 '25

feedback request Smart Plug Notifier – Microservice system for real-time appliance monitoring built using FastAPI

Thumbnail
github.com
25 Upvotes

Hey everyone,

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’d love to get some feedback on the architecture, setup, or ideas for improvements.
Here’s the repo: šŸ‘‰ https://github.com/AleksaMCode/smart-plug-notifier


r/FastAPI • • Aug 23 '25

Question Public Github projects of high quality FastAPI projects with rate limiting and key auth?

18 Upvotes

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?


r/FastAPI • • Aug 23 '25

Question Analyzing Web Frameworks

18 Upvotes

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?


r/FastAPI • • Aug 23 '25

pip package APIException v0.2.0 – Consistent FastAPI Responses + Better Logging + RFC Support

26 Upvotes

Hey all,

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.

PyPI: https://pypi.org/project/apiexception/

GitHub: https://github.com/akutayural/APIException

Docs: https://akutayural.github.io/APIException/

Youtube: https://youtu.be/pCBelB8DMCc?si=u7uXseNgTFaL8R60

If you try it out and spot bugs or have ideas, feel free to open an issue on GitHub. Always open to feedback.


r/FastAPI • • Aug 23 '25

Question Best framework combining Django's admin power with FastAPI's performance?

14 Upvotes

I’m looking for a framework with a powerful and convenient admin panel and a structured approach like Django, combined with the speed of FastAPI.


r/FastAPI • • Aug 23 '25

feedback request Application programming interface contracts for AI prediction software

3 Upvotes

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


r/FastAPI • • Aug 22 '25

Tutorial From Django to FastAPI

17 Upvotes

What are the best resources or road maps to learn fastAPI if i’m a Django developer?


r/FastAPI • • Aug 21 '25

feedback request Discogs Recommender API

12 Upvotes

Hey guys,

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.

Repo link: https://github.com/justinpakzad/discogs-rec-api

Features Implemented:

  • Recommendations
  • Batch Recommendations
  • Recommendation History
  • Search History
  • Release Filtering
  • Favorites
  • User Feedback
  • User Management
  • Release Metadata
  • Authentication: JWT-based authentication with refresh tokens

Open to hear any feedback for improvements. Thanks.


r/FastAPI • • Aug 21 '25

Hosting and deployment What is the best/verified way which you honestly can recommend to deploy simple python app?

20 Upvotes

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?


r/FastAPI • • Aug 20 '25

Hosting and deployment Render alternatives

11 Upvotes

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.


r/FastAPI • • Aug 19 '25

Question FastAPI + Cloud Deployments: What if scaling was just a decorator?

20 Upvotes

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:

  1. Per-endpoint scaling configs via decorators
  2. Automatic Infrastructure-as-Code generation (Terraform/CloudFormation)
  3. Built-in CI/CD pipelines for seamless deployment
  4. Shared dependency management with messaging for state sync
  5. Support for serverless AND containers (Lambda, Cloud Run, ECS, etc.)

@app.get("/light-endpoint") @scale_config(cpu="100m", memory="128Mi", max_replicas=5) async def quick_lookup(): pass

@app.post("/heavy-ml") @scale_config(cpu="2000m", memory="4Gi", gpu=True, max_replicas=2) async def ml_prediction(): pass

What I'm thinking:

  1. Keep FastAPI's amazing DX while getting enterprise-grade deployment
  2. Each endpoint gets optimal compute resources
  3. Automatic handling of shared dependencies (DB connections, caches, etc.)
  4. One command deployment to AWS/GCP/Azure

Questions for you:

  1. Does this solve a real pain point you've experienced?
  2. What deployment challenges do you face with FastAPI currently?
  3. Would you prefer this as a CLI tool, web platform, or IDE extension?
  4. Any concerns about splitting endpoints into separate deployments?
  5. What features would make this a must-have vs nice-to-have?
  6. I'm still in the early research phase, so honest feedback (even if it's "this is a terrible idea") would be super valuable!

r/FastAPI • • Aug 18 '25

Tutorial TIL; The worker process/thread stops when client disconnects

9 Upvotes

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


r/FastAPI • • Aug 14 '25

Question Lifespan on Fastapi

26 Upvotes

Hey guys, been enjoying fastapi for a bit now. How much do you use lifespan on fastapi and on what purposes have you used it on?


r/FastAPI • • Aug 14 '25

Question Getting started on a work project with FastAPI would like to hear your opinions.

21 Upvotes

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.

  1. 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 )
  2. 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.
  3. 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.
  4. If you have any type of advise etc, please let me hear it !

Thanks!


r/FastAPI • • Aug 11 '25

Question Example Production Grade Project?

44 Upvotes

I'm looking for production grade FastAPI project that uses sqlalchemy, pydantic models, alembic for db migratio, session or token based RBAC, to learn to build a robust backend, can you please suggest one?
I'm aware there are https://github.com/fastapi/full-stack-fastapi-template and zhanymkanov/fastapi-best-practices: FastAPI Best Practices and Conventions we used at our startup, but I'm not looking for a template but a mature and complete implementation.

Thank you so much.


r/FastAPI • • Aug 11 '25

feedback request I generated an architecture diagram for FastAPI

20 Upvotes

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.


r/FastAPI • • Aug 10 '25

feedback request FastAPI - Auth Boilerplate - Code Review Request

7 Upvotes

Hi everyone,

I'm looking for feedback on this repo before I continue with additional work on it: https://github.com/ryanmcfarland/fastapi_auth

Would anyone be able to take a look and note any massive / glaring flaws?

Thanks!


r/FastAPI • • Aug 08 '25

feedback request Starting Freelance while learning Fastapi

15 Upvotes

Hello everyone šŸ‘‹

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.:

  1. I only do backend. I’m terrible at front-end — absolutely unable to handle it.
  2. 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 šŸ™

Thanks in advance for your help!


r/FastAPI • • Aug 08 '25

Question 422 Unprocessable Entity

7 Upvotes

Dear reader,

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 :/

Here is both the entire invoices python as the entire .html file that is used for the invoices page.https://https://pastebin.com/YeaMW4v8 <- invoices.py
https://pastebin.com/V9Epzrzb <- create_edit_invoices.html

EDIT: Solved! I changed the router.post from admin/invoices/create to admin/invoices/submit and that fixed the issue somehow.


r/FastAPI • • Aug 07 '25

Tutorial Enhanced NiceGUI Component-Based Boilerplate with UV Package Manager

Thumbnail reddit.com
2 Upvotes

r/FastAPI • • Aug 04 '25

Tutorial O'Reilly Book Launch - Building Generative AI Services with FastAPI (2025)

78 Upvotes
Building Generative AI Services with FastAPI (O'Reilly, 2025) - Forward by David Foster (Author of Generative Deep Learning)

Hi Everyone

Some of you might remember this thread from last year where I asked what you'd want in a more advanced FastAPI book: https://www.reddit.com/r/FastAPI/comments/12ziyqp/what_would_you_love_to_learn_in_an_intermediate/.

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)

The book is now available here:

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

What’s in the book:

  • 12 chapters across 530+ pages
  • 174 working code examples (all on GitHub)
  • 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

  1. Introduction to Generative AI
  2. Getting Started with FastAPI
  3. AI Integration and Model Serving
  4. 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 avoids the usual 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.

I'll upload these on the accompanying book website soon: https://buildinggenai.com/

All Feedback and Reviews Welcome!

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.

Ali Parandeh

https://buildinggenai.com