
Build a User Profile Page using FastAPI + Next.js! | Flight Booking Engine Day 35
Nehemiah Kamolu
Want to create a FastAPI app that uses SQLModel? It’s not hard — but there are a lot of moving parts to keep track of. In this full 30-minute tutorial, I walk you through building a simple FastAPI application that lets you create and retrieve blog posts using SQLModel and SQLite. Along the way, you’ll learn how to: • Use uv to set up your project and dependencies • Define SQLModel classes that become real database tables • Connect FastAPI endpoints to database operations • Handle requests and responses with Pydantic models • Debug common errors (yes, I left one in on purpose!) If you’re new to FastAPI, SQLModel, or modern Python web development, this video will give you a complete, realistic walkthrough — including setup, mistakes, and fixes. 👉 Subscribe for more upcoming FastAPI deep dives and Python training content. 00:00 Introduction — What we’ll build with FastAPI and SQLModel 00:33 Setting up a new project with uv 01:25 Installing FastAPI and SQLModel 02:20 What is an ORM? (and why SQLModel matters) 03:13 Creating a FastAPI app in main.py 04:44 Understanding routes and REST in FastAPI 05:22 Defining the BlogPost model with SQLModel 06:44 How Python classes become database tables 08:12 Adding fields and type hints (title, text, date) 09:24 Using default_factory for automatic timestamps 10:17 Setting up the primary key field (id) 11:13 Connecting to SQLite and creating an engine 12:35 Creating database tables on startup 13:31 FastAPI startup events and initialization logic 14:27 Enabling SQL echo logging for visibility 15:01 Defining a POST endpoint to create blog posts 16:01 Opening a database session and committing data 17:27 Running the app — first bug and live debugging 18:59 Fixing the missing “Optional” import 21:06 FastAPI auto-reloads and table creation confirmed 22:29 Testing POST requests in the FastAPI docs 23:32 Fixing “engine” vs “session” bug 24:01 Creating blog posts successfully 24:56 Defining a GET endpoint to retrieve all posts 25:55 Running queries with select() and exec() 26:58 Testing GET endpoint — retrieve all blog posts 27:58 Defining a GET endpoint for a single post (by ID) 28:54 Handling 404 errors gracefully 29:20 Testing the new endpoint — working and not found cases 29:55 Wrap-up — CRUD recap and next steps with FastAPI