Published on

Top 3 Free Resources to Learn FastAPI in 2024

Authors
Fastapi-logo

This blog post serves as a small introduction to FastAPI as well as a handpicked list of resources where to learn it more in depth

Why are there so many web frameworks ?

With the web becoming more and more complex, and as technology advances and different needs emerge, there is an increase for new tools that leverages a specific aspect such as scalability, easier learning curve or community support. That's the reason we have so many web frameworks where each one addresses a specific need.

What is FastAPI ? What advantages does it have over the existing Python frameworks ?

FastAPI is a new lightweight framework that is designed to be easy to use and learn thanks to an outstanding documentation, fast and with a growing community. It was created by Sebastián Ramírez in 2018.

It is based on standard Python type hints, and includes many features like automatic data validation because of its integration with Pydantic, and automatic API documentation generation that adheres to the OpenAPI standard.

How FastAPI projects are organised

Unlike Django, FastAPI doesn't impose a specific structure in order to organise your projects. But it is recommended to follow best practices in order to have a well structured project.

One very well structured template that a lot of people in the community is using is this one made by FastAPI creator.

Quickly set up FastAPI

It is very easy to start a new FastAPI project. Just install the package and an ASGI server such as uvicorn

pip install fastapi
pip install "uvicorn[standard]"

Create a new file, that you can name main.py as an example, that will have the logic of your endpoints

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}


Start after that your server using

uvicorn main:app --reload

You can also directly see your api documentation that is automatically generated on /docs and /redoc routes

fastapi-docs

Some resources to learn FastAPI

Below is a handpicked list of resources where you can learn FastAPI for free.