over 5 years ago Syntax Podcast
Serverless, Deno and TypeScript with Brian Leroux
- 00:03 Intro to serverless with guest Brian Leroux
- 00:09 Overview of Brian's background in mobile and serverless
- 00:39 Sponsor - Sentry
- 01:09 Brief intro of Brian and his interest in Syntax podcast
- 01:34 Discussing Caesar cocktails
- 02:16 Brian's background in mobile and shift to serverless
- 04:05 Brian's work on Architect and Begin
- 06:18 Overview of serverless - outsourcing infrastructure
- 07:51 Serverless characteristics - on demand, stateless
- 08:47 Discussion on serverless misconceptions
- 10:23 Serverless as an addition, not replacement, for existing architectures
- 11:04 Using serverless with legacy apps through proxies and incrementally moving functionality
- 12:42 Good serverless use cases like scheduled tasks and PDF generation
- 14:43 Challenges of statelessness in serverless functions
- 16:27 Explanation of cold starts in serverless
- 18:11 Serverless function languages like Rust and Go
- 19:17 Discussion on Aleph.js for serverless Next.js apps
- 20:39 Deno optimized for cold starts unlike Node
- 21:12 Extremely low cost of serverless functions
- 23:13 AWS as the stable choice for serverless infrastructure
- 24:20 Excitement about Azure's potential in serverless space
- 25:23 Architect for infrastructure as code in serverless
- 26:15 Begin for easy cloud deployment leveraging Architect
- 27:24 Begin's local dev experience for serverless
- 28:32 Other serverless services like queues and scheduled functions
- 29:04 Leveraging ephemeral storage like Redis in serverless
- 31:30 Benefits of TypeScript types
- 32:39 Running TypeScript/type checks at runtime
- 34:25 Future of TypeScript if types added to JavaScript
- 35:51 Deno improving cold start times unlike Node
- 36:48 Using Deno and Node together in serverless architectures
- 37:16 Deno reimplementing Node APIs as standard library
- 38:41 Deno security model benefits
- 39:04 Sponsor - Netlify
- 40:35 Merits of server-rendered websites without JavaScript
- 43:03 Serverless functions enable server-rendered content
- 44:46 New frameworks focused on server rendering like Remix
- 45:01 Sharing code between serverless functions
- 46:08 Using layers for binaries in serverless functions
- 48:04 Amazing capabilities unlocked by serverless
- 49:18 Example of highly scalable serverless app
- 51:17 Smearing apps across accounts to avoid noisy neighbors
- 52:19 Wrapping up the interview with Brian
- 52:47 Brian's sick pick - Begin fingerprinting
- 54:13 Wes's sick pick - magnetic grabber tool
- 55:28 Scott's sick pick - Blink-182 covers album
- 56:46 Brian plugs Begin's new proxy feature
- 58:00 Discussion on Begin co-founder Ryan Block
- 58:54 Wes plugs his courses
- 59:02 Scott plugs his courses
Future of TypeScript if types added to JavaScript
Scott Tolinski
there's sort of, I don't know, interest there all around. You know, is Microsoft become the the owners of JavaScript?
Guest 3
what how this thing could evolve, and and I think it's also driving Node to be better. So This is win all the way around.
Guest 3
I think, a bummer to use. It can be fun, it can be mobile,
Guest 3
Node is still great and
Scott Tolinski
Yes.
Guest 3
like, that this could be a good thing. And where this becomes problematic is what happens to TypeScript.
Scott Tolinski
The the de facto JavaScript, or is this kind of happening if They're owning in control of the basics. Log this that thing. We cut to 10 years later. Microsoft script.
Scott Tolinski
So are would you say that you're you're in on on on Deno, Dino,
Guest 3
my go to, like, you know, it's my right hand tool. But rid As an as a new contender, it answers a whole lot of really important questions,
Guest 3
you know, more V eight based, So Lambda has a few ways of extending itself. And the popular easy way is layers.
Scott Tolinski
Yes. Right. Yeah. Because, obviously, owned by Microsoft, and,
Guest 3
however however you say it? Yeah. I keep saying Deno because they were saying that, but now they're all saying Deno. I'm totally out of work. What can I do about this? So see myself. I'm like, Scott, we've been saying it wrong. We've been saying it wrong every episode that we've said it because we've said it,
Challenges of statelessness in serverless functions
Guest 3
other players,
Guest 3
I know of people that have bumped that limit up to 40 or 50,000.
Guest 3
And today, it's 15 minutes, and that number is not gonna get lower. And
Guest 3
So it's, it's get your own
Guest 3
And as there's more competitive pressure from Azure and is sweet.
Guest 3
and the cold start is gonna continue to drop to 0.
Guest 3
And they do stay warm as it were, so a container will get reused under the hood, or a VM will get reused, but rid Not, for the same execution. So like a brand new, Economically, there's It was fine. It's just that people got bored of of refreshing that page, so it was it was cool. But it was neat to see. Dynamo just, like, came up gracefully.
Wes Bos
Paradigm just keeps getting better, not worse. Yeah. Yeah. Can you tell us a little bit more about a cold start? Because that's something you hear against serverless haters. They'll say, rid I'd rather give me Kubernetes or something all day long, but the cold start kills me. Like, what is that?
Guest 3
Rid If you're building a web app, if you're building something that needs to do longer And so it's just it's ridiculous how cheap it is comparatively.
Guest 3
and then that scales up by default to a1000 on a on a stock Amazon account. But pump out iPhone apps, but I did.
Running TypeScript/type checks at runtime
Scott Tolinski
submissions of forms or whatever would be really nice because we're rewriting that code all the time anyways Yeah. Sometimes. So I think I'm candidate number 1 for the the the type of developer that went from being like, oh, TypeScript is too much work for me rid. To being, I need types everywhere across the board now.
Scott Tolinski
like I have. We'll see that just how beneficial it is to have that stuff, and having it on runtime would be would be sweet.
Guest 3
I'm I can't imagine that there isn't more broad consensus, No reason why you can't bring any binary you want with you using LambdaLayers. So, and and the cost is also way, way, way, way cheaper.
Scott Tolinski
Like, our API is a GraphQL API that's fully typed. Everything is using, like, code gens to generate the types and types across the board. And
Guest 3
Yeah. And, like, Deno gets us a little bit closer. There's still kind of a little hidden build step in there, and they they've got some Reconciliation to do right now on the TS config side. So when Deno initially launched, it was like, hey, use TypeScript, and we'll respect your TS config. And So the solution is write small functions.
Guest 3
there's there's just, like, slightly more I want out of this. Rid And Mhmm. And we don't get that with TypeScript yet. So, yeah, I'm assuming, and the compilation side of it was actually another big part of the problem re We were running a hosted service where you could upload code into the cloud, and it would Well, we want everything to be, one answer, So the on demand model is Rid. It needs a veneer that's friendly for folks to approach it and, figure out how to reason about it. And, you know, it's our belief that that audience rid Crows.
Guest 3
Improve the language. And Yeah.
Guest 3
You know, being able to
Guest 3
And more than 2 people are using it at once now, and they've discovered that if they don't have the same TS config, things could be bad. Ready. So
Scott Tolinski
badly now that I I've I've learned rid Just how awesome they are, as a a non computer science person overall. I I I just think more developers as they Get more into TypeScript
Scott Tolinski
I want I want types straight up now in in JavaScript,
Guest 3
and it's good. But, like, yeah. Once you get to runtime,
Amazing capabilities unlocked by serverless
Guest 3
comes and you're like, damn, I wish Lambda could do that thing. Yeah.
Scott Tolinski
Yeah. That actually is is way more accessible than I was expecting. And and I think a lot of developers will,
Wes Bos
like, most web developers listening to this podcast that they were talking about
Wes Bos
the, like, having to manage a server And, you showed me some logs of, like, it didn't even sweat. We were watching
Wes Bos
probably don't have to care what Yamda is. Right? Like, rid In very, very few cases and that's beautiful because it takes
Wes Bos
is almost gone now.
Scott Tolinski
Even at one point, we had we had, like, considered rolling our own Cloudinary on Lambda, and rid Surprisingly super easy, but I just didn't have the bandwidth to do it. It's like Yeah.
Scott Tolinski
over time, start to to learn that there's some really neat stuff out there we can be doing.
Guest 3
We the other big part of this is determinism through Infra's code. A lot of the other providers just do not have these, rid Characteristics yet.
Scott Tolinski
can.
Guest 3
Wes, you you tried to no. You don't think you tried to do dos, you'd, like, did that image Amazon will continue to drop prices. So
Guest 3
the inevitable It's probably just a copy paste of the logic. You know, you're not limited by runtime. There's it forever, and then if the file changes, then we'll change the SHA which will invalidate the cache.
Wes's sick pick - magnetic grabber tool
Wes Bos
So I ordered this grabber tool, which is a bendy
Wes Bos
and these 4 little claws come out. And then it bends wherever you want. And re I think it's really popular in automotive. If you drop a bolt into your your engine, you need to be able to pull it out. And this thing is awesome. Like, I got all the stuff out, but, But, also, I was like I was talking to my wife. I was like, I'm glad we have this now. Like, this is definitely something I've needed in the past. And, it wasn't it was, like, I don't know, $15 or so. So
Wes Bos
another bizarre tool that I had to buy. My kids threw a bunch of stuff down our vent.
Wes Bos
And even a flashlight that was on got thrown down the vent.
Wes Bos
My kids throw stuff down all the time because there's re Huge place. And we're like, okay. We have to get this stuff out of here. Otherwise, it's gonna burn, and, like, it's a bunch of their toys that were kinda necessary.
Scott Tolinski
I have a a fun sick pick. Not,
Wes Bos
not super cheap, but definitely well worth having in your tool arsenal.
Wes Bos
Rid We have these, like, super
Wes Bos
rid. Has a little flashlight in it. And, basically, you just press the end,
Scott Tolinski
Sick.
Wes Bos
So I I was like, alright. Well, I I couldn't take the vent off because it has, like, a 100 years of paint rid Sealing it on.
Wes Bos
magnetic,
Brian's work on Architect and Begin
Scott Tolinski
Yeah. It it happens. Right? Code happen. And, like, that doesn't mean I'm never gonna try it again. But Begin was one of the ones that I I thought was, like,
Guest 3
now, Yeah. There's this sort of new world where our data is Lending in with our compute But but as a self interested web developer who doesn't have time for this, Like yeah. Right. Yeah. I'm just gonna jump off to Amazon every time.
Guest 3
co founder of a startup called begin.com, Your default
Guest 3
Co author a framework called Architect,
Guest 3
Yeah. We have a a belief that the developer experience can really be Kinda like a consumer product experience. It doesn't have to be, 15 plus years ago was pretty You can still modify and read the CloudFormation. It's totally accessible to you. Rid but we just make it easier and faster to generate that and run that locally.
Scott Tolinski
Yeah. Some people got really mad specifically when their product didn't work. Rid of I understand.
Guest 3
rid 14/2015. I was like, obviously. This is where this is all going. And sending emails.
Wes Bos
Rid I had those quirks. I don't know. Some people mad with those I made those before.
Scott Tolinski
the little details being, like, fantastically there and and, you know, lots of little joy moments. So, re Yeah. I'm really, really pumped with all the work you're doing over there at begin.
Guest 3
I just wanna like, what so I do not want that. Yeah.
Guest 3
and, it can be friendly.
Guest 3
And a lot of folks want to get on AWS. They want all these superpowers, but they don't want to deal with the whole AWS.
Guest 3
Rid You know, like if you Oh, yeah. Hop into the AWS console, it's it's No kidding. Meditating nightmare.
Scott Tolinski
just so buttoned up, in terms of, like,
Guest 3
fast tiny little functions that you deploy up into the cloud, and you don't think about runtime or anything like that. Helped Which is pretty good. You can do a lot of stuff with that. Most web apps respond within a few seconds, so it should be should be plenty to do what you need to do.
Guest 3
and the cloud kind of isn't any of those things yet.
Guest 3
And Except for instead of code dependencies, it's your cloud dependencies.
Brief intro of Brian and his interest in Syntax podcast
Wes Bos
Yeah. So that's why we have Brian on here. Hello, Brian. Thanks for coming on.
Wes Bos
one of my favorite podcasts. So rid Oh, awesome. It's funny because I initially found out about you, 840,000
Guest 3
Yeah. I'm stoked to be here. This is,
Scott Tolinski
it's like a bloody Mary, but with Oh. Oysters, rid I didn't know what this was until just now. I'm trying to figure out what Caesar's was. Oh. It it doesn't sound good,
Wes Bos
talk. You made Caesars as part of your talk. I think it was like a phone gap talk. Caesars are like this Canadian
Wes Bos
probably 10 years ago. I was watching a j JSConf
Deno security model benefits
Guest 3
I think we could end up seeing Node do some of that too, with time. Our sponsor today And so if you've got and wanted
Guest 3
So
Guest 3
that's just a handy capability for isolation.
Guest 3
especially in the enterprise, security is is key. And rid If your runtime can block you from reaching out to the Internet or whatever,
Guest 3
Rid This may not seem like that big of a deal, but it's a pretty big deal. And larger applications,
Explanation of cold starts in serverless
Scott Tolinski
What languages
Scott Tolinski
suitable because so there was, like it was briefly touched on there, but I I think this can even lead into some of the talk about, rid. The either higher complexity bits, the the the heavier bits, you're offloading them in chunks rather than making some sort of rid Grand migration all at once, and I think that's a a really comforting thing for a lot of people to know that it's not like picking up and moving your platform to serverless. It doesn't need to be like that or or should be like that. Well, I learned,
Scott Tolinski
Deno and in TypeScript here. So, like, if we're if we're writing serverless functions, would something like, let's say, Rust be appropriate for serverless functions?
Guest 3
But it matters now.
Guest 3
Keep them under 5 megs, and you will be sub rid second. Cold starting. We we typically see it begin cold starts between 70 and a 100 milliseconds now. So it's rid If you have a bigger function, it's gonna take longer to start.
Guest 3
is effectively unzipping the file system. Re And if it's got a big file system, it's gonna take longer.
Scott Tolinski
So you mentioned, briefly about, like, languages.
Scott Tolinski
are and aren't
Guest 3
And the cold start is pretty much directly correlated to that mounting. And Re These apps can't access each other, they're locked out by I'm But there could be a noisy neighbor effect, like if you had the West Boss effect. You wanna avoid that, but because it's all on demand, it seems to level out quite cleanly. And whenever we see these spikes, it's just a perfect opportunity to invite someone to Hey. Maybe you wanna join our paid tier and our lives continue. And Yeah.
Overview of serverless - outsourcing infrastructure
Guest 3
It's spread out, but in I believe the serverless community would generally agree with me that serverless is more of an idea about how you Approach your application architecture than it is a collection of logos that you need to have to implement against. And the first sort of principle of it is you want to outsource And, no problem, which is And layers let you, bring anything you want to the party that can compile into a Linux run time. So Rust is in play, Go is in play, .net, Java, you name it.
Guest 3
ideally on demand and stateless and fast as possible.
Guest 3
You want that to be
Wes Bos
you hear this word serverless or Lambda or, like, spin up rid and all that. And people don't necessarily especially if someone's, like, new to programming, they've not necessarily hit the issues that serverless
Wes Bos
solves, and they're just like, I don't get why I have to code my code differently for this to to work. Yeah. That's Super important point too. So That that sounds really neat. Rid I got a sick pick today.
Wes Bos
Alright. So for those who are new to serverless, can you give us, like, a quick rundown of, Like, what is it? What is serverless even? Like, I
Guest 3
If we're pre provisioning a whole bunch of rid we have a whole bunch of servers laying around doing nothing, waiting for a spike to happen. We're paying for stuff that is not adding value.
Guest 3
inefficiency.
Guest 3
You don't want to rack servers yourself.
Extremely low cost of serverless functions
Wes Bos
rid everything that you touch on sorta works together because you've got like, there's obviously Amazon, which is the big supplier. There's there's other ones out there, what, like Google rid Google Cloud does it. Azure does it. And that's the thing. I kinda don't believe that they do, but I'm deep in this. So they use the word serverless, but if we start measuring, rid on the criteria part out of the equation or writing it. Like, the worst thing in the world is re a NGINX config file. Right? Like, all that stuff is
Guest 3
shaky on them because, you know, it's a big scary company. But, they've they've got I guess the burden of proof would be on someone to say not Amazon. Like, why why would you why would you subject yourself to rid
Wes Bos
DigitalOcean Server and and whatnot, but that gets that gets really frustrating, especially if you just wanna, like, rid a bunch of projects. Like, I remember back in the day, you'd have a FTP folder, and I have a 100 little fun projects in there. And that that seems rid A lot harder nowadays, especially, like, you could there's a lot of free services out there that you can host them on, but who knows if that's gonna be around in in forever as well. Rid This is my backwards math on Amazon. I think some people get a bit,
Guest 3
that I'm thinking about about undifferentiated heavy lifting and Yeah. Not managing scale and on demand only. And, rid
Guest 3
So to me, it's they're they're going to be moving to some kind of recommended system probably that you can opt in and out of, where everyone will hopefully have the same TS Config. And, Yeah. So when the Lambda function gets invoked, it has To mount itself into a virtual disk of some kind. And that mounting process, but it is good.
Guest 3
easy to go there. I think as a company, I kinda understand. Like, if You're a Walmart or a retailer. Maybe you're Right. Picky about Amazon.
Wes Bos
That's that's a good point to sort of explain
Wes Bos
Ready. Amazing. Because, like, it's true. Like, I hear all the time that even in my own courses that we go to host a Node app, and it's 5, $10 a month. And if you've got rid. Like, you can run $1.5
Deno improving cold start times unlike Node
Guest 3
sometimes Python's better at some stuff than Ruby is, rid Or vice versa with Deno and You know, the way you would expect when you hit enter, that kind of thing. And you can absolutely code all this stuff, and then that gets bolted onto the runtime. So if you needed, rid For some reason to re Their whole thing is to render server render first and then progressive enhance at and They can leverage their existing investment, in these places. It's just the tools right now aren't quite thinking this way. They're they're sort of thinking like, rid I give there's a lot of Amazon out there, rid And we can't emulate all of that, but we can emulate the services that we kind of curate and pick. And the ones for web development in particular are interesting to me. So if you need to access like, I don't know, machine learning stuff or any other hardcore, like, analytics stuff, you can still do all that. But we make all the web app stuff really easy to do, and we make it, run all locally so that your development cadence isn't impacted by rid. Wait for a deploy to see what happens on the other side. Yeah. I think that's really been long long standing. One of the biggest gripes some people have with serverless is just rid Like, what the local dev picture looks like in in terms of, like, ease of use and and developer experience there. Because in my experience with it, it has it hasn't been always rid. Smoothest trying to test and use these functions locally on on various platforms. So it is interesting to see, that That specific aspect of it improve in various ways over time
Guest 3
Meanwhile, Node's not slowing down. They're gonna take a cue from this and improve their story. So
Guest 3
It's not a bolt on to kind of an older way of thinking. So I can imagine just like many of the other trends that we've seen, front end is gonna drive a ton of adoption to Deno because it re paves over a bunch of these ports with Node.
Guest 3
Fetch is built in. Node modules are important. Export are built in. Async await is a thing.
Guest 3
Node. Like Deno for a front end layer
Good serverless use cases like scheduled tasks and PDF generation
Scott Tolinski
You know, your skills will apply. And, also, what you were saying there reminds me a lot of how people are starting to use WASM in bits. Right? You're sort of offloading
Wes Bos
building Flash apps was not. Rid A lot of, that stuff came over into ES 6. And thank god it did because it's so much of a nicer language. Yeah. Yeah. So let let's talk about bit more about, like, if somebody is working on a traditional app right now, their skill rid That will move over. Like, if you're working on a Node app, you can just write JavaScript in a serverless function. Even, like, I know an architect, there is even, like, an express
Guest 3
Yeah. A lot of work that you didn't need to do.
Guest 3
It's completely stateless, Super easy to deploy these serverless applications to AWS.
Scott Tolinski
Yeah. Yeah. Yeah. We're, it's very interesting interesting time. I do wanna go back to the whole, like, Legacy technology bit just for, like, a a one second is just just to to add on to what you're saying is just that
Wes Bos
re function where you can just, like, literally take your express controllers and plop them in. And there's, like, a couple of things that are you kinda rid to, like, know about about serverless functions that are different than a traditional server. Like, what are there? There's, like, there's no memory,
Scott Tolinski
so many of the best Flash developers that I knew are now the best JavaScript developers that I know. I mean, if you're out there hearing a lot of these things and feeling overwhelmed about not knowing them, you you you have
Guest 3
JavaScript from ActionScript too. So it was def definitely where, You know, like writing JavaScript again, something also that's easy to do with cloud functions. With any provider, you can add a post handler.
Wes Bos
rid Really? Because, like, if it spins down, it's gone. Right? Like, that that computer is is now doing something else.
Sponsor - Netlify
Wes Bos
And what that seems to be
Wes Bos
rid and run some code at that point. So whether that's I think that would be kinda cool. With the Gatsby website, you could,
Wes Bos
at the edge, you can sort of intercept the request Man, it's funny that so that spike
Wes Bos
is another company that has Some serverless offerings as well, and that is Netlify. So you probably know Netlify from being able to host your static website, rid. But they also offer we've talked about the analytics and serverless functions and all that good stuff. And they just rolled out 2 things recently, which I thought were very, very interesting,
Wes Bos
syntax.
Wes Bos
you could personalize the website a little bit,
Wes Bos
at the edge by running a little bit of JavaScript. They have a whole bunch of different examples here, AB testing, aggregating API, localizing content.
Wes Bos
Rid. Pretty nifty. I'm excited to see them. That's, like, one thing that has been becoming popular in the last, Ready. It looks like they're they're migrating
Wes Bos
I don't know, a year or so that I've seen pop up is rid this ability to run code at the edge. So check it out. Netlify.comforward/
Wes Bos
Thanks so much to Netlify for sponsoring.
Wes Bos
Do you think websites should be able to work without JavaScript?
Wes Bos
is
AWS as the stable choice for serverless infrastructure
Guest 3
Azure, I'm excited about long run because they've got better distribution channels than AWS. Rid You got GitHub. You got NPM. You've got TypeScript. Visual Studio Code. Codespaces. So, like, that cloud's gonna be important whether we like it or not. Rid And then, you know, the US is important because heavy lifting to a third party vendor.
Guest 3
AWS and Azure.
Guest 3
they they are de facto at at the moment. Totally.
Guest 3
that can't interact with each other in any way whatsoever, and and that's all you want because you're starting from the the least privileged, most secure, most performant way to approach it. Yeah.
Guest 3
Case of Azure, they have a functions product, but you're still running instances of Kubernetes. And the functions are in a shared responsibility model. So they're all re lumped together in the same instance. In AWS land, these functions are really, completely isolated, separated things rid Basically, called Not really an issue anymore. I mean, not a human perceptible issue if you're really trying to count those milliseconds seconds, and you're doing a real time app. This might Yeah. Might not be perfect, but it's pretty close. Yeah. So older application architectures Really didn't contend with cold start, because they were all intended to run for a long time. So if you're running a JAR file, it didn't really matter that much if it took a minute to start up.
Brian's background in mobile and shift to serverless
Guest 3
Really? For years, we're like, why is this not built into Node? And the Node philosophy was to be this lightweight, small core where you would rid pose it with user land modules, It's so exciting. Yeah. Because it this stuff was pretty inaccessible before, but now it's, like, just at our fingertips.
Guest 3
and, the team that I was working with at the I'm called Nitobe.
Guest 3
You got brought up in the early web and there were blackberries everywhere and some of them could some of them could even talk To the web, like, they were the 1st thing that could do that, so that was, that was pretty pivotal, and it was very much into mobile, and, you know, iPhone happened, so that was kind of a big deal.
Guest 3
and that journey led me down doing the cloud thing enjoy a free tier of 1,000,000 executions.
Guest 3
Rid Yeah. Hit like, hit the web kinda like a meteor, you know, like people were really worried at the very beginning that, native
Guest 3
a lot of mobile stuff. I I think this might be a consequence of being Canadian.
Guest 3
the dirty secret under the hood was that we whole bunch of Mac Minis in a beer fridge, It's got all the things that you kind of wanted to be there the whole time. It's thinking about the front end from the very beginning with
Guest 3
And eventually the cloud thing,
Guest 3
Sure. Yeah. Like you said, I used to do, live. And now this is a can of worms, but, re It would be nice to have,
Guest 3
We were very webby people, and we were like, wonder if we can embed a web browser in this thing, and
Guest 3
and, and yeah, that was the PhoneGap project, and later Apache Cordova, and I spent a lot of time re Thinking about embedding web browsers and building,
Guest 3
whenever people say that, it's usually something re expected. Good comes out of it, a kind of if you're running Java, frankly, you're gonna have a bit of a hit to that cold start, that you wouldn't see with a Node. Js or a Deno or a Python or even Ruby now is actually super fast, which is underappreciated, but a great place for for Lambda functions. Awesome.
Guest 3
sure enough, we could. And everyone said that's a terrible idea, so we knew we were onto something good because commodity, Yeah. That's true. And I what they need to know I think what folks Just need to know that it's possible. File that one away, and then, you know, when out there as an activity, but writing,
Wes Bos
So do you wanna give us a a a quick rundown of What you used to do as well as, like, what you've been doing for the last couple of years?
Guest 3
Code is gonna take over as the web, you know, a thing of the past, this mobile form factor and the experience is so much better. And which lets And you want to persist the data, but you only want to persist it for a little bit. Rid Like, short lived tokens for
Using layers for binaries in serverless functions
Wes Bos
I was using Cloudflare Worker, and I was grabbing a website and crawling it for a image and then and then returning that image inside of the HTML.
Guest 3
Yumda, rid Deno's already made a lot of these choices for you. So it's got a built in linter tester. It's got the full node standard library on the way, most of the browser API, rid And then just a ton of stuff that you probably need, like, Ryan
Guest 3
So there's plenty of mischief you can get up to with that one.
Wes Bos
And, yes, all the popular things are already
Wes Bos
layerified. Right? tried using in, JavaScript thing fails or something like that, or you're you you duck into the subway as a JS file is downloading or something like that,
Wes Bos
one of mine. Yeah. That was in
Guest 3
write your function in PHP, you can do that. And then it'll work.
Guest 3
So s 3 maybe the greatest granddaddy of all serverless things. Now you can put your
Wes Bos
what was it? My Cloudflare Worker.
Wes Bos
And I couldn't I couldn't use
Wes Bos
Yeah. That that's actually what I
Scott Tolinski
There's so much to learn. My gosh.
Guest 3
or your own binaries or even your own run time if you want. You can put that up there and then you declare, we support this in begin too. You just declare the layer ARN, Pretty much. I mean, I'm maintaining one right now for the demo runtime, or something. And that's a fingerprint of the contents of that file. And the reason we want to do that because when it goes out to the Internet, We can cache the right time. And their whole thing is to be dynamic and then use caching headers instead of rid A pre render step.
Guest 3
if all all these other techniques fail you, rid Lambda layers lets you, compile up your own node modules. And you can And it's not too bad, but just about anything else you can think of is lots of reasons to Be worried about what serverless is gonna do to the existing application architectures that are out there because it is such a big game changer.
Wes Bos
I forget. I think it was puppeteer. I couldn't use, like, one of these really slick things, and, Also, that probably would be really slow. And then everybody was saying, like, oh, if you're using AWS, you could put that in a layer, and it'd be much easier. I will shoot you a link to a a demo doing it with begin. It's pretty easy. You just give it this public layer on, and it'll it'll add puppeteer to your function.
Guest 3
is out there. And this dude named Michael Hart actually maintains this project,
New frameworks focused on server rendering like Remix
Wes Bos
In serverless functions, can you do it? And there's a limitation at some point because you you're essentially thinking like, it's essentially bundled.
Wes Bos
Yeah. I'm I'm so excited for that. Actually, that that leads me into my my next question here is sharing code
Excitement about Azure's potential in serverless space
Guest 3
and in the future, hard to write, and very verbose, lived, you know, invocations, this isn't the Perfect technology for that today, but
Wes Bos
is, like, how you it's an open source product, and then explain how that relates to what Began is, which is your company. Right? Brian said a couple of minutes ago, is if you have something that needs to run a little bit longer and not block the with a web request, rid Then you can go ahead and grab that. So background functions is pretty cool. And then they are in early access, I think I'm gonna ask for this myself, of rid Edge handlers, which I thought was really neat.
Guest 3
solutions. And so to explain what that is, they're not even in the number 2 spot. So like I only have time to really focus rid on maybe 1 and 2, and that would be congratulations,
Guest 3
CloudFormation is a document type that you can read Hand to AWS, and they will generate And, now you don't need to do that. Well, why would you?
Wes Bos
Okay. Rid So there's obviously that, and then there is architect, which is the open source framework. So instead of, re
Guest 3
is an open source,
Guest 3
Yeah. So Architect In GCP, I don't know. They keep shipping stuff and deprecating stuff, so I honestly don't even pay attention because I sort of feel like they're a waste of my time. Rid And that's a a harsh thing to like say, but it's, you know,
Guest 3
way to generate cloud formation,
Wes Bos
Explain, like, what Architec
Guest 3
there's no way for us to get a deterministic result on the other side. So it's kind of like a lock file Rid I'm gonna totally self interested sick pick here, but we recently added,
Guest 3
resources for you. And the reason you want this or the reason this is important to you is you can get the same thing every time. If If we're telling AWS I need 3 Lambda functions, you're going to always get 3 Lambda functions on the other side. And this seems like kind of contrived, but If we don't specify Yeah. Or you can import, The other kind of angle to this and again, it's just like our nature. We all want this to be like one answer, but there isn't one. You can mix and match this this stuff.
Guest 3
in some kind of manifest file, And, and you know, if you know how to do something one way, then you see this new way of, rid. You know, it could be offensive to your your sensibilities. You might be incentivized to think otherwise.
Serverless as an addition, not replacement, for existing architectures
Guest 3
It's how can I leverage this in my new project? Or how can I bring this functionality over to where we make it
Guest 3
I have a good story for this one? We're working with a client that's got huge rails app, rid And some of it is written in .net somehow. Mhmm. And terabytes of data,
Guest 3
they're not moving that to serverless. But they have a front end team rid
Scott's sick pick - Blink-182 covers album
Scott Tolinski
Bandcamp and apparently a Blink 22 focused podcast or something. I have no idea. I just found out about this because, One of my favorite artists, Jeff Rosenstock, who you might know, Wes, because he's on the same label as Pup, who I know you really enjoy. Right? No way. Pup? Is Pup the band that you like That's on
Scott Tolinski
that song, this is by Blink 155, which has
Scott Tolinski
Oh my gosh.
Scott Tolinski
if if you're into,
Scott Tolinski
Ready. There's some some really talented artists on here, and, 30 seconds or less, and you could have a URL on the Internet. And, yeah, that's what I've been up to these days. I'm glad you mentioned begin at the very end there because I first tried out begin on a YouTube video called Scott Tries Begin. It was like my 1st 1st initial attempt at trying it, and I loved it. It was,
Wes Bos
Been here too long. Awesome. Shameless plugs. You have any other anything else you'd like to plug there, Brian? I'm gonna shamelessly plug All of my courses, west boss.comforward/courses.
Scott Tolinski
side 1 dummy. I've never
Scott Tolinski
Yeah. So check this out. I'll have the link in the description. Blink 155.
Scott Tolinski
it's a music sick pick that I I found out about this morning, and I am very happy about this that this exists. This is an album called Been here for too long. It is 28
Wes Bos
publicly
Scott Tolinski
Just a ridiculous
Scott Tolinski
declared my love for pop, but they're a good band. But I wouldn't say, like, I'm a puppet or something like that. Okay. I thought you had talked about it once on this show. That's why I said that. Either way, there, Jeff Rosenstock is one of my favorite, punk artists. He's on that same label. He's on this album, so, I'm very excited to be, having this in my rotation. Just,
Scott Tolinski
versions of Blink 180 two's Damn It by various artists.
Discussion on Aleph.js for serverless Next.js apps
Scott Tolinski
Rid. Or j s Joe is maybe how more people would know him on Twitter. He just tweeted about this today, and I've never seen this before. And so this library, alif.js,
Scott Tolinski
rid Platform, I guess you could say. This just came on my radar today because,
Guest 3
It looks cool. And I think this is where we're gonna see a a Flooded these because Mhmm. Deno takes out the a lot of And there's lots of answers and they're changing all the time
Scott Tolinski
rid. Is basically you could think of the Deno 4, Deno, whatever, for Next. Js comparison. So you get file system routing, static site. And I'm interested in this because I rid. I don't see anything about their whole serverless
Scott Tolinski
I'm sorry, Joe, if I mispronounce your last name.
Scott Tolinski
API folder structure, but I know
Scott Tolinski
Joe
Scott Tolinski
Deno versus Node. Js here.
Scott Tolinski
Next. Js has been pretty responsible for A lot of people using serverless functions a little bit easier in the the mainstream more recently. So I don't know if this was on your radar, but I this just popped up for me today, and I thought kind of interesting given the topic of, you know, Deno
Brian plugs Begin's new proxy feature
Wes Bos
Yeah. That's another one we're checking rid Oh, that's neat. So that that's something someone would wanna take a look at if they were trying to move over a monolith and do it piece by piece? Yeah. Exactly. Sick.
Guest 3
from, compiled into 1 file, Re Uptime is like a thing that we pride ourselves on. But when you think about it, it's just a terrible
Guest 3
And, A pretty important component to this. Being stateless is a pretty important component to this. It can be, you know, any high level service. So Yeah.
Guest 3
Yeah. Cool. A bonus round. We also just, Yeah. For real. That's awesome. Yeah. So load balancing an early monolith with actual hardware Yeah. I think that's a a worthy goal. I I don't think,
Scott Tolinski
Yeah. That's a a good key for anybody to to have, like, in their platform because nobody wants to move all of their stuff over. You know? Rid Like, that's a can't usually. Right? Like, they've got an existing inertia and data, and there's just they're not gonna rewrite the database.
Guest 3
ridged. Thing called proxy.
Guest 3
begin website. You declare a proxy, you can rid point it at your Heroku or whatever else, and then
Guest 3
Oh, to just focus on the ease of use side. And, yeah, Ryan's probably landing twice the commits I am these days.
Guest 3
I think it's the future of serverless is not our big rewrite. The future is gonna be these hybrid architectures for sure.
Guest 3
released And You know, what you wanna do is probably rent that compute. And if you take that rent the compute thing to its logical conclusion, you probably don't even wanna rent the metaphor of a server. You just wanna rent, like, the function execution.
Guest 3
It lets you proxy other websites a function some data, and I return a DOM string.
Sharing code between serverless functions
Wes Bos
Like like you would bundle front end application. For a serverless, you would bundle, like,
Wes Bos
a couple utility functions and a couple libraries, and you have to you have to every time you use something, your your function gets bigger. Right? Yeah. So this is different depending on the provider of the deployment framework you're using. So,
Guest 3
where you can put shared code in that and then it'll get uploaded with all of the functions so that you can share code across multiple functions it's the same Other other things that, like, you can override individual routes to win. So one thing we see people doing is They'll build a GraphQL API, but they want to point to an existing app or vice versa. This is the way to do it. We just released that, like,
Guest 3
And then the last knife in your boot is, executions happen and then this is there's concurrency. So if you get hammered with 10 requests, you will probably get rid Ten separate instances of VM responding immediately, rid We don't lock you out of that.
Guest 3
like, Serverless.com and Netlify and Vercel all bundle. And that means that, you know, you have to sort of declare and know your whole file paths when that function goes up, and it's all gonna get like I am a fan.
Guest 3
which comes with trade offs. So it's good for performance to have less lookups, but it's bad for debugging when you've got one rid Wow. There's an error somewhere, and you don't know where. And so for our way of doing it by default, we, upload the whole function folder. And you can put a package JSON in that function folder, and we will obey it and install whatever stuff you have in there. And then in architect, we have this concept of a source re shared folder ready. It can be webby, it was Intense to watch that video. Okay. Oh my god.
Deno reimplementing Node APIs as standard library
Guest 3
Rid The other angle on this, I guess, for,
Guest 3
versions
Scott Tolinski
rid. Some of it's good. Yeah. It's good. 1 guy can take down half the applications. And some of it's mining Bitcoin on your computer. Yeah.
Guest 3
and that has come to its logical conclusion where we have a huge amount of user land that's hopefully we'll be an open source way to rid Generate other types of cloud inference code Our existing legacy infrastructure, like, Capture that data in my
Overview of Brian's background in mobile and serverless
Wes Bos
much requested show. We did a show on serverless, I think, once before. But today, we have Brian Larew on today to talk to us all about rid Serverless, and I wanna ask some questions about TypeScript and maybe Deno as well. So we'll get into that in just a second. Today, we've got 2 awesome sponsors. 1st 1 is Netlify.
Wes Bos
Welcome to Syntax. This is the podcast with the tastiest web development treats out there. Today, we have rid A show,
Leveraging ephemeral storage like Redis in serverless
Scott Tolinski
Now I actually just pushed read. A new update to level up tutorials last night, and we were watching Century pretty closely because when you do a new release, it's kinda nice to have your rid your eye on things in case you introduced any new bugs, and this happened to be a really huge update. So we just completely rewrote the account system.
Wes Bos
bringing optional types to JavaScript. Was that you?
Scott Tolinski
Yeah. There's lots of lots of things that set it apart. That's for sure. So I'll take this quick moment to talk about our 1st sponsor of the day, which is Century at century.i0.
Scott Tolinski
It's throwing, and our Sentry caught that. And we were on it at the moment, and we're able to find out, oh oh, it's just people messing up their password. Rid. The site's just throwing. There's no issues.
Guest 3
session state,
Wes Bos
Why are types in JavaScript so awesome? What whether it be The TypeScript or, like, do you even think we're gonna get types in regular JavaScript someday? I would assume so. I mean, I don't know why we would Stop improving the language now. It's it's always been painful,
Scott Tolinski
Able to breathe this morning. So Sentry had my butt for that because I had my call stack. I could see how many instances of this was happening. I could see the users. I could see that this was in fact introduced in the build that we deployed last night, rid And it's not a bug. So thank you so much to Century for sponsoring.
Scott Tolinski
that's not the kind of thing you wanna see after moving your account system, and it turns out re The new account system just reports errors. It throws in a way that our other one did it. So when people are goofing up their password,
Scott Tolinski
Use the coupon code tasty treat, all lowercase, all one word, get 2 months for free, and you can breathe easily just like, I did this morning. So thank you. You're a big fan of TypeScript and types. Right? I think I saw a tweet from you the other day
Scott Tolinski
I use and love you every single day. So head on over to century.i0.
Guest 3
for reset your reset password flow. You know, you might have a token that's going to rid 5 minutes. That's super easy to do now with Dynamo.
Scott Tolinski
Before we were using Meteor's baked in accounts, and now we're using accounts JS, which is just like a just a node based account system. Right? And it's nice because it plays well with the current account system we had. But moving your account system, very scary. Very, very scary. And We had some errors come in that kept saying invalid credentials. And,
Example of highly scalable serverless app
Wes Bos
and What's the database called again? I always screwed up. DynamoDB.
Guest 3
It handled the load. The that API gateway was serving it as a dynamic rendered image, Right? You can think of Twilio as serverless for SMS.
Guest 3
we were And I thought serverless, I was late to when I started doing it in around 20
Guest 3
were, like, way within the free tier limits.
Guest 3
for Begin on the free tier is we smear you all these apps across rid across a whole bunch of AWS org accounts.
Wes Bos
that spike shows up on your, like, company wide off.
Guest 3
hit counter Yeah. Sure.
Wes Bos
rid thing, and we are well within free tier limit. Oh my gosh. Yeah.
Guest 3
thing back in it's funny. It shows up in our logs as this one big spike. Really? Rid Yeah. It's like you you happened in February? And then it's like, oh, yeah. So what I did was, like, I was, like, playing around with begin, our infrastructure
Wes Bos
or something like that in in, like, 20 minutes.
Wes Bos
this guy. And the people just started
Guest 3
Yes. Nothing. So, having a cache
Wes Bos
me some logs of, like it didn't even
Wes Bos
I I did it. I did this old school thing on new school tech, and then I, like, tweeted it out. And, obviously, people are like, well,
Wes Bos
Dynamo. I always said Denammo last time. DynamoDB. And I was like, I wanna make something that, like, rid counts and saves it and then renders out. So what I did was, like, you just hit a URL. It increments the value in the database, renders a PNG,
Guest 3
Yeah. And so part of our hack, having to write write it twice? This has been the sort of, like, endless struggle. But now that we have ES modules everywhere, that struggle seems to be coming to an end. Mhmm.
Wes Bos
hammering it, like, writing because there was no, like
Guest 3
sweat. We were watching it go down because we're like, oh, we might have to put a pit in
Guest 3
there was nothing there. Right into the database. Yeah. Rid Straight through. It went up to, like, I think, like, 800,000 right into Deno. So theoretically, you would be able to take a lot of your utility libraries to just bring them bring them in to Deno. Right? Rid Yeah. And the other angle to this, they're paying close attention to what happened with npm because they lived it. And, they're building a lot of that in as a part of a standard library for demo. So So where we would normally be reaching for NPM
Wes Bos
And then and then serves it back up. And I was like, oh, cool. Like, old
Wes Bos
Do you know how much that cost to run?
Begin's local dev experience for serverless
Guest 3
And Queues are another one that's underappreciated,
Guest 3
Looks like a cron job kind of? Yep. Yep. Schedule functions, prod functions. Sometimes people call them.
Guest 3
re Sometimes you need a background task to run for a few minutes. Like when someone signs up, maybe you wanna send an email, but it takes a minute for that process to run. And you don't wanna block the web request wild what we can do now. So the scale part of the questions is rid Oh, but the trade off as you mentioned is that you don't have a disk, not really, you get a 500 meg temp disk, and you can have it for 15 minutes, your app concerns without having to deal with, the low level
Guest 3
Yeah. Then you then you've just created an API for DDoSing yourself. Re So you wanna have that run-in the background somewhere and fire off an event, so that's another capability.
Wes Bos
What else? WebSockets?
Guest 3
Avented functions are another one that we're starting to see other providers this, the Deno core is is coming out from a security standpoint. So they they want to have, is
Wes Bos
assets like images,
Guest 3
Scheduled functions.
Guest 3
but kind of cool. So sometimes, you need a background task, but you can't hit an API a whole bunch of times all at once. And you need to queue that up, so that, you know, you're only eating out, like, 1 at a time. So that's another one that's really important.
Wes Bos
here. Like, the the one thing I was pleased to see was it's I was just like, oh, serverless. It's just functions. Right? Like you said, people just think it's all functions. But, like, it also has
Serverless function languages like Rust and Go
Guest 3
That starts to add up and that becomes a cost center that you will pay attention to.
Guest 3
Yeah. The Deno thing is exciting, because layers.
Guest 3
rid They and Node are going to be competing on this more and more as time goes on. Node has amazing cold start properties, and what it is, is definitely a nebulous thing. So it's become kind of a buzzword and everyone wants to use the buzzword and It's, Yes. I might have been I might have been inciting that.
Guest 3
And so there's going to be some economic incentives to to think about this over the long run. Have you heard of this Aleph dotjs development stack that we need, A lot of people use that in the Lair.
Guest 3
rid So this doesn't probably matter to someone who's just building sort of like a whatever web app, but if you have a huge workload, And you're doing, you know, millions of invocations.
Guest 3
and Bert are well aware of the importance of cold start, and Same idea.
Using serverless with legacy apps through proxies and incrementally moving functionality
Guest 3
that would be a server that would, you know, build PDFs or something from a database dump, and single page apps in the mobile form factor, and
Guest 3
that's incredibly common. That's a perfect use for a Cloud Function because you could schedule these things, they go away, you only pay for them when they use, rid And you don't have to worry about any of that scheduling stuff.
Wes Bos
they have, like, a bunch of serverless in the middle. If it's part of the existing app, they just pass that through to the existing app. But then they'll say, like, alright. You know what? We're gonna do, like, client dashboard or PDF generation That's also what I like so much about, like, Arc and
Wes Bos
or image resizing. And
Guest 3
Yeah. And
Wes Bos
Rid So in that, like, GraphQL proxy, so what's happening when they're moving it over is that
Guest 3
was painful.
Wes Bos
rid to a function, like taking data, return some data.
Guest 3
and they're starting to pick off functionality 1 by 1, Moving it over to Cloud Functions. So it's, I think it's easy to do if you start at that place. If you haven't started at that place, it's not gonna be that easy to do, and that's rid Totally okay. Yeah. That it it I remember back in the day where you would make, like, a form, send a post request But a lot of people can play it with functions, and I think that's fair because that's the most primitive, probably Node. JS.
Wes Bos
and move them from this monolith
Guest 3
It's neat to see because running these types of older school workloads,
Guest 3
it's it's interesting because the the ones you're citing are good rid Examples for, like, things that people can do now. So, you know, we used to run these crontasks
Wes Bos
is that how it works? They just pick off, like, a piece of functionality Especially if you're running like a like a Gatsby website and you do need to add some sort of functionality to it, they release background functions, which is great because rid. If you've got a serverless function, just like
Intro to serverless with guest Brian Leroux
Announcer
Talinsky and Wes Bos.
Sponsor - Sentry
Scott Tolinski
Yeah. Just ready to get into it. Learned little bit about serverless. This is a huge gap in my knowledge base because I I know the the basics, but I don't know the the ins and outs,
Wes Bos
2nd 1 is Sentry. We'll talk about them partway through the episode.
Scott Tolinski
So with me, as always, is mister Scott Talinski. How are you doing today, Scott? Oh, I'm doing great. I'm doing fantastic. I'm actually doing very well. Despite we had kind of a rough, like, kids day this morning, but other than that, everything's going very, very good. So,
Discussing Caesar cocktails
Guest 3
So it's it's like a Bloody Mary, but with clam juice.
Guest 3
style Caesars.
Guest 3
Yeah. It's a nice way to mix it up. Rid 2020 Oh my god, sorry.
Wes Bos
That but you Okay. In states. You have the chillada. Right? You can buy the premixed
Scott Tolinski
Okay.
Wes Bos
rid Gelada, which is, like, the Mexican, clamato, and beer mixed together.
Wes Bos
Yeah. It's kinda like that. But instead of a half beer, it's, Like a vodka or gin or something like that. It's it's very good. Yeah. I've been making them with, tequila lately, actually. Oh.
Wes Bos
Yep.
Scott plugs his courses
Guest 3
Thank you, Brian. Have a good one, guys. Peace. You too. Peace.
Scott Tolinski
Head on over to syntax.fm
Scott Tolinski
I'm gonna also shamelessly plug all of my courses at level up tutorials.comforward/pro.
Scott Tolinski
for a re Full archive of all of our shows. And don't forget to subscribe in your podcast player or drop a review if you like this show.
Scott Tolinski
We have a new course every single month, and, who knows? Maybe there's going to be some interesting really, really completely. So
Wes Bos
Rid.
Guest 3
No. All of us in Canada are like, thank god.
Guest 3
Scott.
Scott Tolinski
Deno on level up tutorials at some point in the future. So we'll see.
Wes Bos
Sweet. Alright. Thank you so much again for coming on. That was awesome. You answered all of the questions that I had for you, so I appreciate that. Yeah. Yeah. Thanks for having me. I super appreciate it. That's awesome. Well,
Guest 3
And I think now you can not think about that for a while.
Scott Tolinski
content related to
Serverless functions enable server-rendered content
Guest 3
how how can I do that on both sides of the world without rid primitives that you can get, and the function execution ops often gets, you know, re Hoisted over to AWS Lambda.
Guest 3
We can see responses come back in 70 to a 100 milliseconds.
Guest 3
how am I supposed to build an UI like Figma
Guest 3
Mhmm.
Wes Bos
Yeah. Yeah. Yeah. Of us are writing sign in forms, not big money. Right.
Guest 3
Probably good.
Guest 3
So I think the pendulum is actually going to swing back. And I don't think the developer experience has to be any different
Wes Bos
Yeah. Right?
Guest 3
from from this progressive enhancement technique? And I was like, well, why are you starting with I have to rid Figma.
Guest 3
the the client side thing is also coming back in more modern frameworks now anyways. So Or the progressive enhancement things like Remix,
Guest 3
And you're seeing the same kind of thinking right now also with Svelte and SvelteKit.
Guest 3
from the React Router guys. Yeah. I got one of the indie licenses for that. And Undifferentiated rid I can think of Stripe as serverless for payments.
Guest 3
Yeah. You know what I mean? It's like like, not actually that bad of an experience for an end user. And
Guest 3
Start with, like, what's the easy thing I can do, and then maybe breaking changes, that you can't control from upstream or whatever reason. Like, they've been around forever. They don't break their APIs. They're only getting cheaper than the market theater.
Deno optimized for cold starts unlike Node
Scott Tolinski
Sounds good. Yeah.
Guest 3
And you can spread that out across Amazon accounts. You can,
Guest 3
And And that string, if it's got markup, then you'll do the right thing by you. But you don't have to now think about Options are awesome.
Scott Tolinski
So Yeah.
Guest 3
I think it's something like, 10ยข per 1000000 executions.
Benefits of TypeScript types
Wes Bos
so it's very unintrusive. I don't need a build step. I can just, annotate my functions, and I get all the help Visual Studio code. For our listeners, that's where you instead of putting the types in the, like, function and the return, you write it in a comment above the actual function. Right?
Guest 3
A better debugging experience in many ways. You catch those bugs earlier, and realize that you need. But I don't know, GUIDs are built in.
Guest 3
for sure. But Ruby and Python have just done this too, and I think they took a lot of inspiration from the the incremental typing that you see with TypeScript, and yeah, it makes for
Guest 3
And I particularly like using the JS doc style,
Guest 3
that's nice. And it's especially nice in a dynamic language like JavaScript.
Guest 3
some degree of contract validation on function signatures at runtime.
Guest 3
Where TypeScript can only help us right now is at author time, which is great, you know, any help is better than no help, it was clear to me that the future was gonna be on demand. It was Gonna be stateless. It was, it was gonna be these
Guest 3
typedefs. So you can, you know, write your own typedefs and then import those in the comment. That seems to be like a really nice way to work, but doesn't help me once I go to production and my code's running,
Architect for infrastructure as code in serverless
Guest 3
Okay. You want to check that in with your code, so you can tell the cloud, 'Hey, I rid You know, an API gateway, an S3 bucket. I need this particular, it's nice to see that we're kind of getting past this either or serverless rid Bad, and we're now seeing some more commingling of the techniques. And a lot of that's being driven by front end. Interesting.
Guest 3
and takes a lot of insider knowledge. So architect is a high level format, that generates those documents
Guest 3
Begin I guess if there is, like, really complicated like, I had someone the other day on Twitter who was, like,
Guest 3
security rules for it. And that document is re Extremely that wants to build a modern front end for this thing. So they've put it behind a GraphQL proxy. And now these teams are communicating through schemas. They're able to build up, on their respective sides.
Guest 3
By default, we deploy CloudFormation documents generated by architect.
Guest 3
deploys CloudFormation documents.
Guest 3
so you can just focus on your business logic and You can have a Deno function, a Ruby function, and a Python function all in the same app. That's rid And and that's cool. Like, you're allowed. And and it's maybe a good idea, because 2 days ago. And
Discussion on Begin co-founder Ryan Block
Wes Bos
Cool.
Guest 3
kinda over it rid On the server side It becomes a sort of a Zellitris argument too sometimes, which I don't think it's helpful, so people be like, you have to be accessible.
Guest 3
He's he's hacker, for sure. What a badass. Yeah. Yeah.
Wes Bos
And, like, I because, like, I grew up, like, like, reading all of his stuff, and, like, when I met him, I'm like, oh my gosh. You're my child. Yeah. Yeah. Internet tech.
Guest 3
similar to me, to, you know, bring our run time up to some kind of, and then have really tight permissions around how it accesses the underlying operating systems that you can really finely tune the permission model.
Wes Bos
Ready. One other thing I wanted to just note is I thought this was really interesting when I first met you guys at, conference was your cofounder is is Ryan Block, who's the NGADGET NGADGET guy. So the guy who was reviewing the Motorola flip phone and all that stuff back in the day, Begin and all these other companies is that rid You mostly
Guest 3
Rid So he's, obviously, a developer as well? Yeah. Old school web developer as well. And,
Merits of server-rendered websites without JavaScript
Guest 3
And that's not helpful. Like, what you really want to do is think about, like, what is the easiest way to achieve the outcome I'm ready. For right now.
Guest 3
I'm gonna say that's an edict or, you create Lambda layers using YUM. Yeah. So which is kinda cool. So anything you could YUM install into a Docker you can create into a lot under there.
Guest 3
completely client side. I'm definitely wouldn't argue that that isn't the case. But re They am saying is you probably want to start with the progressive enhancement thing generally, because you're going to get a more accessible app out of it. But the thing I keep trying to remind people is, when we started this journey down serverless, it was 3 seconds of execution, the config steps required to build something like this. Like you get SSR rid Sort of for free because it's just part of how Deno works being a TypeScript based runtime. I imagine we're going to see a lot of these types of things. And yeah, from a, From a Lambda perspective, this stuff is just, another thing that can pop out a string. You know, it could be a bash script, it could be Deno, it doesn't care.
Guest 3
And if that is to bundle it and have it all run client side, then then by all means. But, rid There is definitely, yeah, the old PHP progressive enhancement way or just the form submit.
Scott Tolinski
It's a great question.
Wes Bos
rid to the server. And then you would just add a little bit of jQuery on top to make that happen in the background, and then you would display the answer. And we've sort ofly moved we moved away from that. And you rid. You take the action off your form tags now,
Guest 3
It's time to first bite. You know, you wanna render that, markup payload as quick as possible. It's Probably the most accessible, which, you know, that doesn't mean it has to be for screen readers. It could also just mean your keyboard on your phone works,
Wes Bos
and you handle it entirely in JavaScript. So it's it's always interesting to me to see people who are like, no. We can still make this ready. Work without JavaScript. And that's not just for, like I'm always like, well, who's turning off JavaScript? Right? But there's a lot more use cases that that could happen where database Under the hood.
Guest 3
Yeah. It's not an either or. It's an and also. It's, Kind of full featured standard library, the routing layer the way that we used to, and you don't think the load balancing layer, I fell backwards into doing the serverless thing.
Wes Bos
or you submit the thing and you get back into data.
Discussion on serverless misconceptions
Guest 3
You know, if you're rid. Part of the last generation of software developers you might be looking at, this is existential, which I don't think you should. Because there's never been a moment like that In history of compute, we tend to just pile technology up on top of technology.
Guest 3
And and that works, you know? Like, the story isn't Either or it's and also.
Scott Tolinski
Who cares? Right? That there's there's rid advantages
Guest 3
reality intervenes,
Guest 3
and that's complicated and scary.
Scott Tolinski
it's just so weird that people rid. Hear the word serverless and and get angry about the fact that they're I mean, just like the cloud. It's it's somebody else's server.
Guest 3
which would be really great. Yes. You know? Yeah. Yeah. Exactly. Unfortunately, something that always is the case. But if you're gonna start from a place, I think starting from the place That's most accessible is a good place to start.
Scott Tolinski
and reasons why and, like, they it don't get caught up in, I don't know, the branding of it all or whatever.
Serverless characteristics - on demand, stateless
Guest 3
That's the granddaddy in the space. AWS are the 1st people to sort of say, hey, we're gonna charge you by the function execution.
Guest 3
Mhmm. And it it all fell out from that. And those function executions are an important part of the story, but you can be serverless without any Lambda at all. You could consider, especially after the whole Promise and ES modules thing, that TC 39 wants to continue to
Scott Tolinski
They're servers, but you're not running them. You don't need to think about that. And, that's like the old joke. You know, there's servers and serverless, and that's fine. I mean, some serverless folks get a little bent out of shape over that one. But There is, like, a lot of people who get fired up about the term serverless for some reason, and they're like, there's no such Like, I mean, there's there are technical reasons why, like, this is a different platform. Right? I mean,
Guest 3
index. Html on that thing, and it scales forever.
Brian's sick pick - Begin fingerprinting
Guest 3
And the the TLDR is with you just write ES modules, you put them in a folder, you reference them like normal files, But we'll do all the auto, Yeah. But I think, you know, LinuxC runtime a very browser y API.
Wes Bos
This is a
Guest 3
But it's a build step and it's a manual one and it's something you gotta run yourself. So if you want to just try writing rid Yes. Module straight up without having any build step in between you and that, and this is a way that you can achieve that. Cool.
Guest 3
auto fingerprinting to begin. So if you rid Wanna try out doing an app with just pure ES modules and not have to deal with a build step? I strongly urge folks to check out our fingerprinting feature which Hopefully, by the time this airs, has documentation.
Wes Bos
Nice. What what does fingerprinting mean?
Guest 3
fingerprinting for you, and it'll all load sort of the way you would expect, which is, nice.
Guest 3
So it's a technique that you kind of can't opt out of, you need to do this rid with your apps. Most tools just do this for you already.
Guest 3
So when you, when you do a build step often you'll see the files will have like a little shaw on them, it'll be like index dash like re 286e Or if you needed to, like, you know, include a different version of ImageMagick or, actually, the really popular one is puppeteer.
Other serverless services like queues and scheduled functions
Guest 3
Redis popularized
Guest 3
Database streams rid It's another cool one. So we support DynamoDB. You can write data into and out of Dynamo, but you can also subscribe a function to that. Rid Start composing your app on events in the database. Oh, that's cool. Yeah. Yeah.
Guest 3
and the data too is another thing that's scaling to 0. So this is not intuitive, but like All that would would be possible or is possible.
Guest 3
And having a time out on that cache, well there's a ton of good patterns for that.
Smearing apps across accounts to avoid noisy neighbors
Guest 3
Yeah. It's a it's a different time because this used to be a scarce resource, and we would run the server forever. And now it's For some reason, this has been a bad week to launch stuff, so we kinda kept the lid on it.
Wes Bos
15 minutes of people writing loops.
Guest 3
And, the paid tier will put you on your own dedicated org account.
Wes Bos
and almost all of those came in
Guest 3
and we want this thing to go away. You know, you want it to shut off at the end of the request, which is a completely different programming model. Man, there's just so many, Like, fantastic threads in this episode. I don't want, I don't want to stop
Wes Bos
hits,
Guest 3
get your own isolated org account. That's totally It still works. I just went to it.
Using Deno and Node together in serverless architectures
Wes Bos
they're not migrating, but they're building a lot of the node core APIs Like cast iron ornate vents. Like, our house is, like, 120 years old.
Scott Tolinski
Yeah. And and I think projects like that Alif are going to
Scott Tolinski
get a long way. I mean, just make it easy. Right? Make it easy for people.
Guest 3
Yeah. At the end of the day, that's what we're all looking for. We wanna go home at 5, yeah, there's a lot of this migration stuff is starting to happen, and it's powering that. And, And then now you've got the easiest way to do a form, and you can build on top of that pretty trivially.
Begin for easy cloud deployment leveraging Architect
Guest 3
But there's nothing stopping us or in the future from deploying other kinds of CloudFormation documents. But We're keeping it on the happy path right now because we can control the local development experience, and that's a really big key for us. So
Wes plugs his courses
Wes Bos
By the time you're listening to this, I'll probably have my advanced react course rerecorded as well, so check that on out. Use a coupon code syntax. Rid $10
Wrapping up the interview with Brian
Scott Tolinski
pulling on them. So, I hate to do this because this was just An incredible episode, Brian. And really thank you for for coming on because I learned a ton, and I have a a long list of things to start reading now. And I I love That that's the end result. So I'm sure, the audience is gonna be having a lot of stuff to pull out too. So thank you so much. Now is the part of the show that we talk about sick picks, where we pick things that we find to be pretty sick. Things that we like can be anything. Did you come prepared with the sick pick, Brian?
Transcript
Announcer
You're listening to Syntax, the podcast with the tastiest web development treats out there. Strap yourself in and get ready.