r/FastAPI • u/Educational-Hope960 • May 12 '26
feedback request How are you handling production background tasks in FastAPI without Celery?
Hey everyone š
A while ago I built an open source library called FastAPI Taskflow:
fastapi-taskflow GitHub repository
The goal was to make FastAPI BackgroundTasks more production-ready by adding retries, resiliency, control and visibility without workers or brokers.
It adds extra features like:
- task persistence
- concurrency limits
- scheduling
- task lifecycle management
- monitoring dashboard
Iām trying to understand how people are actually using it in real projects and where the pain points still are.
If youāve used it (even briefly), Iād really love to know:
- what problem you used it for
- what worked well
- what felt awkward or missing
- where it broke down
- features you expected but werenāt there
- whether you eventually switched to Celery/TaskIQ/etc and why
Even if youāre not using it, Iām curious what your current approach is for handling background tasks in FastAPI at scale.
If you find the project interesting or useful, a star on GitHub would also really help support it š
3
u/dr3aminc0de May 12 '26
How does this handle versioning of the deployed binary vs tasks and potential mismatches?
I use Temporal for these types of things. Also have separate workers is part of the design. I donāt want background tasks interfering with my production APIs.
8
u/xCodeSoul May 12 '26
From my experience by running production ready fastapi
Never let fastapi doing something really heavy on database especially these things background tasks
Make it stateless.
For such things, for example generating customers invoices i develop separate app to generate which working with cron job on separate server
Like that I didnāt face any issues regarding scaling vertically or horizontally
Happy coding and good luck
1
u/VirtualKn May 12 '26
looks pretty good, planning to test it out
3
u/artpods56 May 13 '26
Im using NATS with FastStream, check it out, I prefer it over Celery
2
u/Melodic_Put6628 May 13 '26
I havenāt used Taskflow yet, but in production I usually stop using FastAPI BackgroundTasks once the task needs durability.
For small best-effort work, BackgroundTasks are fine. But if I need retries, persistence, idempotency, or visibility, I treat it as a separate worker boundary.
What has worked well for me:
- explicit payload schemas
- thin task functions
- business logic in services, not in the task wrapper
- idempotent retries
- external broker in production
- structured logs/metrics before fancy dashboards
The hard parts are usually not scheduling the task, but operating it later: duplicate execution, deploys during running jobs, retry storms, dead-letter handling, and payload schema changes.
So the main thing Iād look for in a library like this is very explicit failure semantics. What survives a restart? What is retried? What is persisted? What happens when the payload shape changes?
2
u/betazoid_one May 13 '26
Crontab
2
u/GoldForever33 Jun 12 '26
For production FastAPI background jobs, I usually prefer ARQ.
FastAPI
BackgroundTasksis fine for small/simple work, but once I need retries, persistence, scheduling, or better reliability, ARQ feels like a good async-friendly option with Redis.Your project looks interesting though, especially because it tries to add more control without making people jump directly to Celery or a broker-heavy setup.
1
u/Commercial-Catch-680 May 17 '26
I built a self-hosted app called Trailarr that was using APScheduler at first but wanted more features like async handling, cancellable tasks, etc., so I built my own scheduler called Quiv, there's a couple of improvements I can make but it's working well for the most part.
Trailarr has ~10k users self-hosting it on their servers, and I haven't heard about any issues with tasks - so it's working for what I need.
https://github.com/nandyalu/trailarr
https://github.com/nandyalu/quiv
4
u/[deleted] May 12 '26
[removed] ā view removed comment