Introduction to FastAPI

Table of contents

In this article, I will introduce you to the most trending Python framework which can primarily be used for building robust APIs.

The key features of FastAPI are:

  1. Fast - FastAPIs performance exceeds Nodejs and Go, as it runs under the uvicorn server which is one of the most secured available servers as of now

  2. Easy to Code - With FastAPI, creating an API is as easy and joyful as unboxing your new iPhone. An API can be written in under two minutes with FastAPI.

  3. Automated Docs - With FastAPI, the developer need not spent time writing documentation of the APIs that were built. Because swagger docs are automatically created in detail as you keep writing APIs.

  4. Robust - FastAPI can guarantee you a production-ready code from day one.

  5. Short and Sweet - The minimal the code requirement, the fewer the bugs are. APIs can be strictly typed using pydantic types, which helps the creation of interactive documentation.

  6. Standard - The API creation here follows the OpenAPI standards to be universally stable and compatible.

Steps to start with FastAPI

  • Let's install Python first so that FastAPI works along with it.

      sudo apt update
      sudo apt install python3.8
    
  • Install the package manager of python, python-pip which will get us all the required libraries for our FastAPI setup

      sudo apt-get install python3-pip python-dev
    
  • Now install FastAPI and all dependencies with a one-liner. This also includes the uvicorn server

      pip install "fastapi[all]"
    
  • Now we are ready to use the FastAPI framework and build some lightning-fast APIs. We'll discuss how to build a standard folder structure and a set of backend APIs related to an interesting topic with FastAPI. Stay tuned!

  • If you would like to learn and deep dive into FastAPI refer to the following links

    1. FastAPI official Docs

    2. Official GitHub page

To learn about how to start writing your first API with fastAPI , go through the next article of this series -

First API using FastAPI

"Debugging is like being the detective in a crime movie where you're also the murderer." - Filipe Fortes

0
Subscribe to my newsletter

Read articles from Sai Lokesh Reddy directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sai Lokesh Reddy
Sai Lokesh Reddy

I am currently working as a FullStack Developer. Having two years of experience with ReactJs and FastAPI(Python).