FastAPI — Advantages and Disadvantages

Shariq Ahmed
2 min readMay 7, 2024

--

FastAPI — Advantages and Disadvantages

If you are like me, then you may be seeing videos and articles about FastAPI these days. Some claim that FastAPI is overtaking Django in popularity. But is it true, and why is this happening?

Well, before discussing this, let’s discuss what actually an API is. Well, it stands for Application Programming Interface. With an API, you can create apps at a fast pace. Not only this, but the app can be built quickly and easily using an API.

Now, APIs allow different apps to share data and work together. What’s the benefit? Your time and effort will be saved. Moreover, there are different frameworks that can help build APIs in Python. Some of them include Flask, Django, and FastAPI. But today, I’ll discuss FastAPI.

First thing first, it was created on December 5, 2018, by Sebastián Ramírez — a software developer — because existing frameworks, including Flask and DRF, didn’t satisfy his needs. FastAPI is a high-performing web framework that is used for building APIs using Python 3.7+.

But, why build APIs? Well, API allows apps to be modular and decoupled. Moreover, it’s built on top of the Starlette web server and has some features that can help ease the process of making web apps.

Now, there are many reasons why FastAPI is the best. Some of these reasons include its performance, speed, and easiness — easy to learn and use.

Apart from this, some features of FastAPI include:

  1. Automatic Documentation — Using the type hints and docstrings present in your code, FastAPI will make an interactive documentation itself. Moreover, there is built-in documentation as well that is really useful. The documentation also helps developers in explaining software to other people.
  2. Type Hinting — To improve or better your code, built-in Python type hints do reliable auto-completion and validation.
  3. Better Performance — One of the selling points of FastAPI is speed.
  4. Built-in Concurrency — Python 3.4 introduces Async I/O. By eliminating the need for an event loop, FastAPI simplifies concurrency.

But like any plugin, there are disadvantages of using FastAPI as well. For example, its security. FastAPI isn’t secure. Though, fastapi.security manages security.

--

--

Shariq Ahmed

A Full Stack Developer of React | React Native | Next.JS | Node JS | Nest.JS | GraphQL | Firebase | Typescript