What it does
FastAPI Radar mounts middleware, captures HTTP and database behavior, stores it in DuckDB by default, and exposes API/dashboard routes inside the app.
GitHub repository
Open the source repo for installation, package code, tests, and release details.
System map
1
input
FastAPI App
Routes stay unchanged
2
service
Radar(app)
Configures middleware and routes
3
service
RadarMiddleware
Requests, responses, exceptions
4
service
QueryCapture
SQLAlchemy events
5
storage
DuckDB Store
Captured requests and traces
6
output
Dashboard/API
/__radar live view
Selected node
FastAPI App
Routes stay unchanged
input
Codebase read
- Radar adds a Starlette middleware that records request metadata, bodies, exceptions, and timings.
- QueryCapture attaches SQLAlchemy before/after cursor listeners and connects queries back to request context.
- The storage layer defaults to DuckDB and switches to memory under development reload to avoid file locks.
Key snippet
from fastapi import FastAPI
from fastapi_radar import Radar
from sqlalchemy import create_engine
app = FastAPI()
engine = create_engine("sqlite:///./app.db")
radar = Radar(app, db_engine=engine)
radar.create_tables()Tech used
PythonFastAPIStarletteSQLAlchemyDuckDBPydanticTracing
Source paths inspected
fastapi_radar/radar.pymiddleware.pycapture.pytracing.pyapi.py