Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Coursera

Mastering REST APIs with FastAPI

Packt via Coursera

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
This course features Coursera Coach! A smarter way to learn with interactive, real-time conversations that help you test your knowledge, challenge assumptions, and deepen your understanding as you progress through the course. In this comprehensive course, you'll master the art of building robust and efficient REST APIs using FastAPI, a modern, fast (high-performance) web framework for Python. You'll learn how to build an entire social media API, implement user authentication, integrate databases, manage background tasks, and deploy your applications in production. By the end of the course, you'll be able to design and deploy production-grade REST APIs with FastAPI, ensuring your skills are sharp and industry-ready. Throughout the course, you will start with foundational concepts, such as what APIs are and how REST APIs work. Then, you'll dive deeper into the FastAPI framework and how to build efficient, maintainable APIs with it. The course includes hands-on projects where you will work on creating social media API endpoints, integrating databases with FastAPI, adding logging and error tracking, handling user authentication, and working with background tasks. In addition, you will explore advanced topics such as integrating third-party services, like DeepAI for image generation, and learn how to deploy your FastAPI application to platforms like Render. With real-world projects and a focus on industry best practices, you will gain valuable experience to take into your future development work. This course is perfect for aspiring backend developers and those familiar with Python who wish to deepen their knowledge of REST API design and implementation using FastAPI.

Syllabus

  • Course Introduction
    • In this module, we will lay the foundation for your journey into mastering REST APIs with FastAPI. You will explore the importance of community in software development, gain clarity on what to expect from this course, and dive into the core concepts of APIs and REST, setting the stage for the practical lessons ahead.
  • Working with FastAPI
    • In this module, we will dive into the essentials of working with FastAPI, starting with creating your first application. You will learn how to configure a clean and maintainable setup, follow best practices for code formatting, and implement core features of a social media API. By the end of this section, you will also know how to manage a scalable codebase using APIRouter for modular development.
  • Introduction to pytest
    • In this module, we will explore pytest, a robust testing framework for Python. You will start with its basics and then focus on writing and implementing tests for your FastAPI applications. By the end of this section, you will have built a suite of tests to ensure the reliability of the posts and comments features in your API, laying the groundwork for quality assurance in your projects.
  • Working with async databases
    • In this module, we will delve into the integration of asynchronous databases with FastAPI. You will learn how to install necessary dependencies, create configuration files using Pydantic, and manage multiple environments. Additionally, you will set up an async database, handle connections using lifespan events, and integrate database operations into your API routers to enable seamless data persistence.
  • Logging in FastAPI applications
    • In this module, we will focus on implementing robust logging mechanisms in FastAPI applications. You will explore Python’s logging framework, configure multiple loggers, and add file handlers to persist logs. Advanced techniques like using filters, obfuscating sensitive data, and implementing correlation IDs will also be covered. Additionally, you’ll learn how to integrate and manage cloud-based logging tools like Logtail, enabling efficient monitoring and debugging in production.
  • User authentication with FastAPI
    • In this module, we will cover user authentication in FastAPI, from the basics of creating a users table to advanced features like token generation and password hashing. You will implement user registration, retrieve the current user using tokens, and apply dependency injection for streamlined user management. Additionally, the module explores integrating user relationships with other tables and optional features like OAuth Password Bearer and Swagger for secure and well-documented APIs.
  • Many-to-many relationships
    • In this module, we will explore the implementation of many-to-many relationships in FastAPI using SQLAlchemy. You will learn how to set up a table for post likes, create API routes for interacting with posts, and streamline database operations with reusable queries. The module also covers advanced techniques like using query string arguments and Enums to enable data sorting and filtering, enhancing the functionality and user experience of your application.
  • User email confirmation
    • In this module, we will implement user email confirmation in FastAPI. You will learn how to generate and decode confirmation tokens, create a confirmation endpoint, and enforce email verification for authenticated requests. Additionally, the module guides you through setting up Mailgun, sending confirmation emails, and optimizing email delivery using background tasks to ensure a seamless and efficient user experience.
  • File Uploads with FastAPI
    • In this module, we will focus on enabling file uploads in your FastAPI application. You'll learn how to set up and integrate Backblaze B2 as a file storage solution, implement a dedicated file upload endpoint, and write tests to ensure seamless and secure operation.
  • Background Tasks for Image Generation
    • In this module, you will learn how to implement image generation features in FastAPI using background tasks. You will modify your application’s models and databases, configure DeepAI as a third-party service, and use background tasks to optimize image generation. By the end, you will have fully integrated image generation functionality into your FastAPI endpoints.
  • FastAPI Deployments and Application Management
    • In this module, you will learn to deploy and manage FastAPI applications effectively. You will update your project to Pydantic v2, deploy your app to Render, and configure a PostgreSQL database. Additionally, the module covers integrating Sentry for error tracking and setting up GitHub Actions for continuous integration, ensuring a streamlined deployment and management process.

Taught by

Packt - Course Instructors

Reviews

4.4 rating at Coursera based on 21 ratings

Start your review of Mastering REST APIs with FastAPI

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.