Hello everyone, welcome to Options with Doug. This is my live daily stream that begins at 1.30pm Eastern Time, and I'm live on Bookmap Discord as well as YouTube now. Before I go any further, let me go through the disclosures. General disclosure, all Bookmap limited materials, information, and presentations are for educational purposes only and should not be considered specific investment advice nor recommendations. Risk disclosure, trading futures, equities, and options involve substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. And just a reminder, this is a focus channel and for those folks on YouTube, I'm talking about the Bookmap Discord streaming channel and as well as what I'm going to talk about. And my focus and the focus of my channel is options, order flow, the impact of options markets on stocks and futures, and the influence of market maker hedging flow on price action and futures and stocks. And I have a two-step process for trading and the first is preparation and that's based on position analysis. And I look at how traders and market makers are positioned in the options market and how those positions change from day to day to develop a thesis for trading for the day, I day trade. And this thesis is a thesis for volatility. What is the anticipated trading range for the day and then also for directional bias. And sometimes I have a directional bias and sometimes I don't. And then other traders, well, again, I use position analysis. Other traders use other forms like technical analysis or fundamental analysis and I find that position analysis provides me with a significant edge and it's a new way of looking at the market. And then the second step of my process is execution and I look at real-time order flow in Bookmap and market maker hedging flow with Spot Gamma Hero and on-topic questions and comments are welcome. And for those in Bookmap Discord, you can post your questions and comments in the options-with-doug channel and I will check questions and comments on YouTube periodically and for those folks on YouTube, I urge you to consider joining Bookmap Discord and taking a look at my channel there. I post a lot during the day there and that's a lot of helpful information, potential setups. I post my watch list in the morning. So again, I'm glad you're on YouTube and just please consider joining Bookmap Discord. It's free and open for all. Okay, now let's get started with the presentation. So first of all, there were a couple of news releases this morning. The PPI came out at 8.30 a.m. eastern time and it was both the year over year and the month over month were higher than expected and the market initially had a negative reaction to that. Dropped pretty sharply and then has been grinding higher up until about noon and then starting to move lower again. And then also at 10 a.m., consumer sentiment came out and was a little bit higher than expected and the market did not seem to have much of a reaction to that, maybe a little bit but much less than the PPI. And just as a reminder, next week there are some very important news items and events that are most likely to have a large impact on the way traders are positioned going into that data and will also have quite an impact on how markets react. And those data items are the CPI report coming out on Tuesday and then the FOMC meeting and announcement starting on Tuesday and then the announcement is on Wednesday. And then finally next week on Friday is the December monthly options expiration and that is also the quarterly expiration as typically the largest expiration of the year. So let's start with our position analysis now and I'm going to start with the broad market, the S&P 500 and try to get through that fairly quickly. I think there were some great setups and stocks today and I posted a couple of setups in chat in the BookBot Discord chat for NVIDIA and Tesla and that's what I traded this morning and I'll talk about that and also a trade that I posted yesterday for NVIDIA. Let's take a look at the S&P 500 right now, the ES futures and we can see the sharp drop right after the PPI came out at 8.30 a.m. Eastern time. Just no liquidity there, just a fast, great drop and then just the slow grind higher up until this trend break just afternoon and a couple of interesting things to point out here. In this sub chart and book map for those of you who may not be familiar I have three lines shown in the sub chart and this darker blue line is cumulative volume delta, CVD the yellow line shows stop orders and these both stops and this light blue line which are icebergs are in summation mode so they're showing the cumulative effect of by stops here since the line is rising and sell icebergs since this line is falling so what it looks like here is that these larger traders with icebergs have been selling and it looks like they're finally getting their way here as price has broken this uptrend and starting to move lower and around that time the by stop orders leveled off and then the aggressive traders started coming in and so as far as position analysis goes the support and resistance levels are shown here on the chart and I have this column, these are my cloud notes and I mark these support and resistance levels are provided in the spot gamma a.m. founders note every day and I put those levels in my spreadsheet and they're updated here in that column and one thing to note is these levels are given in terms of SPX and then they're converted to the equivalent ES level now spot gamma is still using an eight point difference between ES and SPX and that what I see now is about a two point difference and that point difference tends to narrow get smaller and smaller as the quarterly rollover approaches so it has been I think maybe as high as 10 or 11 earlier in the quarter and now it has dropped down to about a two point difference but anyway I'm still using the levels that spot gamma is using even though the actual SPX level is about six points lower so again here are the support levels at 3950 and 3960 and then the spot gamma levels in play are shown in this column and there's the zero gamma level and then the SPX 3950 level also the next thing that I want to talk about is some of the data that's provided in the founders note and shifts and levels and I look at shifts and key gamma levels in SPX and SPI as well as the stocks that I follow to help develop a directional bias so for SPX or for the S&P 500 there really wasn't much there weren't many shifts the SPX the volatility trigger shifted down shifted lower from 4000 to 3985 and again the volatility trigger is the spot gamma gamma flip level so that shows the where the gamma flips from positive above to negative below and then the SPI volatility trigger dropped down from 397 to 396 so just a minor drop there and then the SPI key gamma strike or call wall I'm sorry excuse me the SPI call wall dropped from 410 to 400 and then if you recall yesterday the both the QQQ put wall and key gamma strike dropped down and they moved back up today so the put wall moved back up from 265 to 280 and the key gamma strike moved from 280 up to 290 so this is the data that I'm talking about there's the volatility trigger the SPI call wall and then the QQQ the QQQ put wall and the absolute gamma strike or the key gamma strike the same thing so the next thing to note is the gamma notional and that is the market makers position on the gamma curve and the gamma notional for the SB500 it's still negative but it has shifted up towards more positive more positive readings so this is the data that I'm talking about so yesterday and this number is from yesterday afternoon and I compare morning to morning so yesterday SPX gamma notional was minus 489 and again that's the market maker position so that means that traders in this region of the gamma curve are long puts market makers are short puts and they have to sell futures to hedge their delta exposure as price drops and then as price increases they can buy back their short future hedges so they're trading in a negative gamma environment they're trading with the direction of price so that tends to increase volatility so SPX shifted from minus 489 yesterday to minus 237 today and then SPI was a pretty significant shift from yesterday from minus 1218 to minus 686 today and also the SPOT gamma gamma index and the CP gamma tilt have both shifted back towards slightly more positive readings and this is just a the CP gamma tilt or the SPOT gamma index is an indication of positive or negative gamma and below zero indicates higher volatility plus or minus there's no directional indication there so just something to note and I in the last couple of days I have talked about the potential of the Fanta Rally considering all the data coming up today and next week and if this gamma I guess tends toward becoming more positive that will eliminate or minimize some of that put Fanta fuel and what that means and this has occurred several times recently with the last CPI report and also with the last time that Fed Chair Powell spoke is SPI gamma was negative, very negative like more than minus 1000 lower than minus 1000 and that that means that again traders are long puts market makers short puts market starts to rally those puts quickly lose value as implied volatility drops and market makers can back their short hedges and that can lead to a pretty violent rally and that's what happened with those last two events but with this minus 686 there's still some potential for that but not as much as those last two events so just something to keep an eye on and let's take a look at the S&P 500 charts and here we can see that this is for SPX the absolute gamma levels 4000 is still the dominant strike and for SPI 400 is still the gamma strike and recall the call wall dropped down from 410 now to 400 and still there still whether still some substantial put levels here below 400 let's take a quick look at the VANA charts now I keep doing that so what this shows is changes and market makers delta exposure as price changes implied volatility changes and that's shown by the green curve and that's the VANA effect and then also as time passes and that is the charm effect and that's shown by the black line showing the next expiration and just very quickly what this is indicating is this is still the S&P 500 is still in a negative gamma environment and that is just showing that market makers delta exposure increases as price falls meaning they have to sell futures delta exposure you can just see how it has shifted over time and you can see the shift towards slightly more positive today and SPI and SPX okay so again all of that data leads me to develop a thesis for the day and my thesis was for the S&P 500 I was looking for a little bit lower volatility than yesterday based on the shift from negative gamma towards a slightly more positive and also based on the kind of the minimal shifts and levels in the S&P 500 I was really had kind of a neutral directional bias for the day and then I was more bullish on QQQ given the the rise in the put wall and the key gamma strike so let's we've looked at the ES and SPOT gamma here or a book map and now let's take a look at SPOT gamma hero so I'm going to go to the SPOT gamma hero for first of all ES and let's zoom in on that go to the larger screen screenshot here image chart and we can see that traders are mainly this blue line shows that they are traders are buying puts and this is for SPI and SPX and we'll dig down and take a look at those instruments just get a closer look at what they're doing but net net and SPX and SPI they're buying puts and this is probably mostly SPI so overall the combined signal is negative delta and that's for ES and notice how the how these lines move with or actually kind of lead price and what traders are doing and this is pretty typical is they are selling peaks and buying the buying the valleys so when price rises they start taking on negative delta positions and when price falls they start taking positive delta positions but overall on net it is negative delta let's take a look at SPX and here there's a very strong correlation between SPX and price action and what this blue line shows is options that expire today the zero DTE options and up until about noon or so it looked like the zero DTE options had a large impact on price action and not so much after that then after that I guess they really haven't done much so again remember this is showing a cumulative value for the day and what we can actually do is zoom in to a shorter look back period and see that the zero DTE options now they are taking negative delta positions as well and notice how traders as price was lower here after the drop from the data at 8.30 am traders were taking positive delta positions and then as price started reaching a higher level they switched and started taking negative delta positions and price followed sometime after that let's go back to the full day here turn off that so here is a case where SPX options trades are having a strong impact on price action let's take a look at spy and pretty similar to the ES chart okay like I said I wanted to take a look at some stocks today so the first thing that I want to do is review a setup that I posted yesterday and this is for NVIDIA and let me just quickly run through these charts so this is the again this is from yesterday and what it shows this orange line shows that traders were buying calls from the open and this is a very powerful signal that can drive stocks higher as traders buy calls market makers sell the calls and they have to buy stock to hedge their delta exposure and as price continues to rise their delta exposure increases and they have to continue to buy or their delta exposure so their selling calls delta exposure decreases so they have to buy by stock to hedge their delta exposure and they have to continue to do that as price continues to rise so there's a very strong correlation here between price action and call buyers and NVIDIA so that was step one in the setup so step one and I posted this on twitter as well for those of you who are not in bookmap discord chat let me go back so step one we see that traders are buying calls shown by spike gamma hero in the first chart and then this chart shows so that's when you see that then you bookmap users you would want to switch over to bookmap and look for a potential reversal point and here it is it's just a perfect setup here at this 160 key gamma strike and that's where you expect the reversal to take place and it does and then I've shown a variety of a number of entry points here with this note 3 looking for just minor pullback shown on this higher time frame chart showing entry points at small pullbacks and is the dots volume dots here showing a bookmap shift from pinks with aggressive sellers there to aggressive buyers and I'm showing four price targets with levels of high liquidity at 164 165 and then the primary target at 170 and that is also the spot gamma call wall which can be expected to act as resistance and also a price target and this chart ends around noon and at the end of the day traders did move price up to 170 and beyond I believe yeah so this this is the spot gamma hero chart for the entire day and you can see that traders were buying calls all day and that was driving price action so more aggressively in the morning they slow down for several hours as price levels off and then when the call buyers come in again after 1pm price starts to rise again and there was really not much going on with puts the blue line so definitely call buyers were driving price action in Netflix yesterday okay so I just I wanted to review that yesterday that was kind of a step-by-step approach everything you want to look for if you trade stocks again the call buyers so that leads you to definitely look for a long entry knowing that market makers are going to have to stock to hedge their delta exposure and and they'll have to continue to do that as long as price rises so again step one you see that step two you look at book map you see that 160 key gamma strike as a strong potential reversal point and then the targets above at the liquidity shown in book map especially at the 170 call wall okay and this is now we'll go shift gears toward today I wanted to review that from yesterday and then this is today and I posted this and in the chat room this morning around just a little bit before 9.50 and today I sorted my watch list from the strongest stock to weakest and this is by the hero signal and the hero signal is showing the strongest signal in the last 5 days and the last 30 days so here an Nvidia for example this gray sliding scale here kind of a lips shows the entire 30 day range and then the smaller colored area indicates the signal for the last 5 days so this is showing that the signal for Nvidia is at its high point for last 30 days and the last 5 days so here you would see this we'd be looking for a long entry and the same with Netflix and the same with Tesla and these were the strongest signals and also the the best setups alright now let's go back to the go back to the live market and for those of you in book map discord I posted the chart this morning you can refer to that and I'm going to go through that that chart and the go through my stocks and the order shown in that watch list so as you recall the top stocks were Nvidia, Netflix and Tesla so I'll start with those 3 so first of all let's go to um Nvidia and this as usual is showing a very strong correlation between price action and options trade shown by hero let's break out, put some calls and really up until about 1 o'clock call traders have been really driving price definitely up until about 11 oh yeah even 12 so this is what has been driving price action traders buying calls not doing much with puts and price starts to drop a bit and level off as the as traders start um selling those calls and let's go take a look at book map now let's go to Nvidia a little bit choppy trend here but definitely some good setups here let's just zoom in on this a bit and recall yesterday the highest price target was the 170 call wall and another clue that you would uh want to look for a bearish or a bullish setup on uh and that uh Nvidia today is the highest in the call wall so and let me actually I forgot to show this let me show my this is a spreadsheet that I track every day I track the these are the stocks on my watch list and I track the key gamma strike for these stocks and how they change from day to day the key gamma strike is the strike with the largest absolute gamma and watching how that uh how that key gamma strike changes from day to day is a good indication of uh changes in sentiment and also potential uh increase or decrease in price so today notice the increase in the key gamma strike for Nvidia conflicts and one interesting thing to note is the key gamma strike for Tesla actually dropped from 180 to 170 uh but traders were in their buying calls today as we'll see in just a minute and then also there's the increase in the key gamma strike for QQQ that I talked about and then finally for Meta and Snowflake let's go back to book map now so a little bit choppy uptrend but some really good long setups and Nvidia here with the traders buying calls this clear target at 175 notice all the liquidity in there and traders finally consumed that price drops and then continued back up to test it again and one other thing to notice here is the as this liquidity comes in that helps to support price and move it higher so that was Nvidia now let's take a look at the next one in the list Netflix really nice clean uptrend for Netflix it has been more more choppy recently and let's go take a look at spot gamma hero we're looking at Netflix very strong correlation between price action and options trades shown by hero and you know it's very clear here that call buyers and then call sellers are driving price action and again if you're looking to trade stocks and you're looking for a long entry this is what you want to look for and there some nice dip entries here pullback entries as price falls traders continue to buy calls so a little bit before 1030 and then 1050 let's go take a look at book map again so there's the 10 around the 1030 before 1030 setup and then the 1050 setup and remember again that traders continued to buy calls so that was the the second stock on the list with a very strong hero signal and then the next one was Tesla and I posted this in chat as well and here I'm showing CVD in the sub chart below and showing that you know this corresponds with all the green dots here a lot of aggressive buyers in there this morning as well as call buyers driving price action higher let's go take a look at spotgamma hero and as usual with Tesla there's a very strong correlation between price action and options trades shown by hero and calls are definitely driving so for anyone looking for a setup this afternoon it looks like traders are continuing to buy calls not a recommendation and let's go back and look at book map now and look for potential targets at there's the 183 liquidity whoops and then the 185 call wall above and I'm just going to check youtube questions so give me just a moment and mits ask is this live option data in book map everything is live and then in spotgamma hero everything is live as well and so spy option data that's live yes that is hero stands for hedging impact of realtime options so it's showing realtime data so I recall my two step process preparation happens and I use static data for that that is based on open interest data that is released once daily sometime during the night and that is kind of that is the raw data that spotgamma uses to develop all these levels so that is static data that's done once a day and then the second part is execution and that is looking at realtime order flow and book map and also again realtime hedging activity with spotgamma hero and indicator for the reversal in the morning for what instrument for the S&P 500 let's go back and take a look at that again so I I don't know if there was any any one indication the ES drop down to the lower edge that you expected move for the week and then aggressive traders started started buying as well as buy stops started firing off and then also recall that with SPX we saw that traders were taking positive delta positions in mostly zero DTE DTE options so that was what was what was driving price action in the S&P 500 all right let's get back to our stocks now so it looks like as traders are buying calls again Tesla continues higher and the first potential target there is probably the 183 higher liquidity so let's get back to the list now and let's go to let's take a look at I've got a couple stocks on my other computer I'll need to share that these were the best setups today though the ones that I just covered NVIDIA Netflix and Tesla and the next Shopify not really much here traders there's a strong correlation between price action and options trades but kind of choppy trade and let's take a look at QQQ and there's a pretty strong correlation between price action and options trades and again it looks like the traders are selling the high points and buying the low points or fading the moves with options and nothing really clear there let's go take a look at book map QQQ this is pretty similar price action to the SMD500 sharp drop in the morning then the steady grind higher until the till the trend break and then price starting to roll lower the next stock that I wanted to take a look at was Disney and here there was a very strong correlation between options trades and price action and definitely calls driving and give me just a moment I'm going to share my screen on my other computer and we'll take a look at Disney so there's Disney nice strong uptrend in the morning with the 95 hedge wall liquidity as the primary target and let's go back and look at spot gamma hero again and see that call buyers were in there driving price higher with Disney and also Apple which is actually on the lower end of the list still was strong today so the watch list and the ranking from strongest to weakest is just a suggestion a starting point but that strong or weak signal doesn't necessarily mean that price is going to increase or decrease it's a good starting point a pretty good indication and it definitely worked for the top three stocks on the list but here is Apple and this shows that traders were buying calls and that was not as clearly driving price action excuse me some of the other stocks that we looked at but call buyers were definitely in there and that was driving price higher and now let's go look at book map another nice strong uptrend just like Disney with a clear target at the 145 key gamma strike so another great long setup here in Apple so the key to these long setups today were just to look for the call buyers and again just follow what they're doing traders are buying calls market makers are selling calls and they have to buy stock to hedge their delta exposure and that can drive a stock higher and higher as we've seen with these examples alright the last thing that I want to take a look at is let's go to equity hub now and what I've done is I have ranked my equity hub watch list by this next next gamma expiry or next expiry gamma percentage so this is shows the amount of gamma that is expiring at the next expiration and what you'll see is all of these stocks this top gamma expiration date is today and I'm looking at all these stocks that have a value over 30% so when you see this what you want to do then is look for whether traders are long puts or long calls and look for a gamma unwind and that can happen either today or Monday and in the case of a call gamma unwind that means that traders are long calls and market makers are long stock to hedge their delta exposure and as those calls start to expire or come close to expiration they start to lose value and market makers can sell their long stock hedges and the other way around for puts in that case if traders are long puts market makers are short puts it's like a banner rally those stock puts start to lose value and market makers can buy back their short hedges so the stock may rally so let's take a look at Coinbase first we'll take a look at Coin and we can see from this composite view all the red here this is put dominated meaning that traders are long puts market makers are short puts and let's also look at the put and call impact chart and this also shows the blue line throughout the price range from 20 on up shows that put gamma dominates call gamma so let's go look at spot gamma hero for coin and we can see this morning that traders were selling their puts and this is let's just check not really next expiration anyway they're still selling puts so in that case price has been increasing some up until around 12-12-30 as traders were selling puts market makers were buying back their short hedges and price increased and let's take a look at Coinbase and Bookmap and it looks like it was choppy up until about 10-30 and then there was the increase in price around 10-30 as traders continued to sell puts so this is not a real clean example but let's just go take a look at Bookmap and we've looked at Netflix that was another one on the list and we saw that traders are still buying calls so the gamma squeeze continues in that case so I actually wrote an article about that and I presented it at SpotGamma Bootcamp last week and I don't think it's been published yet I think Matt wanted to hold that Matt the CEO of SpotGamma wanted to hold that for Bootcamp but in this situation and this was a monthly expiration I was anticipating a call for the Gamma Unwind in Netflix but just like today traders continued to buy calls so the Gamma Squeeze continued and the Gamma Unwind actually happened on Monday so that's something to look for on Monday for a stock that is call dominated and SqueezeTrader asked was Bootcamp recorded and available well I know it was recorded and available for participants those who signed up for Bootcamp I don't know if that recordings are available for people who are interested that did not participate I don't know you might check with SpotGamma on that and let's take a look at one last stock is Snowflake and this is also a put dominated stock so we see that traders are selling puts and let's go take a look at Equity Hub now and we'll go to Snowflake and you know in the current price range we see that it is still slightly put dominated we can check that on the composite view we have a brighter positioning here kind of in the middle of the range you can tell by the shade of red or orange there then SpotGammaHero showing that traders were pretty aggressively selling puts this morning as price was rising and then as they started to level off and start selling puts and again remember this is in a cumulative mode so this means they're just not doing anything with puts when the line levels off and then price starts to drop after that so this is just something to look for kind of a preparation for next week and the large monthly expiration and let's go look at Snowflake and book map so there it is so the sharp increase in the morning as traders were selling their puts market makers were buying back their short hedges and then prices kind of chopped around for a while and then is dropped to a lower level and still chopping around so just a quick summary the best setups that I saw today by far and what I traded were NVIDIA and the signals were clear the strong hero signal the call buyers in there also with NVIDIA the increase in the the key gamma strike and the call wall and Netflix again the call buyers and then in Tesla and NVIDIA and Tesla were the two that I posted in chat room this morning so clear signals to look for longs and those stocks again the strong hero signal call buyers at that point you're just looking for a pullback to get long and looking for a price target either liquidity and or a spot gamma level so that's all I have today I'm going to let me just do a quick check for questions and YouTube I don't see anything so I want to thank you for attending thanks for your questions and comments and again have a great weekend thanks for attending and I will see you tomorrow thanks bye


Hey, everyone in Singapore, welcome to this talk on building full-stab applications with the three-factor architecture. And this three-factor architecture is basically a way for you to use GraphQL and serverless together to build modern slash cloud-needed apps to do a live demo. OK, I think I can do that. But yeah, so anyway, so here's the quick demo that I want to just start off with, so that we have context about what we'll talk about. So here, what I have done is basically set up Hasura on my local machine. That's why you see local host 8080 here. And I also connected it to a database, which is also running locally. It's a Postgres database, and it's completely empty. So this is how when you set up Hasura and you access the console of Hasura through your browser, this is what you would see. So let me go to this data tab and start creating tables, because I'm starting from a fresh database. I don't have any tables. I can create tables through any means, but I'll just use the console here to create tables for me. So let's say I want to create a user table, and I want to give it a few columns like this. Name could be text, and maybe email, which is again text. And I can basically do whatever is possible while creating a table in Postgres, so I can add foreign keys, unique keys, and so on. And as soon as I've added this, I can now switch to graphical, which I'm sure all of you would know by now, I think. Basically, it's a tool where you can try out your GraphQL APIs, and you see complete visibility into what your GraphQL service exposes. And now, so I started with just a table. So with Hasura, what essentially you get is a set of GraphQL APIs automatically generated for you for consumption from the client directly, right? So now you can, for example, I created a user table, that means a field called user is generated, and you can start asking for things there. I did not insert any data, so in fact, I can also insert the data through here, and that would be a mutation. For example, I can do an insert. I can insert multiple objects, or I can insert just one, and I can probably give this a few things, and name is, and I can also get some data back. See, I get the ID, I get everything back, say. So I just inserted a user. This was also auto-generated. I can go back to my previous query here, and if I run it, now I'll see that the user's query actually has one entry here, and I also get powerful filters over the generated API. For example, I can do a simple where clause, say where name is equal to, oops, say name is equal to Thiru, and this would give a result because it does exist, but suppose I change it to Carlos here, I will not get anything because the where query does not match. So this is essentially Hasura, where if you have postgres database, it could be new or existing, you get a set of auto-generated APIs, a very big comprehensive set of APIs automatically for use, and this can be used directly from, say, your back end or even from your front end, because Hasura also comes with an authorization system, so wait for you to embed what kind of users can access what data, and it also, so for example, if you have, say, a Google-based login, then you can use the login information to actually only get data that that particular user is allowed to access. So all these things you can set up in Hasura, and that is the core of the product, right? Now, for three-factor app though, we need few more things, just having just a GraphQL API does not cut it because otherwise three-factor would just be equal to GraphQL, right? So we need more things, but before we get into that, I'll just talk about the other features independently, right?  So you can do complex business logic on these events which are basically happening in your database. So let me just quickly give an example for that as well, right? So suppose, for example, after use, I create an event trigger called after user create, right? And I select table, which is, since I only have one table, I can only set two. And I say for whenever an insert happens, send me the data in at this webhook, right? So this is a public API which is used for testing and all that, so I'm just gonna use this to showcase what this feature actually is. So I've basically given an event trigger name and I've said on insert on this table, which is the user table, send me a payload at this HTTP URL, right? So I can go and create an event trigger. Now, if I come back here and if I create, say the mutation, and this time, instead of, suppose I just create a new object, right? Suppose I insert a new user, in this case, it can be Carlos at Carlos.com. And the name also is Carlos, right? Then it goes through, you can successfully create, insert a user and you can also verify this just going back here, the square E, which was previously not written anything, starts returning things. And if I just remove the bare clause as well, I get both the rows. But that's the main point for this is to show the event triggers. So the event trigger that we just created called after user trigger, as you can see here, has under the process events tab has created an event, which you can see here, this was the, basically this was the request that was sent to the webhook that was mentioned. And you don't have to go through the details here, but in a sense what's happening is, there is some metadata associated with the event. And the main thing that you would see is that this was an insert operation and it has an associated data payload. And the data payload has this new information that was basically inserted into the table. So this is what event triggers is. So you can create, you can basically handle events that are happening inside your database and start doing business logic or doing any kind of asynchronous logic after an event in the database has happened. And yeah, so this is kind of independent of just GraphQL, right? This is not just a GraphQL API, this is something you can see, look at it as something independent. But I'll come to why this is important for three factor in a bit. Finally, this is the last thing that I want to show you is this new thing called actions. And actions is a way for you to extend the auto-generated API that you've just seen. So I created a table and that generated lots of APIs for me, but maybe I as a user want to create something new, which has got nothing, which may be related to the tables I have or which may not be related to the tables that I have. It might be just something completely custom, has nothing to do with the database or it has something to do with the database, but not in the way that probably Hasura creates for you, you want something really custom, right? So that is where you would use something like actions. So for example, I create an action, say my custom field. Oh, my bad. So this is basically the first input, which is an action handler, which is again a HTTP web URL. So this is where you would basically write a resolver or write the logic for how to deal with the incoming operation or incoming query that has come that you have defined here. So let me just show that more clearly. So for example, Hasura generated an insert user field, but you want to also add, say a custom thing like, my custom create user, right? We had insert user, but you wanted to create something custom and it can use, again, you can define these things yourself, like what is the input field for this, what is the output type for this, and these things can also be defined here. For example, the input for this is something like access token and this access token could be your Google or token, the Twitter or token, this is just an example, it can be anything and your sample output, so the sample input can be username password or it could be token to be honest and your sample output is basically an access token with which you can do further queries without giving your username passwords, for example. So anyway, so let me go and create this and this was created successfully. So yeah, so coming back to what this handler is, so now you've created these, you're basically created your own schema as a small extension of your schema, but you haven't returned the business logic or the rules for how to actually execute that execute this GraphQL operation and this is what this handler basically does. In this handler, you can write your code so that it actually resolves as a valid response. So if I come back here and I have, if I check the mutation, I'll see that my custom create user is available for me to use and I can give it the input fields that it requires, which in this case is username and password and password like this and I can also get the access token back. This will not work because I have not deployed a proper handler, the handler that I gave there was just a dummy URL. So this is not gonna work, but just to show you what an action is, I think the point is presented with this example. So let me go back now to the slides. So let me just recap what we just saw. So we saw that you can get GraphQL instantly with Hasura. You can have a GraphQL API through whatever means, right? You can write your own thing, you can use some other service, but the important part is you have seen what GraphQL basically is and that you can get GraphQL over your databases instantly. The second thing that you have seen is there is a way for you to capture something called data events and this is what you saw in the events tab that I showed you that whenever some event happens on your database or your tables that you can capture the payload and you can basically do some processing with that data. And finally, the third thing that we saw is also a way for you to look at it as a domain event because you created something custom related to your domain and then you made it execute through your own webhook slash action handler logic. And this can be also seen as a domain event. To make the point further, if you remember coming here that there is a kind option here which can be synchronous or asynchronous. And I think it would be quite natural if this action was actually asynchronous that it's actually creating something called a domain event. But yeah, so this can also be seen as a domain event. In the case of asynchronous it's actually a persisted event. We'll come to that later. But these three things are basically prerequisite for you to start building three-factor apps. Now I've been saying three-factor apps and the topic of this talk is also three-factor apps but what is the problem that it's actually solving, right? So let's get down to that. So this is what a traditional architecture might look like. You have your app here and then you have a layer which I will call as an API layer. And this API layer basically talks to the database. The app does not talk to the database and the API layer could itself be talking to different microservices or third-party APIs and so on, right? So there's a payment microservice. There is, so we are going to build a food delivery app. So there could be a payment microservice. There could be a restaurant microservice and there could be delivery management microservice and so on. So all these three services have to come together to make a successful response, right? So but if you really think about it, is this really scalable? Is this resilient? You have so many components. Is this resilient? Will it, what are the failure conditions and what are the error handling semantics? And if you're building something like this, how do you talk about development velocity? How can you iterate fast? How can you build a prototype quickly and then get to a MVP and actually go to broad and keep making new additions to your application? So these are three questions that you would definitely ask while building a modern application while building an application for the cloud and so on. So let's try to answer these very quite simply. So the first thing is, is it scalable? It really depends on the scalability of the weakest link in the chain, right? So if you have three, four, five components, then the scalability will depend on each of those components and you will be bottlenecked by the weakest one. The second thing, resilience. So you would need a lot of error handling and recovery because any of these components can malfunction or can return some weird error. And since you have already progressed a little bit in the request, you have processed your request little bit partially and you have encountered an error, you need to probably roll back a few changes or you need to somehow backtrack so that you still stay in a consistent state, right? So you will have to handle all these things yourself. You'd have to write code to do all this. And the final thing, the development velocity is that it's easy to build because it's a traditional architecture. There's a lot of literature around it. There's a lot of prior art. You also probably started off with your experience building such, because by definition, traditional architecture is something that everybody learns about. So you would have built something like that and you'd be more comfortable to build something on it. But it's hard to iterate and manage at scale. Suppose you're adding new features every day or your team is big and you have to have independent components being deployed in the application. It becomes really hard to manage fundamentally because it's monolithic in nature, right? So to solve most of these problems, people and not just people, the community has built patterns towards making things more asynchronous in nature, right? Because fundamentally all these problems are happening because of the continuous interlinking or continuous dependencies on each component, which is what makes it monolithic in nature. Although you have different microservices, they're still being called in the same request. So the components might be independent, but the request workflow is still kind of synchronous, right? So the biggest fundamental change that you can do is probably letting go of this assumption that things are synchronous and making things asynchronous. And that is why we try to approach this problem and try to give a solution which kind of builds on these async patterns, which brings me to this event-driven architecture slide and you can see probably a typical architecture with event-driven mechanisms and what event-driven architecture probably looks like. So in this case, there is again an app which is talking to an APL layer. The APL layer is talking to an event system, which is the main driving force here instead of the database, it's the event system. And the event system, let's just think of it as a black box, but as you have seen what events are, you can think of events as basically some payloads, some JSON objects, which you can consume in some way. So this event system basically talks to your microservices, which does payment, restaurant functions and delivery functions and so on. And these microservices in turn either contact the event system directly to create more events or maybe they insert something or do something to the database. So it can go either way. They can talk to the event system or can talk to the database. And finally, the database provides a view of what is the current state. So your application can request for some data and that data can actually come from the database as well. So this is what a typical event-driven architecture looks like, which basically was quite complicated. You might not have imagined things to go from something as this is quite much simpler than what you see here. And which will basically beg the question that why would I even do this? Like this is so complicated. Before we get to that, let's just see what the event-driven architecture basically has. So the first component that you saw is that there is a simple APL layer that creates events, it could be anything. The second aspect is that all communication happens through events. So your APL layer talks to your microservice through the event system and the event and the microservices in turn can create further events if they want to talk to other microservice and so on. So events is the main communication tool in an event-driven architecture. The third thing is that you should have a flexible eventing system itself, which means you might have to send one event to multiple microservices or you want to just send it to few. And there should be a delivery configuration. For example, you want to retry some kind of a failure and so on. So your event system should handle all of this. And finally, the purpose of an event system is not just to store events. It should also deliver it to microservices which handle the events and completes the entire application and so on. So these are the four main things of an event-driven architecture. So having said all this, how does serverless and what is exactly serverless, how does an event-driven architecture relate to this new thing called serverless is what we'll see next. And to start off again, I'll show you a simple hands-on. It's not a proper demo, but this should basically suffice you to give a hands-on feel for what I mean when I say serverless. Basically, you can create a function as shown in the first item here. You can create a function which basically returns a message or a JSON object. And you can use different tools. Serverless is a common thing. There are many providers who have serverless platforms and functions as a service platform and so on. But you can use this tool called serverless which is an open source tool to basically deploy this function here which is defined in this file and you can give it different triggers. In this case, if you give a trigger like HTTP, you would get an endpoint as the return object. So the return value for running this command is going to be this endpoint. And no surprises here. If you curl or if you fetch this endpoint, you will get this message. So all you have to do to get an API, get a function running in the cloud is basically these three steps. So this is the power of serverless. Now, a few more slides about serverless. So what is the big deal of serverless? The big deal is that it's scalable without you having to see any of the infrastructure behind what really went through in providing you with that API. So that means you did no operations, no ops, you had no VMs and no infrastructure to really worry about. And because this has been provided to you as an API, it's the job of the provider to make sure that all the scaling capabilities are built in so that you can use this API in low throughput environments where there are like few users, but you should also be able to use it in high throughput environments where you have like hundreds and thousands or even millions of users. So the scaling is built in into the platform. So you just write the code in and deploy and you basically don't have to worry about scaling. And the second thing, this is slightly more complex, is that serverless platforms are essentially built on event-driven notions. So in this case, like we gave the trigger as HTTP, what really happens in the serverless platform is that an incoming request is kind of like an event trigger for running that function that you defined. So this is something slightly deeper into how serverless infrastructures usually work, but they are event-driven in nature, in which case you can basically use all the things that you could do with events. For example, like you can retry on failure and so on. So if you send a request, maybe through HTTP and you could be waiting on the response even though the underlying, even though the platform might have trouble maybe executing a code and so on, but you'd never really see those errors as a consumer. So this is kind of what makes serverless infrastructure and serverless-based platforms quite resilient and we'll see how, why that matters in a bit. So coming back to the event-driven example, and I think it's just left with a few more slides. So coming back to the event-driven example, suppose you have a table in your application which is like this. Like you have an ID you have created at, you have the user who created it, and you have a few Boolean columns which basically gives you the status of the order. So maybe the order is valid, is it paid, is it approved by the restaurant, is an agent assigned for the delivery and so on. So this is a small example of how you might have, how you might build a food ordering application and this could be a data model for that. And going back to the traditional architecture and we can see that this was basically the architecture here which could now actually in an event-driven, a scalable and resilient, in a resilient system might change to something like this where a database is actually creating events for you and the events are basically calling the serverless functions and the serverless functions are writing it back to the database. This could be a typical example of how you would change some synchronous architecture here to something asynchronous here where the event system is basically doing all the work and the event system should have the properties of scaling and being resilient and so on. Let's see what would be the flow of stake. Like I have just given the architecture diagram but what is the flow really going to be like, right? And this is basically a diagram to demonstrate that. So if a new order comes in, you would have all these Boolean values set to false. So it's not valid, it's not paid, it's not approved, it's not, no agent is assigned for that. But the new order would create a new record in your orders table, for example. And like we saw in the first demo that that could create an event which is handled by Lambda here or Lambda is another way for calling. Lambda for AWS is basically their service platform but Lambda in general has now become a symbol for any kind of functions in the service or a serverless platform. So here in this serverless function you could validate the order and probably set it to true if the order is valid which could then create another event because you basically mutated the table. This could create another event which checks for payment and sets if the payment is done, sets to true on which case you can create another event which is to see if the restaurant kind of approves the order and so on. So this is basically a simple workflow of how you can move state, how you can go from a new order to a completed order in an event-driven way where you can learn more about this in this blog post here. But there's still one problem, right? You have made all this event-driven async and so on. There's still one problem as a front-end developer that all those things are happening in the background but what do I show the user? Like when stuff happens asynchronously how should your app basically get updates? That is where real-time GraphQL comes into picture and real-time GraphQL I'm sure you've had some... In this meetup, in this meetup you've heard about real-time GraphQL already it's a way for you to get data which is in the back-end systems in real-time maybe over web sockets and so on so your app can show updates and this is the missing piece which basically solves the problem when things are happening asynchronously in your application. And this finally brings us to what a three-factor architecture really is it's an architecture where you use a real-time GraphQL or APLA or you have a reliable eventing system and you run business logic in serverless systems and the final architecture diagram probably looks like this I'm using Hasura as implementation of this it could be your own implementation so your app basically talks to say Hasura or your real-time GraphQL engine via subscriptions it makes changes via mutations events are created through the database in the case of Hasura because I showed you event triggers the event system is also kind of driven off the database but I also showed you actions which kind of lets you create events outside of the database so it could be custom events so you create events which are then delivered with your respective serverless functions which are running your logic for your application and they are again talking to Hasura by either making GraphQL mutations or making any kind of table modifications and so on so this is the three-factor architecture the event-driven architecture that you saw initially kind of reduces more simply to this architecture and this is why this is much simpler with all the good properties of event-driven architectures so the final demo here of a quick one is this order app where I'm going to put a name here so I'm going to say GraphQL Singapore HungryUser I'm going to place a new order so let's try this Indian thing here maybe you get it in Singapore as well and if I just create an order I can see basically this application which shows its state so first you have order validation which is completed but in the middle I have to make a payment so let me just make a payment and once the payment happens the rest of the processes happen in the background asynchronously so the restaurant approval process would have happened and then the driver assignment process would have happened this is basically an implementation of the workflow that I just showed you and finally if you are interested in learning more about this this has its own page a very simple page which just describes the architecture in more detail which brings me to the end I think I have slightly gone overboard with the time but yeah so this is the final slide thank you all very much for having me and just a small thing here you might notice a GraphQL Asia sticker here we are having GraphQL Asia in India in February I think Carlos has much more information than just this poster here so yeah if you have any more questions about whether if you want to speak or you want to attend do talk to Carlos about it thank you very much