AI · AIC-08

Complete REST API Development with FastAPI

Complete REST API Development with FastAPI is a hands-on course in building a backend with FastAPI and uv, from endpoint design and PostgreSQL with SQLModel to JWT authentication, file uploads, a streaming AI endpoint, tests and Docker. It suits students, programming beginners and frontend developers moving into backend work, and you leave able to build your own REST API.

Updated
From 3,510 THB / person 3,900 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration12 hours · 2 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Today's apps and web sites talk to their back ends mainly through APIs, so building REST APIs has become a core skill for modern developers. FastAPI is a Python framework that is concise and fast, validates data automatically from type hints and generates API documentation instantly, which makes it suitable for beginners and a popular choice for APIs that connect to AI services.

This course takes learners who can write basic Python through building a complete backend with FastAPI. They start with the basics of HTTP and REST, set up the project with uv, receive and validate data with Pydantic and build CRUD endpoints, then connect PostgreSQL with SQLModel and Alembic. They go on to add login with OAuth2 and JWT, file uploads and an endpoint that calls an AI model and streams its answer, and finish by writing tests and running the whole system with Docker. (2 days, 6 hours per day, 12 hours in total, Beginner level.)

What you’ll gain

  • Understand how HTTP and REST APIs work and read results from status codes
  • Create a FastAPI project with uv and test it through Swagger UI
  • Receive and validate data with Pydantic and organise a project with APIRouter
  • Connect to PostgreSQL with SQLModel and manage table structure with Alembic
  • Build login with OAuth2 and JWT and set user permissions
  • Create an endpoint that calls an AI model and streams the response
  • Write tests with pytest and run the system with Docker Compose

Who this course is for

  • Students and programming beginners who want to build a backend
  • Frontend developers who want to move into backend and API work
  • Developers who want to switch careers to become backend developers
  • Anyone who wants to build an API for their own app or AI service

Prerequisites

  • Basic Python, including variables, functions and importing libraries
  • Able to use a terminal and VS Code
  • No prior API or web development experience needed
  • A laptop that can run Docker Desktop, with permission to install software

Curriculum

Course Details

This course is the 2026 edition of Complete REST API Development with Python FastAPI. It runs for 2 days, 6 hours per day (12 hours in total, 09:00-16:00), as lectures with labs. Beginner level. It keeps the original core of REST basics, CRUD, databases, JWT, file uploads, testing and Docker, but now connects to PostgreSQL 18 with SQLModel as the FastAPI documentation recommends, uses lifespan handlers instead of on_event, implements JWT with PyJWT

and pwdlib with Argon2, and adds a streaming AI endpoint with Server-Sent Events. The course does not use Django; learners who want the Django REST Framework should see Building REST APIs with Python, and those working with SQL Server should see FastAPI with MS SQL Server. The main tools are open source or free, and LLM APIs use the learner's own account. Learners take home a lab guide, source code and ready-to-use Docker files.

Day 1 REST API Basics, FastAPI and Databases

Section 1: Lab: API, HTTP and REST Basics

  • What an API is, and how requests and responses work
  • RESTful APIs with GET, POST, PUT, PATCH and DELETE
  • Common status codes and the JSON data format
  • Introducing FastAPI and its strengths compared with other frameworks
  • Lab: call real APIs with Bruno or Postman

Section 2: Lab: Starting a FastAPI Project with uv

  • Install uv and let it manage Python versions
  • Create a project and install fastapi[standard]
  • Run the server with the fastapi dev command
  • A first /hello endpoint and the automatic documentation at /docs
  • Lab: a first API tested through Swagger UI

Section 3: Receiving and Validating Data with Pydantic

  • Receive values from the path, query string and request body
  • Create Pydantic models and set constraints with Field
  • Define the response shape with response_model and status codes
  • Report errors with HTTPException
  • Lab: an API that validates data before saving it

Section 4: Lab: CRUD and Project Structure

  • In-memory CRUD with lists and dicts
  • Split files with APIRouter and group endpoints with tags
  • Dependency injection with Depends
  • Keep settings in environment variables
  • Lab: an in-memory CRUD product management system

Section 5: Lab: Databases with SQLModel

  • Run PostgreSQL 18 with Docker Compose
  • Create table models and data models with SQLModel
  • A session dependency and the app lifespan
  • Database CRUD with pagination
  • Lab: move the product system into PostgreSQL
Day 2 Security, AI Streaming and Deployment

Section 6: Migrations and Data Relationships

  • Manage table structure with Alembic
  • One-to-many relationships between users and products
  • Search, filter and sort data
  • Choosing def or async def for the job
  • Lab: user management (User CRUD) on the database

Section 7: Lab: Login with OAuth2 and JWT

  • Authentication and authorisation concepts
  • Hash passwords with pwdlib and Argon2
  • Issue and verify JWTs with PyJWT through OAuth2PasswordBearer
  • Get the current user with a dependency and set role-based permissions
  • Lab: a login system that protects the product endpoints

Section 8: File Uploads and Middleware

  • Receive files with UploadFile and check file type and size
  • Serve static files and product images
  • Background work with BackgroundTasks
  • Configure CORS so web pages can call the API
  • Lab: upload product images with user permission checks

Section 9: Lab: Adding AI to the API

  • Call an LLM API from an endpoint and keep the API key safe
  • Stream the response with Server-Sent Events
  • Handle timeouts and errors, and control costs
  • The option of a small local model instead of a cloud service
  • Lab: a product Q&A endpoint that answers piece by piece

Section 10: Workshop: Testing, Docker and Deployment

  • Write tests with pytest and TestClient
  • Build a Dockerfile that uses uv and run it with the database in Docker Compose
  • Run in production mode with fastapi run
  • Approaches to deploying on a cloud service with a free tier
  • Workshop: login, CRUD, uploads and AI together in one project

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

What is a REST API, and how is each HTTP method used?

A REST API serves data over HTTP by treating each kind of data as a resource with its own URL. GET reads data, POST creates new data, PUT replaces a whole resource, PATCH updates part of it and DELETE removes it. Results are reported with status codes such as 200 for success, 201 for created, 404 for not found and 422 for data that fails validation, which FastAPI returns automatically when input does not match the model.

How do I create a first endpoint with FastAPI and uv?

Create a project with uv init and install FastAPI with uv add "fastapi[standard]". In main.py, create app = FastAPI() and a function with a decorator such as @app.get("/hello") that returns a dict, then run uv run fastapi dev. Open /hello in the browser to see the result, and /docs to test it in the Swagger UI that FastAPI generates for you.

How does login with JWT work?

The user sends a username and password to a token endpoint. The system checks the password against the stored hash, using pwdlib with Argon2 in this course, and if it matches it issues a JWT with PyJWT containing the user and an expiry time. The user attaches the token as a Bearer value in the Authorization header on each request, and FastAPI verifies it through a dependency before allowing access to protected endpoints.

Who is the Complete REST API Development with FastAPI course for, and what should I know beforehand?

It suits students and programming beginners, frontend developers who want to do backend work, developers switching to backend roles and anyone who wants to build an API for their own app or AI service. You should be able to write basic Python, including variables, functions and importing libraries, and use a terminal and VS Code. No prior API or web development experience is needed.

What will I be able to do after the Complete REST API Development with FastAPI course?

You will be able to build your own REST API with FastAPI, from endpoint design and Pydantic validation to PostgreSQL with SQLModel and Alembic, JWT login, file uploads, a streaming AI endpoint, tests and running the system with Docker. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

What software do I need for this FastAPI course?

Bring a laptop with uv (which can install Python 3.13 or later), VS Code and Docker Desktop for running PostgreSQL, plus Bruno or Postman for testing the API. These tools are free. The AI lab uses an LLM API from your own account, which may be charged by usage, or a small model running on your own machine instead.

Related articles

Articles are published in Thai.