#100DaysOfWeb in Python Transcripts
Chapter: Day 52: Anvil - Full Stack Web Apps
Lecture: Anvil's building blocks
0:00 Before we start building our application with Anvil,
0:02 lets look at the building blocks, all the pieces,
0:04 the little Lego bricks that we have to put together
0:07 because they're really easy to fit together and use.
0:10 So, let's do a quick survey.
0:12 Probably the first thing you'll notice is forms.
0:14 And forms are the HTML pages and components.
0:17 You have a nice visual designer with a set of components
0:20 you can drag over and visually line up
0:22 and click on them and set their properties and so on.
0:24 So, that's really nice.
0:25 There's also a code behind thing that goes with them
0:28 that you can run some code as part of
0:30 interacting with the form.
0:33 Now, some code doesn't belong within the UI,
0:35 it belongs elsewhere.
0:36 Maybe it's shared across forms or it just doesn't really
0:39 belong there and so, that would be in
0:41 this client module section.
0:43 So here you can create these Python modules that you write
0:45 arbitrary Python code that can
0:47 be called from within the forms,
0:49 can interact with each other and so on.
0:50 So, it's kind of a nice way to separate stuff out there.
0:53 We'll also have server modules.
0:55 So, this client code in the form code behind
0:58 actually runs on the client side.
1:01 Think about that for a minute.
1:02 Python code running a client side.
1:04 That means in the browser, so it actually converts
1:08 Sometimes you need code to run on the server to interact
1:11 with your database in certain ways or to work with secrets,
1:14 or validate stuff that nobody can mess with.
1:16 So, that's server modules.
1:17 And there's nice integration here.
1:19 And of course you need data, a database.
1:21 So there's this concept of data tables
1:23 which is really nice and easy and integrated.
1:26 On top of these four things we have services.
1:28 So, things like user management,
1:30 storing users with passwords
1:33 and registration and stuff like that.
1:35 Secrets like API keys you don't want to put in your code
1:37 but still make accessible to your web app.
1:39 And Google and Facebook APIs,
1:40 so if you want to get to say like Google Drive, for example.
1:43 Stripe if you want to accept payments.
1:45 And finally, this thing called uplink.
1:47 Now, uplink, we talked about a thing called uplink,
1:50 a Python package for services but this is not that.
1:53 Put these entirely out of your mind
1:55 they're totally unrelated.
1:56 This is just the same name they have here as the thing
1:59 that we played with earlier.
2:00 The idea is, if you would like your web application to reach
2:04 out and get inside some other thing and interact with it
2:09 you can do this thing called uplink.
2:10 Here's an example.
2:11 Suppose I have a Raspberry Pi that's running some
2:13 Python code that controls my house.
2:16 Inside that Raspberry Pi, I don't want to have a service that
2:19 things integrate with but I would, somehow, like my
2:23 web application to initiate a call into that Raspberry Pi.
2:27 Like, let's say to turn on the lights or
2:29 open the garage door by clicking a button on my web app.
2:32 Uplink would make that happen.
2:33 So, really, really cool.
2:34 We're not going to use it at all.
2:35 We're not going to use any of these services
2:37 for what we're doing
2:38 but we are going to work with the top four items for sure.