Python Web Development with FastAPI
Build modern, type-safe web APIs with FastAPI, Pydantic validation, SQLAlchemy databases, and JWT authentication.
View badge details
About This Course
Course Curriculum
14 Lessons
FastAPI Basics Routes and Responses
FastAPI Basics - Lab Exercises
What FastAPI is (ASGI, auto-docs, type hints), first endpoint with @app.get, HTTP methods (GET/POST/PUT/DELETE), response models with Pydantic, auto-docs at /docs (Swagger UI) and /redoc
Request Validation with Pydantic
Pydantic Validation - Lab Exercises
Pydantic BaseModel for request bodies, field validation (min_length/max_length/ge/le/regex), custom validators (@field_validator/@model_validator), separate input/output models, validation error formatting
Path Parameters Query Params and Headers
Parameters and Headers - Lab Exercises
Path parameters with type coercion, query parameters with defaults and Optional, Header() dependency, Depends() basics for shared validation, pagination pattern (skip/limit with total count)
Database Integration with SQLAlchemy
Database Integration - Lab Exercises
SQLAlchemy ORM (engine/session/declarative base), table models with Column types, session management with yield dependency, CRUD functions (add/query/commit/delete), SQLite for development
CRUD Operations and Error Handling
CRUD Operations - Lab Exercises
Full CRUD (create/read single+list/update PUT+PATCH/delete), HTTP status codes (201/204/404/409), HTTPException, custom exception handlers, partial updates with exclude_unset
Authentication and Middleware
Authentication - Lab Exercises
API key auth with headers and Depends, OAuth2 password flow with OAuth2PasswordBearer, JWT tokens (structure/creation/verification), middleware for request logging and CORS, role-based access
Capstone Briefing Package Tracking API
Capstone Package Tracking API
Capstone building complete SwiftRoute API: Pydantic models for Shipment/Customer/TrackingEvent, SQLAlchemy with relationships, full CRUD with pagination, JWT auth, request logging middleware, structured error responses