FastAPI

Web framework for Python From Wikipedia, the free encyclopedia

FastAPI is a high-performance web framework for building HTTP-based service APIs in Python 3.8+.[3] It uses Pydantic and type hints to validate, serialize and deserialize data. FastAPI also automatically generates OpenAPI documentation for APIs built with it.[4] It was first released in 2018.

Quick Facts Developer(s), Initial release ...
FastAPI
Developer(s)Sebastián Ramírez
Initial releaseDecember 5, 2018; 6 years ago (2018-12-05)[1]
Stable release
0.115.12[2]  / 23 March 2025; 34 days ago (23 March 2025)
Repositorygithub.com/tiangolo/fastapi
Written inPython
TypeWeb framework
LicenseMIT
Websitefastapi.tiangolo.com
Close

Components

Pydantic

Pydantic is a data validation library for Python. While writing code in an IDE, Pydantic provides type hints for schema validation and serialization through type annotations.[5]

Starlette

Starlette is a lightweight ASGI framework/toolkit, to support async functionality in Python.[6]

Uvicorn

Uvicorn is a minimal low-level server/application web server for async frameworks, following the ASGI specification. Technically, it implements a multi-process model with one main process, which is responsible for managing a pool of worker processes and distributing incoming HTTP requests to them. The number of worker processes is pre-configured, but can also be adjusted up or down at runtime.[7]

OpenAPI Integration

FastAPI automatically generates OpenAPI documentation for APIs. This documentation includes both Swagger UI and ReDoc, which provide interactive API documentation that you can use to explore and test your endpoints in real time. This is particularly useful for developing, testing, and sharing APIs with other developers or users.[8]

Example

The following code shows a simple web application that displays "Hello World!" when visited:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def read_root():
    return "Hello World!"

See also

References

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.