Course Introduction

Welcome to this course!

Hey! Welcome!

In this course, you'll learn how to build REST APIs using Python and FastAPI.

What are REST APIs? Glad you asked! A REST API is a program that takes data in from clients (such as websites and mobile apps), performs some actions (such as saving data to a database or sending an email), and returns data.

The actual definition of "REST" is a bit more complicated, and it entails your API behaving in specific ways. For now, we won't worry about whether the APIs we develop adhere strictly to REST convention or not, but I'll share best practice with you so you know how to create performant, effective, and straightforward APIs.

Who is this course for?

I made this course specifically for people who don't have much or any coding experience, but work in jobs close to product development. If you are a complete beginner to coding and you've never seen or used any code, this course is not for you (why are you learning about REST APIs anyway?).

For complete beginers, I recommend starting with a Python course such as our 30 Days of Python or our Complete Python Course.

Curriculum overview

We'll start by introducing the FastAPI library and how you can use it to run an application that accepts requests from clients (the incoming data) and returns some other data.

Then we'll talk about testing FastAPI applications using pytest. Testing applications is super important because it allows us to be more confident that the code we've written is correct.

The following sections will incrementally add features to our REST API. By doing so, you'll learn about asynchronous database operations, logging, many to many relationships, user authentication, email confirmation, handling flie uploads, and running background tasks.

We'll show you how to interact with other APIs to add more functionality to your code, as well as how to deploy and manage your application so your users can interact with it.

Why FastAPI? Why not Flask/Django/Starlite/etc?

I love Flask, it's a fantastic web framework. One of the key benefits of Flask is the community and the sheer amount of fabulous extensions that are available. Flask with Flask-Smorest is pretty similar to FastAPI in many ways!

However, for those without much coding experience, FastAPI has a few benefits:

  • The documentation is written for people without much experience, so that may be helpful.
  • The development experience is good because FastAPI "forces" you to use a few libraries that work together well and make development experience easy. With Flask, unless you make good choices, you can end up making mistakes that are difficult to solve and work around.

Regarding Django and Django REST Framework, you can certainly use it for REST APIs! But Django typically is better for more complex applications, and it can be a bit overwhelming for beginners.

Starlite is definitely a framework I'm keeping my eye on, but its documentation isn't at the level of Flask or FastAPI yet, so for now I think FastAPI is better for beginners. It won't be terribly challenging to go from FastAPI to Starlite (or really any of the other frameworks).