Skip to main content

Features for FastAPIs

FastAPI features such as middleware and background work extend how requests are handled. Middleware wraps every request and response for tasks like logging, timing or CORS, while BackgroundTasks run small jobs after the response is sent, and heavier work is better moved to a queue such as Celery.

Stage: Data and Features · Part of the FastAPI roadmap · Last reviewed 19 November 2026

What to learn in Features

Features interview questions

What are BackgroundTasks good for and when are they not enough?

They run short jobs after the response is returned, such as sending a notification, in the same process. They have no retries, persistence or separate workers, so long or critical jobs should use a queue such as Celery or Arq.

What does middleware do compared with a dependency?

Middleware runs around every request and response and is unaware of the route, which suits logging, timing and headers. A dependency is attached to specific endpoints, can take parameters and its result is passed to the handler.

Where Features fits in the FastAPI roadmap

Features belongs to the Data and Features stage (intermediate level). Real application behaviour.

Back to the full FastAPI roadmap