inflearn logo

Mastering FastAPI Backend Development from Start to Finish - Pydantic v2, OAuth 2.0, SQLAlchemy

This course consists of 41 lessons and approximately 22 hours of training on designing and implementing backend APIs with FastAPI. FastAPI is a framework that is easy to get started with. Skim the documentation, write a few lines, and your API is up and running. The problem comes afterward. If you don’t know how a request travels to reach a function parameter, when dependencies are cleaned up, or where exceptions are caught, you can quickly get stuck as soon as things become even slightly more complex. This course spends time tracing how things work internally. We begin with the development environment. You’ll learn both conda and venv, send requests using the VS Code REST Client and Swagger UI, and become familiar with the structure of HTTP requests and responses. Next, we cover the difference between path parameters and query parameters, explaining why 422 errors occur in connection with type checking. Pydantic is the area explored most deeply in this course. After covering everything from scalar types to dates, UUIDs, Decimal, Enum, and Literal, we move on to BaseModel. We use Field() to define constraints, validate single and multiple fields with @field_validator, and examine the differences between the before and after behaviors of @model_validator. Since the course is based on Pydantic v2, you can apply the latest syntax directly in real-world projects. The middle section focuses on structure and dependency injection. We cover how to split files using APIRouter, how to use functions and classes as dependencies, Sub-dependencies, and decorator-level dependencies in sequence. Four lessons are dedicated to yield. We delve into how generators work, how exceptions are passed back up the call stack with raise, and how exceptions can be injected at the yield point using throw(). Understanding how resource cleanup works in dependencies that include yield makes DB session management much clearer. The latter part covers authentication and databases. We organize the concepts of OAuth 2.0 and its four Grant Types, then implement JWT issuance and verification, the internal execution logic of OAuth2PasswordBearer, and authorization control using Security() and scopes. We then configure Google, Kakao, and Naver clients ourselves and add social login using the Authorization Code Grant flow. Finally, we cover the SQLAlchemy ORM, including the URL structure of create_engine, the roles of the Dialect and DBAPI, transactions, sessions, and model and table creation. This course is suitable for anyone who wants to understand not only "working code" but also "why it works that way.&quot

1 learners are taking this course

Level Basic

Course period Unlimited

FastAPI
FastAPI
Python
Python
REST API
REST API
pydantic
pydantic
SQLAlchemy
SQLAlchemy
FastAPI
FastAPI
Python
Python
REST API
REST API
pydantic
pydantic
SQLAlchemy
SQLAlchemy

What you will gain after the course

  • Development Environment Setup - Create a virtual environment with conda and venv, then install and run FastAPI and uvicorn.

  • Pydantic v2 Types and Validation - You can use various types such as scalars, dates, UUIDs, and Enums, and validate and convert data with BaseModel.

  • Response validation and routing structure - You can validate responses with `response_model` and manage path operations by file using `APIRouter`.

  • yield Dependencies and Exception Handling - Understand how generators work and implement resource cleanup and exception handling in dependencies that include yield.

  • OAuth 2.0 and Authorization Control - Distinguish between OAuth 2.0 Grant Types and implement fine-grained authorization control with Security() and scopes.

  • Using SQLAlchemy ORM - configure create_engine and sessions, define models to create tables, and control transactions.

  • Path Operation and Parameter Handling - Understand the differences between path parameters and query parameters, and implement required, optional, and repeated parameters.

  • Using Field and Validators - You can specify conditions with Field() and implement detailed validation logic with @field_validator and @model_validator.

  • Dependency injection design - Functions and classes can be used as dependencies, and common logic can be reused through sub-dependencies and decorator-level dependencies.

  • JWT Authentication Implementation - Understand the JWT structure and implement token issuance and verification, as well as user authentication using Depends().

  • Social login integration - Configure Google, Kakao, and Naver clients and implement social login using the Authorization Code Grant flow.

Do you want to start backend development with Python? Or are you using FastAPI but finding data validation, dependency injection, authentication, and database integration difficult?

In this course, you will learn step by step, from the basics of REST API development using FastAPI to the essential skills needed in practice.

From setting up the development environment to handling path and query parameters, validating data with Pydantic v2, structuring projects with APIRouter, and working with dependency injection and exception handling, you’ll learn step by step. You’ll also practice authentication and authorization using JWT and OAuth 2.0, social login with Google, Kakao, and Naver, and database integration through the SQLAlchemy ORM.

The goal of this course is not merely to follow along by writing code, but to understand how request data is processed, how dependencies are executed and cleaned up, and how exceptions are propagated.

Through this course, you can develop the following skills.

  • Designing and Implementing REST APIs with FastAPI

  • Data validation and transformation using Pydantic

  • Designing an easy-to-maintain API project structure

  • Implementing dependency injection and exception handling

  • JWT authentication and OAuth 2.0–based authorization management

  • Social login integration

  • Database modeling and transaction management using SQLAlchemy

These technologies can be used for web service development, backend system construction, AI model API serving, data service development, and a wide range of Python-based applications.

If you know the basic syntax of Python, you can start learning even without backend development experience. Through approximately 22 hours of lectures and hands-on materials, systematically learn everything from the fundamentals to the core concepts.

The goal of this course is to understand how FastAPI works and develop the backend skills needed to apply it to real-world projects.

What You’ll Learn

Core Keywords (Core Keywords)

In this course, you will learn the core concepts and practical skills of backend development using FastAPI step by step.

1. FastAPI and REST API Development

  • Installing FastAPI and Uvicorn and Setting Up the Development Environment

  • Path Operations and HTTP Request Handling

  • Using Path Parameters and Query Parameters

  • REST API Design and Response Handling

2. Pydantic v2 and Data Validation

  • Defining Data Models Using BaseModel

  • Python Type Hints and Data Type Conversion

  • Configuring input value constraints using Field()

  • Data validation using field_validator and model_validator

  • Response data validation using response_model

3. API Structuring and Dependency Injection

  • Structuring Routes with APIRouter

  • Function- and class-based dependency injection

  • Sub-dependencies and Reusing Common Logic

  • Resource Management Using `yield`

  • Principles of Exception Propagation and Exception Handling

4. JWT Authentication and OAuth 2.0

  • Structure, issuance, and validation of JWT tokens

  • Using Bearer Tokens and OAuth2PasswordBearer

  • User Authentication and Authorization Management

  • Access control using Security() and scopes

  • Understanding OAuth 2.0 Grant Types

5. Implementing Social Login

  • Google, Kakao, and Naver Developer Client Configuration

  • Understanding the Authorization Code Grant Flow

  • Login integration using external authentication services

6. SQLAlchemy ORM and Databases

  • Connecting to a database using create_engine

  • Understanding the Roles of Dialect and DBAPI

  • Defining ORM Models and Creating Tables

  • Database Session Management

  • SQL execution and transaction control

Based on these core keywords, you will learn technologies applicable to various fields, including web backend development, REST API development, user authentication and authorization management, database integration, and serving AI and machine learning models through APIs.

The course is designed for learners familiar with basic Python syntax and systematically covers everything from creating basic APIs to essential backend functionalities needed in practice.

Before You Enroll

Prerequisites & Course Information (Prerequisites & Notices)

1. Prerequisites and Preparation

This course is intended for learners who are familiar with Python’s basic syntax. No backend development experience is required, but understanding fundamental Python concepts such as functions, classes, and decorators will help you get the most out of the course.

  • Understanding of Python fundamentals

  • Basic knowledge of type hints (recommended)

  • VS Code or your preferred code editor

  • Windows environment and PowerShell usage recommended

  • Basic knowledge of HTTP and REST APIs (related concepts are explained in the course)

  • Basic knowledge of SQL SELECT and INSERT statements

  • Google, Kakao, and Naver developer accounts (required for social login practice)

2. Course Videos and Learning Materials

This course consists of approximately 22 hours of video lectures and provides PDF materials and Python practice code files (.py, .ipynb, .http) for each lesson.

For effective learning, we recommend the following approach.

  • Write and run the code yourself while watching the lectures.

  • At the end of each section, apply what you’ve learned to a small API project.

  • Use Swagger UI or a REST Client to test requests and responses.

  • If an error occurs, make a habit of checking the error message and analyzing its cause.

  • Practice core concepts such as JWT authentication, dependency injection, and database integration repeatedly.

The specific technical specifications for video and audio are not provided separately. For smooth learning, prepare a stable internet connection and a development environment capable of running code.

3. Questions and Learning Support

If you encounter concepts that are difficult to understand or errors during hands-on exercises, you can ask questions using the question and discussion features provided by the course platform. When asking a question, including the error message, relevant code, expected result, and actual result will help clarify the issue.

4. Course Update Information

Related technologies such as FastAPI, Pydantic, and SQLAlchemy may continue to evolve. Since there may be differences in syntax or behavior between the versions specified in the course and the latest versions, it is recommended that you also refer to the official documentation.

There is no separate confirmed schedule for future updates to the course. When learning about the latest features or changes, check the version and compatibility of the libraries you use.

Recommended for
these people

Who is this course right for?

  • A developer who knows how to use Python but is new to backend development

  • Those moving to FastAPI after using Flask or Django

  • FastAPI users who write code by following the documentation but feel frustrated because the internal workings are unclear

  • Developers of domestic services who need to directly integrate Kakao and Naver social logins

  • For those who want to learn JWT and OAuth 2.0, from the concepts to implementation.

  • Data and ML engineers who need backend fundamentals to serve AI models via APIs

  • Job seekers preparing for employment who need a REST API project to add to their portfolio

Need to know before starting?

  • Basic Python syntax (understanding functions, classes, and decorators)

  • It will be easier if you have experience with type hints.

  • We will proceed based on the Windows environment (covering PowerShell settings).

  • VS Code or the code editor you use

  • Basic concepts of HTTP and REST (explained again in the lecture)

  • Google, Kakao, and Naver developer accounts (required for practicing social login, all free)

  • Basic database knowledge (SELECT and INSERT are sufficient)

  • Lecture materials PDF files and practice code files (.py, .ipynb, .http) are provided for each session.

Hello
This is it learner

IT training programs led by hands-on experts and professional instructors in various IT fields, offering practical, hands-on courses in programming, software development, data analysis, artificial intelligence, networking, information technology, and more. Through educational content that reflects the latest IT technologies and industry trends, these programs help learners acquire both theoretical knowledge and practical skills while adapting to the rapidly changing IT environment.

More

Curriculum

All

41 lectures ∙ (21hr 52min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Please write a valuable review that helps everyone!

it learner's other courses

Check out other courses by the instructor!

Similar courses

Explore other courses in the same field!

Limited time deal

$55,170.00

14%

$49.50