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