
In this series of lectures, we'll be learning how to build a full-featured web application from the ground up using the FastAPI framework in Python. We'll build both a JSON API for programmatic access and HTML pages for users to browse in the browser. Throughout the series, we'll set up a database with SQLAlchemy, create Pydantic models for data validation, and implement complete CRUD operations. We'll add user registration and login with secure password hashing and JWT tokens, handle file uploads for profile pictures, use background tasks for sending emails, and organize our code properly with routers.
In this first lecture, we'll keep things simple. We'll install FastAPI, create a basic application, build a couple of routes that return JSON, run the app from the command line, and explore FastAPI's automatic documentation. Then we'll add some dummy data, create an API endpoint, and preview returning HTML responses.
In this lecture, we'll be learning how to use Jinja2 templates to create an HTML frontend for our API. Templates allow us to serve proper HTML pages to users while keeping our JSON endpoints intact for the backend API. We'll cover setting up Jinja2Templates, passing data to templates, using Jinja2 syntax for loops and conditionals, implementing template inheritance with a layout file, adding Bootstrap for styling, and configuring static files for CSS and images. By the end of this lecture, we'll have a nicely styled blog homepage that displays our posts.
In this lecture, we'll be learning how to use path parameters in FastAPI to create dynamic routes that can fetch specific resources from our data. We'll build both an API endpoint and a template page for viewing individual posts, add type validation with proper error handling using HTTPException, and create custom exception handlers that return JSON for API routes and styled HTML pages for browser routes. By the end, you'll have a solid understanding of how to work with path parameters, validate input automatically, and handle errors appropriately for different types of clients.
In this lecture, we'll be learning how to use Pydantic schemas to validate API requests and responses in FastAPI. We'll create a schemas file with request and response models, add field validations for things like minimum and maximum length, update our GET endpoints with response models, and create a POST endpoint to add new posts. Pydantic schemas define your API contract - what data goes in and what comes out - and FastAPI uses them for validation, serialization, and automatic documentation.
In this lecture, we'll be learning how to add a database to our FastAPI application using SQLAlchemy. Up until now, we've been storing our data in a Python list in memory, which resets every time the server restarts. We'll fix that by connecting to a real SQLite database and setting up SQLAlchemy models with relationships between users and posts. We'll also look at why we use separate SQLAlchemy models and Pydantic schemas, and how to use FastAPI's dependency injection to manage database sessions. By the end, you'll have a solid foundation for database-driven FastAPI applications that you can later scale up to Postgres or MySQL.
In this lecture, we'll be learning how to complete our CRUD operations in FastAPI by implementing PUT, PATCH, and DELETE endpoints. We'll cover the difference between PUT requests for full updates and PATCH requests for partial updates, add delete functionality for both posts and users, and configure cascade deletion so that when a user is deleted, all of their posts are automatically removed as well. By the end of this lecture, you'll have a fully functional API where you can Create, Read, Update, and Delete resources with proper validation and error handling.
In this lecture, we'll be learning about synchronous versus asynchronous in FastAPI. We'll cover when you should use async routes, when you should stick with synchronous routes, and then we'll convert our entire application from sync to async. This includes updating our database configuration to use async SQLAlchemy with aiosqlite, converting all of our routes to use async/await, handling eager loading for relationships, and updating our exception handlers. By the end of this lecture, you'll understand when async actually provides benefits and how to implement it correctly in your own FastAPI projects.
In this lecture, we'll be learning how to organize our FastAPI application using APIRouter. As our app has grown throughout this series, our main.py file has become long and difficult to maintain. We'll fix that by creating a routers directory and splitting our API routes into separate modules—one for users and one for posts. This is a common pattern in real-world FastAPI development and is similar to Blueprints if you're coming from Flask. By the end of this lecture, you'll know how to structure your FastAPI projects for better maintainability and scalability.
In this lecture, we'll be adding interactive frontend forms that connect to our FastAPI backend. Up until now, our web pages have been read-only, but we'll change that by using JavaScript and the Fetch API to create, edit, and delete posts directly from the browser. We'll use Bootstrap modals for our forms and feedback messages, keeping users on the current page instead of navigating them away. This lecture focuses on the API interaction itself and how the frontend sends data to our endpoints and handles responses.
In this lecture, we'll be learning how to add authentication to our FastAPI application. We'll implement user registration with secure password hashing using Argon2, build a login system using JWT tokens, and manage configuration with pydantic-settings. We'll also create registration and login pages, set up an auth.js module for managing client-side authentication state, and update the navbar to reflect whether a user is logged in or out. This lecture sets up the foundation for route protection and authorization, which we'll implement in the next lecture.
In this lecture, we'll be learning how to protect our FastAPI routes with proper authorization. We'll build a reusable get_current_user dependency that validates tokens and returns the authenticated user, remove the hardcoded user_id from our schemas and frontend, add ownership checks so users can only edit and delete their own content, and build an Account page for profile management. By the end of this lecture, our application will have a complete authorization layer on top of the authentication system we built in the previous lecture.
In this lecture, we'll be learning how to handle file uploads in FastAPI using UploadFile. We'll allow users to upload profile pictures by building an image processing utility with Pillow, adding proper validation for file type and size, and saving processed images to disk. We'll also cover important concepts like using run_in_threadpool to handle CPU-bound work in async endpoints, generating secure filenames with UUID, and sending files from the frontend using FormData. By the end of this lecture, users will be able to upload, preview, and display profile pictures across the application.
In this lecture, we'll be learning how to add pagination to our FastAPI application. Right now, our app returns all posts at once, which doesn't scale well as data grows. We'll fix that by adding skip and limit query parameters to our API, using SQLAlchemy's offset and limit for efficient database queries, creating a paginated response schema with metadata like total count and whether more data is available, and wiring up a Load More button on the frontend to fetch additional pages from our API. This is an industry-standard pattern you'll encounter on nearly any list endpoint in a real-world API.
In this lecture, we'll be implementing a complete password reset flow in our FastAPI application. We'll learn how to send emails asynchronously using aiosmtplib, use FastAPI's BackgroundTasks for non-blocking operations, and create secure reset tokens following security best practices. We'll build out the full flow from requesting a reset, to receiving an email, to setting a new password. We'll also complete the Account page so logged-in users can change their password directly.
In this lecture, we'll be making our database setup production-ready by moving from SQLite to PostgreSQL and introducing Alembic for database migrations. We'll cover how to install and configure PostgreSQL locally, how to replace SQLite and create_all with a proper migration workflow, how to set up Alembic for managing schema changes, and how to generate and apply migrations so that we never have to delete and recreate our database again. By the end of this lecture, you'll have a solid workflow for updating your database structure as your application evolves.
In this lecture, we'll be learning how to make our file storage production-ready by moving uploaded images from local disk into AWS S3. We'll walk through creating an S3 bucket, configuring the bucket policy and IAM permissions, and integrating boto3 into our FastAPI application. We'll also refactor our image processing to separate it from the storage layer and handle boto3's blocking calls properly in our async app. By the end of the lecture, you'll have a production-ready file storage setup that can scale beyond a single server.
In this lecture, we will learn how to test our FastAPI application using Pytest, HTTPX's AsyncClient, and mocking tools like Moto. We'll start by setting up our test structure and fixtures in conftest.py, including a transactional rollback pattern for fast and isolated database tests. From there, we'll write tests for our API routes covering authentication, CRUD operations, file uploads, ownership checks, and background tasks. We'll also learn how to mock external services like AWS S3 and email sending, so our tests don't depend on real infrastructure. By the end of this lecture, you'll have a solid set of real-world testing patterns that you can apply to your own FastAPI projects.
In this lecture, we'll be learning how to deploy our FastAPI application to a VPS (Virtual Private Server) so that it's live and accessible on the internet. We'll walk through the entire process, starting with a fresh Ubuntu server and hardening it with SSH key authentication, a firewall, and brute force protection. From there, we'll set up Nginx as a reverse proxy, enable HTTPS with a free SSL certificate from Let's Encrypt, point a custom domain to our application, and use systemd to manage the app as a service so it starts on boot and restarts automatically if it crashes. By the end of this lecture, you'll have a secure, production-ready FastAPI deployment with a real domain name.
In this lecture, we'll be learning how to deploy our FastAPI application using Docker and Google Cloud Run. We'll containerize our app by writing a multi-stage Dockerfile, set up a serverless PostgreSQL database with Neon, deploy our container to Cloud Run, and configure a custom domain with HTTPS. We'll also add security headers to our application through middleware. This is a different approach from the VPS deployment in the previous lecture, where instead of managing our own server, Google handles the infrastructure for us and our app can scale to zero when nobody's using it.
In this course, we'll be learning how to build a full-featured web application from the ground up using the FastAPI framework in Python. It covers everything from creating your first route all the way through deploying a production-ready application with a custom domain. We'll build both a JSON API for programmatic access and HTML pages that users can browse in the browser, so you'll come away knowing how to use FastAPI for either purpose.
Along the way, we'll set up a database with SQLAlchemy, write Pydantic models for request and response validation, and implement complete CRUD operations. We'll add user registration and login with secure password hashing and JWT authentication, protect routes by verifying the current user, and handle file uploads with image processing and validation. We'll convert our app to async, organize our code with routers, build out frontend forms that connect to the API with JavaScript, and add pagination, password reset flows with background email tasks, and database migrations with Alembic. Toward the end, we'll move from SQLite to PostgreSQL, move our file storage from local disk to AWS S3 with Boto3, write tests with Pytest, and finally deploy the application two different ways... first to a VPS with Nginx and SSL, and then with Docker to a serverless container platform.
Technologies covered:
FastAPI
Pydantic
SQLAlchemy
Jinja2 templates
JavaScript (Fetch API)
JWT authentication
Pillow (image processing)
Background tasks with aiosmtplib
PostgreSQL
Alembic (database migrations)
AWS S3 / Boto3
Pytest
Nginx and Let's Encrypt SSL
Docker (serverless deployment)
Whether you're new to FastAPI or have used it for small projects and want to see how a real production application comes together, this course will give you a solid foundation.