Wecompareit a littlebittootherstacks, likethelampstack, whichissomethingthatmightbe a bitmorefamiliar.
ToemanyWebdevelopers, andthenwe'llstarttolookthrough a bunchofexamples.
Sotherearesixexamplescanpracticallyshowingtakingonesitefrom a singlefile, a staticallygeneratedorstaticallywrittenwithmyownhands.
Htmlfile.
Deployingthatto a contentdeliverynetworkbutthenevolvingthatpage, turningitintosomething a littlebitmoredynamic, turningitintosomethingthathasthingslikelocalizationonclients.
I'd renderinganothertheotherbitsandpieces, andsothat's a setofexamplesthatgrowsthroughoutthevideo.
We'vebeenatthis a longtimenowasasanindustry, andwe'veevolved a longway.
Itusedtobewhenwefirststartedout.
Thisisanincrediblynice, simplediagramtobeginwith.
Itusedtobethat, youknow, whenwhenwestartedbuildingfortheWebwouldcreateassets, weputthemon a Webserver, andthenitwouldcomealongin a browserandwe'd askforstuff.
Andthenwegetthestuff, andthat's that's a lovelysituationtobein.
This a requestfrom a from a pageforfrom a userfor a pagewouldtravelthroughallofthesedifferentbitsofinfrastructure, graduallyassembling a viewthatwouldgetreturnedtotheuserintothebrowserratherthanhavingsomethingreadytogo.
Sowestartedtointroducethingslike a CDen, whichis a contentdeliverynetwork, a networkofmachinesgeographicallyarrangedsothatwherevertheuserarrivesfrom, someofthoseassetscouldbeserveddirectlyfromtheir, whereasotherswouldhavetogoandgothroughthisjourneyandgetbuiltupovertime.
Soallofthiskindofaddedtotheinfrastructureandthethepiecesinplayforservingtherequestoff a userensureitgotcomplicatedondhe.
Butlet's let's let's useoneofthemas a bitofanexample.
Justasformeansofclarificationand a bitofcomparisontillit's let's talkaboutlampstackfor a littlewhilenow, LambStackthatstandsforLennox, Apache, mySQLandPHP.
Andthisis a verypopular, I think, themostpopularcombinationoftechnologiesforbuildingout a WebexperiencethatexistsontheWebatthemoment.
Andeachofthese, thesetechnologiesplays a certainroleontheseotherstacks.
Weendupwith a systemwhereon a Webserverwherewe'vegotsomethingthatisdeliveringouroperatingsystemforustowbuildoninthefirstplace.
Wewant a layerfordataaccessbeingmySQLherefor a databaseandtheserviceisattributedtothat, Thenwegot a layerfordoingpreprocessingortheactualscriptingandprocessingandhandlingofthelogicandassemblingtheviewsinthiscaseisPHPforthatpreprocessinglayerandthensomekindofWebserverthatwilldothingslikethe 82 p routingandtheactualservingofofassetsandpassingthingsalongdownthestack, too.
Togettheresourcesweneednowinthelampstackoftenfindthesethingscombinedin a singleWebserver.
Butovertime, asloadincreases, a typicalthingtodoiswell, wewon't have.
OneWebserverwillhavemanyWebserversallrunningthesebitsandpiecesandotherdescribed a fewminutesago.
Andsometimeswe'llstarttoeabstractthingslikethedatalayeroutofthese, butultimatelywasstilllookingat a stack, whichincludereachesallthewaybackdowntotheoperatingsystemrightthewaythroughuptotheactualroutingandthehandlingofthehttprequests.
Meanwhile, ifwetolookatthejamstackis, ah, a comparisontothat, thestacklooksquitedifferent.
Thediagrams a littlebitdifferenthere, butwe'recateringforthesamekindofthings.
We'restilltalkingabout a seedy P routingandserving.
We'restilltalkingaboutdataaccess.
We'restilltalkingaboutprocessingin a runtime.
A keydifferencehereisthatthisruntime, theprocessinglayerineffect, theoperatingsystem, ifyoulike, thatliveswithinthebrowserhere.
AndcomparethatoverheretoeWhathappenswiththejamstack, whereStackiskindofmovedup a levelit's closertothebrowserisclosertotheuser.
We'renotdealingwithoperatingsysteminfrastructure.
We'redealingwith a runtimewhichisprovidedtousinthebrowsersothatwecanuseJavaScriptrighttheretodothedynamicthingsweneedrightthereinthebrowserandsittingontopofmarkupandbeingouttocallAPeyes.
Sothismeansthatifwe'reifwe'rethinkingabout a pregeneratingprerenderingthings, workingwithout a Webserver, itfeelslikewe'regetting a bitcloserbacktothis.
Thiskindofenvironment, thiskindofflow, wherewe'repregeneratingthings, puttingthemsomewherethattheycouldbefound, andthen a requestcomesfrom a usertogetthisstuff.
Theygivethatback.
Thisthis, um, returnedtothissimplicitywasstartingtogetappreciatedquite a longtimeago.
AaronSwartzhasdone a lotfortheopenWeb.
A lotforworkprojectforWebdevelopmentingeneral.
Coinedthisterm.
HetalkedaboutBakeDon't fryin a blockpostthathewrotebackin 2002.
I alsoliketothinkofputtingsomedistancebetweenthecomplexityandtheuseragain, thinkingaboutTheis, thisworldwhereperhapswe'rehavingtohavemovingpartsofallofthesestageswhen a requestcomesfrom a userknowingthatwithconfidence, allofthesethingswillworkperfectlyeverytime.
There's a complexityandpotentialfailurepointsthere, andthemorewecanreducethose, andthemorewecanputdistancebetweentheuserandthatcomplexity, thebetter.
We'lltalkabouthowweputthatdistancebetweenthosetwothingsatshortlybeingin a situationwherewehave a muchsimplifiedofhostingscenariowherewe'vegotpregeneratedassetsthishugelysimplyforsimplifiesdeployments.
And I wanttojustkindofillustratethatpoint.
Just a tinybit.
Eso I'vekindofadaptedourourdiagramfromearlier, wherewe'vegot a requestin a traditionalstack.
Thismaybehitting a seedyendbutalsohitting a loadbalancer, Webserverdatabaseserversandtherequestgoesthroughallofthesethings.
Wecomparethattothesituationwiththejamstack, whereeverythingispregeneratedandreadytogoat a contentdeliverynetwork, itmeansthatourprocessofdevelopmentanddeploymentthat's radicallysimplifiedthatthatis a situationwherewe'reessentiallyupdating 11 resourcein a knownin a knownandpredictableway.
Butwhenwe'rein a situationwherewe'rebuilding a knownassetandputtingthatthatonesetofassetsin a singleplace, itmeansthatwecanstartleveragingthingsthat a versioncontrolandtoolslikegetwhichwillcometoyouandlittlewhileandstartusingthat.
Allofourcontentorderthecodeandthenthatversioncontrolcanreachallthewaythroughtothehostingenvironmentandthroughtothedeploymentprocesssothatwehave a verypredictablewayofupdatingondeployingourcoat.
Therearefewotheradvantagesofjumps.
Actor, I think a reallyimportanttocallout.
Andthoseairsecurityperformanceandscalearejustspend a coupleofminutesjustjustdescribingthosejustjustinsured.
So, intermsofsecurity, howdoesthejamstackimproveouroutlook?
Thesecurityforwebsites?
Well, asyoumightimaginefromthediagramswe'vejustseen, weget a greatlyreducedsurfaceareawhenwherewe'reworkingwiththejamstack.
Isitgoingtobeforustowhandleofeachofthose a crestrequestsandas a result, howmuchinfrastructurewillweneed?
Addinginfrastructuretowincrude, too?
Thiohandlescalelooks a bitlikethis.
I mean, certainlyaddingthesecashinglayersthat's gonnahelpto a degree, becausethatlightenstheloadonwhatneedstobebedynamically, thatworkthatneedstobedynamicallydone.
Nowstaticsitegeneratoris a script, ifyoulike, whicheffectivelydoestheworkthatweusedtodoin a Webserverhere.
Weusedtohavetemplatesanddataonlogic.
Andwhen a requestwouldcomeinwe'd mungethosethroughallofthosethingsandgeneratorviewandreturnitwell.
A staticsitegeneratorincludesallofthosethings, butratherthanhappening, happeningatrequesttime, thishappensatbuildtimesowecangeneratealloftheresourcesthatweneedforanentiresitebyrunning a scriptaheadoftime.
Andthelastandperhapsoneofthelargestenables, I thinkfortheJamstackisthenumberofserviceisandAPeyesandthisthingwiththe A P I economyhasreallyflourished.
We'restartingnowtoseecosemergewithallkindsofspecialISMs, thatkindofthingsthatweusedtohavetobuildin a housewithourwithourownteam.
Nowcompaniesarestartingtoseetheopportunitiesofcreatingthosethosecapabilitiesonofferingthemis a serviceandofferingaccesstothemthrough a p I sothatwecanpredictablyrequestaccesstothoseandgetthekindofcapabilitiesthatweneedtobringintooursights.
Sowithallofthesethingstogether, thisreallyelevatesthekindofsitesthatwecanbuildfromwhatwemaybe, weusedtothinkoff a static, butnowconducesomuchmorebecauseofallofthesethings.
Sooverthecourseofthenext, I don't know a coupleofhourswe'regoingtolookat a bunchofexampleson, andit's goingtostartsupersimple.
Andwe'lldothatsothatthenournextexampleexampleNumberfourwillstarttopopulatethatsiteinthatstaticsitethat I builtwiththestaticsitegeneratorwithcontentfroman A P.
I willbedoingthattobuildtimefromTherewillgoon, andwe'llstartusingwth e content a p i.
T.
O Alsorenderoutlotsofdifferentversionsofthesitewithdifferentlocalizedcontent.
Sowhatwe'regonnadoiswe'regonnaprerender, whichis a bitof a fancyword.
Really?
Well, forwhatwe'redoing, we'regonnajustmake a next e mailfilethatwillthenhostdirectlyfrom a seedyendsothatwedon't havetoebotherwithApacheorEngine X orotherkindofWebservers.
ThiswillbeusingsomeautomationWillperhaps, eruse a staticsitegeneratorForthemoment, we'regonnayouknow, I'm justgonnabemashing a keyboardandmaking a filethatwillthendeploytosomehostingsomewheresoitcouldgointo a contentdeliverynetworksetofserversaroundtheworldthatwedon't needtomanage.
Itsmanagedis a service, butthenit'llgiveus a yearorelsesothatwecanrequestthispageinourbrowser, getthemarkup, whichwedon't havetodoanythingbecausethat's a LLbeanprebuilt.
We'rejustgonnamake a verysimple, staticviewof a page.
Firstofall, I'vegot a foldersetupherewhich I thinkisemptyyet.
Great.
Solet's juststartcodingsomethingnow.
I lovethisbecauseitkindofharksbacktothethingsthat I wasdoingas I startedtogetinto a Webdevelopmentwasopeningup, uh, texteditorswritingcode.
Now, admittedly, I didn't havelotsofhelperslikethis, whichislovelybeingouthowhelperssuchisthatThiospeedsomeofthesethingsup, butultimatelywritingcodeintexteditorsandthenrefreshingthebrowsertoseetheresult.
But I usedtolovethat, Sothingkindofmakesmereminisceaboutthat.
Butlet's getonwiththisandlet's make a page.
Youweregonnagraduallygettothepointthatwecustomizethisandmakethis a bitpersonalized.
Tostartwith.
It's goingtobesupersimple, though I amgoingto, uh, make a littlewrapperso I coulddosomelikecenteringandbitsandbobsthatwillputan H wineinthereandsay, Thisis a judge.
Youdo?
Um, capitalist.
Um, let's, uh, let's putsomethinginherethatmaybewe'llcustomize a bitlateron.
Let's makethisniceandpositive.
Ah, itwasn't loveinhere.
Hoop.
Uh, fine.
Maybeweshouldstartthisup a littlebit.
I'm justgonnadothisallinline.
I thinkratherthancreatingsomeCSSfilesthat I'llcallin, I'llsplitthatoutlateron.
Soit's like a littlediagramofthisforjust a moment.
Sothisisfamiliarfromfromthefirstexample.
Butwe'vejustchanged a littlebitbecausewhat's happeninghereiswhenthebrows, whentheusermakes a requestfrombypointingtheirbrowsertoyou, Earl, thatratherthanhitting a cdn, perhapswe'rehitting a Webservernowonthatwebsite.
Butwedon't have a completeviewreadytogo.
We'regonnarenderthatondemandas a responsetothatrequest.
Wetypicallyspitthatout, soit's on a differentservice.
It's on a databaseserver, sowemightneedtomake a requestforthatdata, thenmashthattogetherwiththetemplatetogeneratetheviewthatwesenddownthewiretothebrowserforittogetdisplayedinthebrowser.
Wemightbepopulatingdataintothedatabaseforthecontent, sothosekindoftestsarehappening a buildtimebutthecriticalpieceoffgeneratingthatviewandthenreturningittotheuserthatishappeningatrequesttimeinservicesiderendering.