<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5" -->

---
title: Starlette vs FastAPI: what FastAPI actually adds | daily.dev
description: FastAPI is built on Starlette and Pydantic, and understanding where each layer begins and ends clarifies when to use each. Starlette provides the ASGI...
canonical: https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Starlette vs FastAPI: what FastAPI actually adds | daily.dev
og:description: FastAPI is built on Starlette and Pydantic, and understanding where each layer begins and ends clarifies when to use each. Starlette provides the ASGI...
og:url: https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5
og:image: https://api.daily.dev/og/posts/i0hybgYd5.png
og:image:alt: Starlette vs FastAPI: what FastAPI actually adds
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Starlette vs FastAPI: what FastAPI actually adds

**[Honeybadger](https://daily.dev/sources/honeybadger)** · 12 min read · 1 upvotes · 0 comments

## Summary

FastAPI is built on Starlette and Pydantic, and understanding where each layer begins and ends clarifies when to use each. Starlette provides the ASGI foundation: routing, middleware, WebSockets, request/response objects, and async support. Pydantic handles data validation and JSON Schema generation. FastAPI's contribution is wiring your function type hints to both — automatically parsing and validating request data, serializing responses, generating OpenAPI docs (Swagger UI and ReDoc), and providing dependency injection. Middleware, WebSocket primitives, and async behavior are identical in both frameworks since FastAPI re-exports Starlette's implementations. Starlette is the better choice for webhook receivers, WebSocket-heavy services, custom request parsing, or when minimizing dependencies matters. For typical CRUD APIs and internal services where automatic validation and docs add value, FastAPI's layer is worth the trade. A key performance gotcha: sync `def` handlers run in a threadpool capped at 40 workers by default, which can cause queuing under load.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.honeybadger.io/blog/starlette-vs-fastapi>

## Questions this post answers

### What does FastAPI actually add on top of Starlette?

FastAPI adds a declarative layer that reads Python type hints to wire up automatic request parsing, Pydantic-based validation, dependency injection, and OpenAPI schema generation with Swagger UI and ReDoc. Routing, middleware, WebSockets, async support, and request/response objects all come unchanged from Starlette; FastAPI just brackets that flow to handle type-driven parsing and serialization.

_daily.dev surfaces comparisons like this for developers weighing FastAPI against a leaner Starlette setup._

### Can I use Starlette middleware in a FastAPI app without changes?

Yes, any middleware written against Starlette's BaseHTTPMiddleware or the raw ASGI interface works unchanged in FastAPI because FastAPI re-exports Starlette's middleware pipeline and base classes. Built-ins like CORSMiddleware, GZipMiddleware, TrustedHostMiddleware, and SessionMiddleware all live in the starlette.middleware package and apply identically in both frameworks, including LIFO registration order.

_developers debugging middleware order or migrating between the two frameworks can track this reasoning on daily.dev._

### Why does my FastAPI app feel fast in testing but slow under load?

Mixing sync def and async def endpoints without accounting for the shared AnyIO threadpool is a common cause; both FastAPI and Starlette cap that pool at 40 worker threads by default, so a few slow sync handlers can saturate it and queue requests. The recommended fix is pushing slow work into a background worker rather than raising the threadpool limit.

_teams tuning FastAPI performance under load can keep tabs on this kind of gotcha via daily.dev._

## Similar posts on daily.dev

- [How to use middleware in FastAPI and Starlette](https://daily.dev/posts/how-to-use-middleware-in-fastapi-and-starlette-esf25fl7s) · Honeybadger · 1 upvotes · 0 comments
- [FastAPI: Python API Development With Light Speed \(Learning Path\) – Real Python](https://daily.dev/posts/fastapi-python-api-development-with-light-speed-learning-path-real-python-kgscajkwx) · Real Python · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#fastapi](https://daily.dev/tags/fastapi), [#pydantic](https://daily.dev/tags/pydantic)

[View this post on daily.dev](https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Starlette vs FastAPI: what FastAPI actually adds","url":"https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5"},"datePublished":"2026-07-20T11:20:50.455Z","dateModified":"2026-09-14T07:15:09.854Z","description":"FastAPI is built on Starlette and Pydantic, and understanding where each layer begins and ends clarifies when to use each. Starlette provides the ASGI...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6513941898159d82f832bb4f78bfc501?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6513941898159d82f832bb4f78bfc501?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Honeybadger","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Honeybadger","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5b56ad30204443ccade335f95e09ac85","url":"https://daily.dev/sources/honeybadger"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,fastapi,pydantic","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Honeybadger","item":"https://daily.dev/sources/honeybadger"},{"@type":"ListItem","position":3,"name":"Starlette vs FastAPI: what FastAPI actually adds"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/starlette-vs-fastapi-what-fastapi-actually-adds-i0hybgyd5#faq","mainEntity":[{"@type":"Question","name":"What does FastAPI actually add on top of Starlette?","acceptedAnswer":{"@type":"Answer","text":"FastAPI adds a declarative layer that reads Python type hints to wire up automatic request parsing, Pydantic-based validation, dependency injection, and OpenAPI schema generation with Swagger UI and ReDoc. Routing, middleware, WebSockets, async support, and request/response objects all come unchanged from Starlette; FastAPI just brackets that flow to handle type-driven parsing and serialization. daily.dev surfaces comparisons like this for developers weighing FastAPI against a leaner Starlette setup."}},{"@type":"Question","name":"Can I use Starlette middleware in a FastAPI app without changes?","acceptedAnswer":{"@type":"Answer","text":"Yes, any middleware written against Starlette's BaseHTTPMiddleware or the raw ASGI interface works unchanged in FastAPI because FastAPI re-exports Starlette's middleware pipeline and base classes. Built-ins like CORSMiddleware, GZipMiddleware, TrustedHostMiddleware, and SessionMiddleware all live in the starlette.middleware package and apply identically in both frameworks, including LIFO registration order. developers debugging middleware order or migrating between the two frameworks can track this reasoning on daily.dev."}},{"@type":"Question","name":"Why does my FastAPI app feel fast in testing but slow under load?","acceptedAnswer":{"@type":"Answer","text":"Mixing sync def and async def endpoints without accounting for the shared AnyIO threadpool is a common cause; both FastAPI and Starlette cap that pool at 40 worker threads by default, so a few slow sync handlers can saturate it and queue requests. The recommended fix is pushing slow work into a background worker rather than raising the threadpool limit. teams tuning FastAPI performance under load can keep tabs on this kind of gotcha via daily.dev."}}]}
```

