Lightweight background task dashboard with FastAPI BackgroundTasks
Project description
FastAPI Background Tasks Dashboard
A simple and lightweight open-source dashboard to see what your FastAPI background tasks are doing in real time.
Just one line to get your dashboard running — mount that dashboard on your FastAPI app and you’re done:
from fastapi import FastAPI
from fastapi_bgtasks_dashboard import mount_bg_tasks_dashboard
app = FastAPI()
# Add dashboard for background tasks
mount_bg_tasks_dashboard(app=app)
Why this project?
FastAPI has a built-in BackgroundTasks feature that lets you run things after sending a response. But
- You don’t get a live view of what tasks are running.
- You don’t know when they start or finish.
- If something fails, there’s no quick way to check.
- If some tasks run without you noticing then your resources may exhaust.
This project was built to fill that gap.
Now you can have a clean, lightweight dashboard to watch your background jobs, with no external services or heavy dependencies.
Installation
pip install fastapi-bgtasks-dashboard
Quick Usage Example
Create a file main.py and install dependencies
pip install fastapi uvicorn
pip install fastapi-bgtasks-dashboard
Add the following code to main.py
from fastapi import FastAPI, BackgroundTasks
from fastapi_bgtasks_dashboard import mount_bg_tasks_dashboard
app = FastAPI()
# Add dashboard for background tasks
mount_bg_tasks_dashboard(app=app)
def simple_task(name: str):
import time
print(f"Started task for {name}")
time.sleep(20)
print(f"Finished task for {name}")
@app.get("/hello/{name}")
async def say_hello(name: str, background_tasks: BackgroundTasks):
background_tasks.add_task(simple_task, name)
return {"message": f"Hello {name}, task started in background!"}
Run the server with:
uvicorn main:app --reload
Now open your browser at: 👉 http://localhost:8000/dashboard
You’ll see a live dashboard of all background tasks.
Features & Roadmap
- Persistent storage support (SQLite, Postgres, etc.)
- Export tasks to JSON/CSV
- Real-time updates (via WebSocket)
- Sortable columns (default: newest first)
- Filter by function name or status
- Paginate after 100 tasks for smooth performance
- Display task duration in ms / s / m / h
- Show task parameters
- Run tasks again with one click
- Clear all in-memory tasks instantly
- Lightweight in-memory storage (no database required)
Contributing
We welcome contributions! Whether it's fixing bugs, improving the dashboard, or adding new features, you can help make this project better.
How to Contribute
-
Clone the repository
git clone git@github.com:Harshil-Jani/fastapi-bgtasks-dashboard.git cd fastapi-bgtasks-dashboard
-
Install the package locally
pip install -e .
This command installs the package in editable mode, so any changes you make locally will be immediately reflected.
-
Run the example usage script
There is a
usage.pyfile that demonstrates how to use the dashboard. Install fastapi and uvicorn to run this script.pip install fastapi uvicorn
uvicorn usage:app --reload
You can then test your changes by opening your browser to
http://localhost:8000/dashboard. -
Make your changes
- Fix bugs
- Add new features
- Improve documentation
-
Submit a Pull Request
Once you're happy with your changes, commit them with a clear message and open a pull request against the
mainbranch. We'll review it and merge it if everything looks good.
Note: This project is designed to be lightweight and easy to use, so please keep new features aligned with this philosophy whenever possible.
License
MIT – Free to use and improve. Made with ❤️ for the open-source community.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_bgtasks_dashboard-0.1.5.tar.gz.
File metadata
- Download URL: fastapi_bgtasks_dashboard-0.1.5.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff63695ed433fd269f256a1c25fb1044c5c60c2abc628bdf1bf090d5b3a36731
|
|
| MD5 |
14f6d11bf640b57d275e7ab27a5176d2
|
|
| BLAKE2b-256 |
04b5f29df070f22a6109ba443a1a2af320c99e87fd99d1731c1c7735df9bd9cc
|
File details
Details for the file fastapi_bgtasks_dashboard-0.1.5-py3-none-any.whl.
File metadata
- Download URL: fastapi_bgtasks_dashboard-0.1.5-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56847b8c4e9a15523390065583c00c21836bb8a326dcd5d079323602dd47f3fe
|
|
| MD5 |
26d01e38832abe25aefc1893d6da84b2
|
|
| BLAKE2b-256 |
559a1a1df7955bd6b8eeef9bdd565460753e4cda8325fa54689340e2b22d9f86
|