← 04 · Backend overview
PART IV · BACKEND

FastAPI

A Python web framework commonly used to build APIs.

01

What is it?

FastAPI is a Python framework for building HTTP APIs.

It provides tools for defining routes, receiving requests, validating data, and returning responses.

Simple Definition:
FastAPI helps developers build APIs with Python.

02

Think of it like...

Python is the language.

FastAPI provides the API-building structure.

Python→FastAPI→API Routes→Backend
03

What does it do?

FastAPI can help:

Define Routes

Handle HTTP Methods

Read Parameters

Validate Data

Return JSON Responses

Generate API Documentation

04

Where is it used?

FastAPI is used for:

REST APIs

Backend Services

Microservices

Internal APIs

AI Services

System Integrations

05

Example

from fastapi import FastAPI

app = FastAPI()

@app.get("/orders/{order_id}")
def get_order(order_id: int):
    return {"id": order_id}

The route connects an HTTP GET request with a Python function.

06

How it connects

HTTP Request→FastAPI→Route→Python Function→Business Logic→Response
07

Do Not Confuse

FastAPI

A framework used to build APIs.

API

The interface exposed to other systems.

FastAPI ≠ API

08

Topic Glossary

ENGLISH TERM中文SIMPLE ENGLISH中文小白理解
FastAPIFastAPIA Python framework used to build HTTP APIs.用 Python 快速开发 HTTP API 的后端框架。
API应用程序接口An interface used by software systems to communicate.不同软件系统之间进行通信的接口。
Route路由A mapping between a URL and backend code.把 URL 请求对应到某段后端处理代码的规则。
Decorator装饰器Python syntax used by FastAPI to attach behavior to functions.FastAPI 常用来把 HTTP 路由绑定到 Python 函数的语法形式。
Request Validation请求校验Checking incoming data before processing it.后端处理请求前检查传入数据是否合法。
OpenAPIOpenAPI 规范A standard format used to describe APIs.FastAPI 可以自动生成的 API 标准描述格式。
09

What to Remember

FastAPI is a Python framework.

It connects HTTP routes to Python functions.

It can validate request data and generate API documentation.

↑