DEV Community

Cover image for FastAPI — Advantages and Disadvantages
Shariq Ahmed
Shariq Ahmed

Posted on • Updated on • Originally published at Medium

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 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. Better Performance — One of the selling points of FastAPI is speed.
  3. **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.

Top comments (0)