Introduction to FastAPI

Learn about FastAPI, an interesting and new framework to develop web apps in Python.

Introduction to FastAPI?

The official website describes FastAPI in the following terms:

FastAPI is a modern [and] fast (high-performance) web framework for building APIs with Python 3.6+ based on standard Python type hints.

As evident from the name, FastAPI is extremely fast and it owes this to the to out of the box support of the async feature of Python 3.6+. This is why it is recommended to use the latest versions of Python.

FastAPI was created by Sebastián Ramírez who was not happy with existing frameworks like Flask and DRF. He believed in standing on the shoulders of giants and used existing tools and frameworks like Starlette and Pydantic.

A number of tech giants like Microsoft, Uber and Netflix are already using FastAPI to build their applications.

Key features of FastAPI

  • Fast: It offers very high performance, on par with NodeJS and Go (thanks to Starlette and Pydantic). It is considered to be one of the fastest Python frameworks available.

  • Fast to code: It increases the speed to develop applications by about 200% to 300%.

  • Less bugs: It reduces about 40% of human (developer) induced bugs.

  • Intuitive: It offers great editor support. The developer needs to spend less time debugging the code to verify whether the code syntax is correct or not.

  • Easy: It is designed to be easy to use and learn. Also, the official documentation is lucid and well structured and thus takes less time to read.

  • Short: It supports minimize code duplication. It offers multiple features from each parameter declaration. It also has fewer bugs.

  • Robust: Get production-ready code with automatic interactive documentation.

  • Standards-based: It is based on (and fully compatible with) the open standards for APIs, OpenAPI (previously known as Swagger) and JSON schema.

If you want to install FastAPI on your system, you can check the Appendix section.