Full Web Apps with FastAPI Transcripts
Chapter: Welcome to the course
Lecture: Big ideas covered in the course
0:00 Briefly, let's just dive into a couple of ideas,
0:02 The big ideas that we're going to cover in this course you get a sense of
0:05 what you're gonna learn throughout the whole adventure that we're about to embark upon.
0:10 We're going to start by building our first FastAPI site and at this level
0:15 it's just gonna actually be an API that exchanges JSON with some data that
0:19 we compute in our API endpoint.
0:21 So we'll see what it takes to build from scratch from,
0:24 you know, empty Python file till we get something running on the Internet,
0:28 at least running on our local server that theoretically could be on the Internet that we can
0:31 interact with. So we're gonna start out and see what is the essence.
0:35 What are the few moving parts that we must have for a FastAPI site
0:40 and then we're going to move on to the goal of this course serving HTML.
0:45 Take this cool API now,
0:46 how do we also let it handle the HTML, the web application
0:51 the user interactive browser side of what you also need to build?
0:54 Sure, you could build some APIs and those are great.
0:57 But in addition to that, how do you also build your web application?
1:00 So that's what this next section is gonna be all about.
1:03 We're going to see how we can return first of all,
1:05 basic HTML and then how we can use a template language like Jinja or Chameleon to create
1:11 these dynamic templates that actually generate the HTML.
1:15 We're going to talk about this idea of view models.
1:17 If you're familiar with FastAPI,
1:18 You may have heard of Pydantic this are
1:21 really cool ways to exchange and validate data at the API level.
1:27 They're great, and I absolutely adore that technology,
1:31 but it doesn't make sense for working with HTML.
1:35 As you'll see, when I talk about why that's the case.
1:38 But it turns out that a similar but not exactly the same design pattern is what's
1:42 gonna make the most sense here.
1:43 So I wanna see about using that to correctly factor HTML and the validation and data
1:48 exchange and then the actual doing the logic part of our web app.
1:53 We're going to work with the database,
1:55 of course. So we're gonna use SQLAlchemy to map Python classes to the database
1:59 and we're gonna do this in two passes.
2:01 First, we're going to use the traditional SQLAlchemy,
2:04 API, which does not support async and await.
2:07 But there's a new API.
2:09 That's coming, starting in 1.4 and then heading towards version 2 of SQLAlchemy.
2:14 That absolutely supports async and await,
2:16 which is going to be a really important aspect of working with FastAPI
2:20 and making it fast. So we don't do that in two passes,
2:23 start out with the synchronous version that you're probably familiar with and then upgrade it to this
2:27 new async version. And once we have an async database in place,
2:31 we can now convert our entire web application to run fully asynchronously.
2:36 This means many, many, many times more scalability for the same hardware.
2:41 We don't have to write as complicated software with different tiers and caching and all these
2:46 different things. Our application is gonna be super fast right out of the gate,
2:50 and finally, once we get this cool app built and running,
2:53 we're going to put it out on the Internet.
2:55 We're gonna actually go out, create an ubuntu server and deploy this to the
2:59 Internet where we'll publish it, people can interact with the browser,
3:03 even talk to it over SSL.
3:05 These are the major ideas that we're going to cover in this course.
3:09 And when we get through all of them, were gonna have a fantastic web application
3:13 that you can use as an example for whatever it is you want to build.