1
00:00:00,040 --> 00:00:01,520
Are you sure in Australia it's 
not Friday? 

2
00:00:01,560 --> 00:00:02,720
Well, yeah, that's what I was 
thinking. 

3
00:00:02,720 --> 00:00:05,160
I was trying to work out the 
time zone and then I was like. 

4
00:00:06,280 --> 00:00:08,440
Hmm, am I saying this correctly?
Yeah, so. 

5
00:00:08,560 --> 00:00:11,160
Usually in the future in 
Australia, not you, yeah. 

6
00:00:12,040 --> 00:00:14,120
Exactly. 
Yeah. 

7
00:00:14,160 --> 00:00:19,360
So perfect segue, John, you are 
the developer advocates at 

8
00:00:19,360 --> 00:00:21,000
Superbase. 
Is that the correct title? 

9
00:00:21,320 --> 00:00:23,320
Yes, one of the developer 
advocates. 

10
00:00:23,320 --> 00:00:25,480
So we have we're we have growing
very quickly now. 

11
00:00:25,480 --> 00:00:28,880
We've got like four people, 
maybe five soon. 

12
00:00:29,960 --> 00:00:31,680
Yeah. 
So one of the developer 

13
00:00:31,680 --> 00:00:36,440
advocates at Superbase building 
fun examples and cool stuff. 

14
00:00:37,120 --> 00:00:40,680
Look, branding changing again. 
No, I just, I love kind of 

15
00:00:40,680 --> 00:00:42,880
messing with this while you're 
talking just to throw you off 

16
00:00:43,200 --> 00:00:47,760
completely. 
So I am the the developer 

17
00:00:47,760 --> 00:00:52,280
advocate currently at Builder IO
and we are kind of going to do 

18
00:00:52,280 --> 00:00:55,320
like this this mash up thing 
We're we're growing too, but I 

19
00:00:55,320 --> 00:00:58,320
don't know if we have quite the 
Series B funding yet that you 

20
00:00:58,320 --> 00:01:00,520
guys just announced, right. 
Yeah. 

21
00:01:00,760 --> 00:01:02,600
How many millions did you get 
this time? 

22
00:01:02,600 --> 00:01:04,280
It was. 
It was 80 big millions. 

23
00:01:04,280 --> 00:01:06,600
So now we we've got to work out 
how to spend all of it. 

24
00:01:08,360 --> 00:01:11,200
But yeah, we just announced our 
our Series B funding, which is 

25
00:01:11,200 --> 00:01:13,200
yeah. 
Very exciting, yeah. 

26
00:01:13,200 --> 00:01:15,520
Invite people to like Sydney to 
hang out, right? 

27
00:01:16,400 --> 00:01:19,960
I'm in Melbourne. 
Close, close. 

28
00:01:20,040 --> 00:01:21,840
Australia, you got you got the 
right country. 

29
00:01:21,840 --> 00:01:24,480
I mean, you could travel to. 
That's true. 

30
00:01:24,480 --> 00:01:28,280
They could fly me up to Sydney. 
Nice. 

31
00:01:28,280 --> 00:01:31,240
So so we're talking about today,
we're kind of going to do this 

32
00:01:31,240 --> 00:01:34,360
mash up where we're going to go 
through and create like a, a 

33
00:01:34,360 --> 00:01:38,640
super base, kind of probably 
mostly a generic app using next 

34
00:01:38,640 --> 00:01:41,040
JS. 
And then I'm going to plug in 

35
00:01:41,200 --> 00:01:44,640
builder iOS React component and 
we're going to show how to like 

36
00:01:44,640 --> 00:01:48,160
use our visual editor to like 
build out pages. 

37
00:01:48,160 --> 00:01:50,920
But John and I were talking 
before the thing I'm like, how 

38
00:01:50,920 --> 00:01:53,080
do we how do we merge these two?
And I think we have a really 

39
00:01:53,080 --> 00:01:55,960
good idea. 
So I have a starter repo set up 

40
00:01:56,000 --> 00:01:59,880
that we'll probably talk through
like how we kind of got there. 

41
00:02:00,560 --> 00:02:02,840
But then the cool part I think 
is going to be, John, when we 

42
00:02:02,840 --> 00:02:07,440
do, we'll hook up like the 
authentication components that 

43
00:02:07,440 --> 00:02:10,320
you guys already have. 
And we can kind of register 

44
00:02:10,320 --> 00:02:13,760
those in builder and those can 
become part of the page. 

45
00:02:14,160 --> 00:02:16,280
So we'll kind of play around 
with this and and see where we 

46
00:02:16,280 --> 00:02:19,280
end up. 
Yeah, yeah, I I haven't actually

47
00:02:19,280 --> 00:02:21,800
played with Builder IO yet. 
I've been excited about it for a

48
00:02:21,800 --> 00:02:23,880
while, so this is going to be 
the perfect introduction. 

49
00:02:24,600 --> 00:02:27,320
Great, love it. 
All right, I'm going to attempt 

50
00:02:27,320 --> 00:02:30,320
the screen share again. 
Hopefully it doesn't doesn't die

51
00:02:30,320 --> 00:02:34,960
off all over again. 
I'll try to go as big as 

52
00:02:34,960 --> 00:02:38,040
possible. 
I know my 4K doesn't allow for 

53
00:02:38,160 --> 00:02:41,960
for great screen share on here 
folks. 

54
00:02:41,960 --> 00:02:46,000
If if you're watching, I'll try 
to watch the comments as we go 

55
00:02:46,000 --> 00:02:48,440
along here. 
If you want to join me, just DM 

56
00:02:48,440 --> 00:02:50,920
me on Twitter and you can join 
us too. 

57
00:02:51,200 --> 00:02:54,360
John, I was going to mention to 
you, did you want to code along 

58
00:02:54,360 --> 00:02:58,400
with me? 
I I had set up VS Code live 

59
00:02:58,400 --> 00:02:59,920
share. 
Live share Yeah. 

60
00:03:00,240 --> 00:03:06,000
If you want, I can go over too. 
Let me let me kick that off. 

61
00:03:06,840 --> 00:03:10,160
And again, anyone that wants to 
join, just ping me and I'll 

62
00:03:10,160 --> 00:03:15,280
shoot it over to you too. 
I have to remember how to do all

63
00:03:15,280 --> 00:03:16,680
of this. 
I have done it once. 

64
00:03:17,520 --> 00:03:20,160
We we tried it out earlier on 
the discord. 

65
00:03:20,160 --> 00:03:22,200
I was like, oh someone make sure
this works. 

66
00:03:22,200 --> 00:03:26,160
I think. 
I think. 

67
00:03:26,560 --> 00:03:30,840
This is let's start going 
through it and I'll try and I'll

68
00:03:30,840 --> 00:03:35,280
try and sort out. 
Sent you the the link on stream 

69
00:03:35,280 --> 00:03:37,280
yard, so just let me know if you
can't get it. 

70
00:03:38,520 --> 00:03:41,680
All right, cool. 
So the first thing that that we 

71
00:03:41,680 --> 00:03:45,200
kind of that I walked through 
prior to getting all this going 

72
00:03:45,200 --> 00:03:47,200
was just the getting started on 
super bass. 

73
00:03:47,200 --> 00:03:51,280
So for any of you that don't 
know what super bass is, I I 

74
00:03:51,280 --> 00:03:53,280
just want to quickly kind of go 
through that. 

75
00:03:54,280 --> 00:03:57,160
I know there's there's some 
super bass fans out here already

76
00:03:58,160 --> 00:04:01,080
that you know, so I don't want 
to spend a whole lot of time, 

77
00:04:01,080 --> 00:04:06,760
but if you've ever experienced 
anything like Firebase or AWS, 

78
00:04:06,800 --> 00:04:11,840
like amplify where it's like 
hosted, the goal of Superbase is

79
00:04:11,840 --> 00:04:16,399
to use all these open source 
tools kind of grouped together 

80
00:04:16,399 --> 00:04:19,600
and make up like a firebase type
of solution. 

81
00:04:19,600 --> 00:04:24,280
So Superbase gives us database 
authentication, storage and edge

82
00:04:24,280 --> 00:04:27,520
function edge functions. 
Wow, can't talk tonight, Joe. 

83
00:04:29,680 --> 00:04:33,640
So you get all of that kind of 
out-of-the-box and what in real 

84
00:04:33,640 --> 00:04:39,160
time, I should say before I get 
too like crazier when we go into

85
00:04:39,160 --> 00:04:41,960
our Superbase was this 
dashboard. 

86
00:04:41,960 --> 00:04:45,200
I guess here are the different 
projects that we have running. 

87
00:04:45,640 --> 00:04:47,520
And I just created a new one for
us. 

88
00:04:47,520 --> 00:04:50,600
And you can see Superbase is 
hosted on AWS. 

89
00:04:50,760 --> 00:04:54,160
So I'm in US E, which might be a
little slower for John, but not 

90
00:04:54,160 --> 00:04:59,480
a whole lot, I wouldn't think. 
And here you can see the the 

91
00:04:59,480 --> 00:05:02,920
database and the auth part I 
have set up storage is is 

92
00:05:02,920 --> 00:05:05,320
technically there. 
We're not doing a lot with it 

93
00:05:05,320 --> 00:05:08,000
except for like storing a a user
image at this point. 

94
00:05:08,480 --> 00:05:11,240
And then we'll talk about how 
the real time piece works too. 

95
00:05:11,360 --> 00:05:14,440
And Oh, I don't even think I 
have to approve you. 

96
00:05:14,840 --> 00:05:16,720
Cool. 
I have your account. 

97
00:05:17,760 --> 00:05:20,000
Any super based project in the 
world I can just join? 

98
00:05:20,840 --> 00:05:24,960
No, I'm joking. 
That would be that would be 

99
00:05:24,960 --> 00:05:28,640
really cool. 
I will also add you to builder 

100
00:05:28,640 --> 00:05:31,480
once we kind of get down that 
road a little bit too. 

101
00:05:32,200 --> 00:05:37,440
So to 1st show this off and John
steer me if I'm like talking too

102
00:05:37,440 --> 00:05:39,480
fast or need to head a different
way. 

103
00:05:40,040 --> 00:05:44,360
The goal with this I, I quickly 
wrote this today and just threw 

104
00:05:44,360 --> 00:05:48,040
it together. 
Basically want to show you like 

105
00:05:48,240 --> 00:05:52,680
the authentication portion of 
this just to show that I am 

106
00:05:52,680 --> 00:05:56,840
authenticated right now. 
What this allows you to do is 

107
00:05:56,840 --> 00:05:58,480
kind of like, I'll call it an 
admin. 

108
00:05:58,640 --> 00:06:02,320
It's a pseudo admin that that's 
allowing basically, if you're 

109
00:06:02,320 --> 00:06:05,520
logged in, you're allowed to 
click this add sports button or 

110
00:06:05,920 --> 00:06:09,200
add animals button and that adds
to the table in the back end. 

111
00:06:10,600 --> 00:06:16,040
And when I'm logged out, so it's
signed out, it says please log 

112
00:06:16,040 --> 00:06:17,440
in. 
And that's that's kind of the 

113
00:06:17,440 --> 00:06:19,280
long and short of this easy 
demo. 

114
00:06:19,280 --> 00:06:22,520
So I'm going to go ahead and do 
this again. 

115
00:06:31,000 --> 00:06:35,600
Oops. 
So yeah, I guess I can, you 

116
00:06:35,600 --> 00:06:38,800
know, ramble about Oauth while 
you're while you're doing this. 

117
00:06:38,800 --> 00:06:42,560
So yeah, Superbase comes with a 
collection of different Oauth 

118
00:06:42,560 --> 00:06:47,720
strategies out-of-the-box. 
So by default it just has e-mail

119
00:06:47,720 --> 00:06:50,680
and password enabled. 
So you can, you can just add an 

120
00:06:50,680 --> 00:06:53,760
input field for your e-mail and 
an input field for your password

121
00:06:54,360 --> 00:06:59,200
and register a new user. 
But it looks like what? 

122
00:06:59,760 --> 00:07:00,440
Actually, no. 
Yeah. 

123
00:07:00,440 --> 00:07:02,840
Magiclink is also supported by 
default. 

124
00:07:02,960 --> 00:07:07,440
So Alex has set up the ability 
to just put in an e-mail, which 

125
00:07:07,440 --> 00:07:12,000
is, yeah, definitely a good call
for when you have lots and lots 

126
00:07:12,000 --> 00:07:13,880
and lots and lots and lots of 
side projects and you're 

127
00:07:13,880 --> 00:07:15,400
constantly building things every
day. 

128
00:07:16,040 --> 00:07:17,960
It's very hard to remember all 
those passwords. 

129
00:07:18,240 --> 00:07:21,320
So Magiclink works very well in 
that you can just put in an 

130
00:07:21,320 --> 00:07:25,240
e-mail and then it will send an 
e-mail to you to to verify that 

131
00:07:25,240 --> 00:07:26,480
you're actually who you say you 
are. 

132
00:07:26,480 --> 00:07:27,880
But then you don't need a 
password. 

133
00:07:27,880 --> 00:07:30,600
Once you click the link in the 
e-mail, it takes you back to 

134
00:07:30,760 --> 00:07:34,000
your Superbase app and then you 
are signed in. 

135
00:07:34,760 --> 00:07:38,000
Brittany and I were just talking
about perfect dev, how we think 

136
00:07:38,000 --> 00:07:41,680
Discord's login system is 
probably the best with like that

137
00:07:41,680 --> 00:07:43,280
QR code login and pieces like 
that. 

138
00:07:43,280 --> 00:07:46,400
But I tell you what, having 
magic link set up this easily, 

139
00:07:46,760 --> 00:07:48,160
it's really nice. 
I really. 

140
00:07:48,200 --> 00:07:52,120
Yeah, that that QR code auth 
flow is yeah, amazing. 

141
00:07:52,120 --> 00:07:57,760
We, a company I used to work for
a bank had a an API, like a 

142
00:07:57,760 --> 00:08:00,240
public API that people could use
to interact with their banking 

143
00:08:00,240 --> 00:08:02,200
data. 
And yeah, that was all done with

144
00:08:02,200 --> 00:08:05,520
just QR codes. 
So you, yeah, scan AQR code on 

145
00:08:05,520 --> 00:08:07,480
the screen and it gives you an 
API key. 

146
00:08:08,400 --> 00:08:10,720
Yeah. 
Any of those kinds of QR, Cody 

147
00:08:10,720 --> 00:08:16,640
or Flow things are very cool. 
So let's let's take a look just 

148
00:08:16,680 --> 00:08:20,440
kind of at this next GS set up 
as a whole. 

149
00:08:20,600 --> 00:08:23,920
So there's kind of something fun
going on here that we'll talk 

150
00:08:23,920 --> 00:08:27,360
about, but I'm just going to 
take this right back to the 

151
00:08:27,360 --> 00:08:32,080
original like path set up here. 
So this this could be a little 

152
00:08:32,080 --> 00:08:35,720
confusing for folks. 
So let me just throw in a index 

153
00:08:35,760 --> 00:08:42,720
dot JS and I'm lazy, so I will 
just steal this go like that. 

154
00:08:52,000 --> 00:08:54,800
I was just telling people that 
now that I've started this dev 

155
00:08:54,800 --> 00:08:58,440
advocate role, my my typing 
skills have like degraded 

156
00:08:58,440 --> 00:09:00,920
probably tenfold. 
It's it's, it's kind of nuts. 

157
00:09:02,440 --> 00:09:03,240
That is interesting. 
Yeah. 

158
00:09:03,240 --> 00:09:07,640
I feel like my typing speed has 
reduced dramatically but my like

159
00:09:07,640 --> 00:09:11,000
typing accuracy while not 
looking at the keys I think has 

160
00:09:11,120 --> 00:09:12,960
has improved. 
That's true. 

161
00:09:12,960 --> 00:09:19,400
That's a really good point. 
My video editing skills maybe 

162
00:09:19,400 --> 00:09:24,760
have improved. 
Wow, this thing is moving slow. 

163
00:09:24,800 --> 00:09:30,240
Come on. 
Ah, OK, so let's just delete 

164
00:09:30,240 --> 00:09:32,640
this for a second. 
Hopefully this is cool. 

165
00:09:33,120 --> 00:09:33,920
Hey, I see you. 
Cool. 

166
00:09:34,040 --> 00:09:35,480
It's me. 
I'm here. 

167
00:09:36,600 --> 00:09:39,960
Let's try this again. 
OK, so here is like a 

168
00:09:39,960 --> 00:09:44,360
traditional index page that you 
would start out like a beginner 

169
00:09:44,360 --> 00:09:48,720
application with. 
The the key here that we're kind

170
00:09:48,720 --> 00:09:53,280
of talking about though, is how 
to like utilize some of the 

171
00:09:53,280 --> 00:09:57,280
Super base back end with builder
and the part that I want to like

172
00:09:57,280 --> 00:10:00,160
just go through right now 
without like confusing anyone. 

173
00:10:00,160 --> 00:10:01,960
That's why I pulled that that 
route out. 

174
00:10:01,960 --> 00:10:04,160
So it just keeps really simple 
from the get go. 

175
00:10:05,280 --> 00:10:09,560
I want to show off just how this
sports page works. 

176
00:10:09,680 --> 00:10:12,000
So I'm going to flip over to 
that and take a look. 

177
00:10:15,440 --> 00:10:19,720
So within this sports page, let 
me this is this is a little fun 

178
00:10:19,800 --> 00:10:23,920
on this crazy resolution here. 
But basically what we're doing 

179
00:10:23,920 --> 00:10:28,200
here within the Superbase side 
of things, we have this one 

180
00:10:28,200 --> 00:10:32,880
helper tool or healthy helper 
library should say where we're 

181
00:10:32,880 --> 00:10:35,520
actually setting up a client for
Superbase. 

182
00:10:35,520 --> 00:10:37,320
And this is pretty traditional, 
right John? 

183
00:10:37,360 --> 00:10:40,560
We're just pulling in the the 
JavaScript function for create 

184
00:10:40,560 --> 00:10:42,560
client. 
And then we're just giving it a 

185
00:10:42,640 --> 00:10:46,560
URL and a a non key. 
And so both of those values come

186
00:10:46,560 --> 00:10:49,000
in from our super base 
dashboard. 

187
00:10:49,000 --> 00:10:51,960
Do you want to show where they 
are? 

188
00:10:51,960 --> 00:10:54,600
Oh well, maybe. 
For sure it's no big deal. 

189
00:10:54,880 --> 00:10:58,080
I I can always burn this thing 
down if we leak any keys or 

190
00:10:58,080 --> 00:11:01,520
whatever. 
So I was going to settings 

191
00:11:01,520 --> 00:11:03,760
right? 
Yeah, so settings and then API 

192
00:11:05,080 --> 00:11:09,320
and then that a non public value
up the top is your a non key. 

193
00:11:10,000 --> 00:11:15,480
And so this is safe to use in 
the front end once you have RLS 

194
00:11:15,480 --> 00:11:18,480
enabled, which we don't don't 
have enabled in this in. 

195
00:11:18,560 --> 00:11:23,120
This not yet. 
Not yet, not yet, but yeah, so 

196
00:11:23,120 --> 00:11:27,120
that the anonkey is what you 
would use to connect to your 

197
00:11:27,120 --> 00:11:29,120
super based client and you can 
expose that in the front end 

198
00:11:29,120 --> 00:11:33,600
using the next under score 
public under score prefix which 

199
00:11:33,600 --> 00:11:36,640
makes it available to your next 
JS front end app. 

200
00:11:36,640 --> 00:11:39,200
If you leave off next under 
score, public under score, it is

201
00:11:39,200 --> 00:11:42,160
only available in your server 
side stuff. 

202
00:11:42,160 --> 00:11:46,800
So that's like get server side 
props, get server, get get get, 

203
00:11:46,800 --> 00:11:50,640
get gets and the and the API 
routes as well. 

204
00:11:51,520 --> 00:11:52,520
Yeah. 
Awesome. 

205
00:11:52,520 --> 00:11:55,720
Since we want to use this in our
front end, which you know, if 

206
00:11:55,720 --> 00:11:58,560
you're doing any kind of real 
time or anything like that, then

207
00:11:58,560 --> 00:12:00,240
you will want to be able to use 
this in your front end. 

208
00:12:00,240 --> 00:12:03,760
So yeah, prepending that with 
next under score public allows 

209
00:12:03,760 --> 00:12:05,600
us to do that. 
Perfect. 

210
00:12:05,800 --> 00:12:08,160
All set. 
We'll next recap there. 

211
00:12:09,240 --> 00:12:12,800
So we passed back that client 
that we basically initialize at 

212
00:12:12,800 --> 00:12:15,600
that point and we can use it 
within our application. 

213
00:12:15,600 --> 00:12:18,840
So this is a standard like React
page at this point. 

214
00:12:18,840 --> 00:12:23,040
We're not doing anything fancy 
with static props or like 

215
00:12:23,040 --> 00:12:25,440
anything like that. 
It's just just straight up React

216
00:12:25,440 --> 00:12:28,680
essentially. 
And what we have going on here 

217
00:12:28,680 --> 00:12:32,760
is this state or this session 
that we're keeping in state. 

218
00:12:33,160 --> 00:12:37,800
And what Superbase does is when 
we have this Superbase piece 

219
00:12:37,800 --> 00:12:41,120
initialized, we have this off 
beast and it has this on off 

220
00:12:41,120 --> 00:12:44,400
state changed handler. 
And at that point we can 

221
00:12:44,400 --> 00:12:47,880
actually set our session state 
and pass that around wherever we

222
00:12:47,880 --> 00:12:50,800
want. 
So we take and when there isn't 

223
00:12:50,800 --> 00:12:53,200
a session, we'll just display, 
please log in. 

224
00:12:53,680 --> 00:12:56,560
And when there is, we'll 
actually display the entire 

225
00:12:56,560 --> 00:12:59,360
sports page at that point. 
And this is where it kind of 

226
00:12:59,360 --> 00:13:02,640
starts to get a little more 
interesting in my mind at least.

227
00:13:03,160 --> 00:13:07,480
So let's ignore kind of this for
a minute. 

228
00:13:08,160 --> 00:13:11,440
Like let's just go like that and
just pull it out of our brains 

229
00:13:11,440 --> 00:13:14,600
completely. 
What what we have here is a 

230
00:13:14,600 --> 00:13:18,680
simple button for AD sports. 
So let me bring that side up 

231
00:13:20,000 --> 00:13:24,720
maybe. 
OK, so we have this ad sports 

232
00:13:24,720 --> 00:13:27,560
button right here. 
And that's that's pretty simple.

233
00:13:27,560 --> 00:13:31,720
Let's straightforward onclick. 
What we'll notice here that is 

234
00:13:32,280 --> 00:13:35,600
that we have Superbase and then 
this is always interesting to 

235
00:13:35,640 --> 00:13:38,880
me. 
This from right here, it's from 

236
00:13:39,000 --> 00:13:42,360
off at first because I'm like oh
are we getting data from this? 

237
00:13:42,520 --> 00:13:46,560
Yeah, it doesn't read very well 
with the insert when you're when

238
00:13:46,560 --> 00:13:49,240
you're selecting something makes
a little bit more sense if you 

239
00:13:49,240 --> 00:13:51,360
scroll up to where you're where 
you've got your select. 

240
00:13:52,080 --> 00:13:56,000
So like you're saying like from 
this table, so from the sports 

241
00:13:56,000 --> 00:13:58,760
table, I want to select these 
columns. 

242
00:13:58,760 --> 00:14:00,680
And so in that case, you're just
selecting all of the columns. 

243
00:14:01,200 --> 00:14:04,960
So yeah, it reads a little bit 
more nicely with with a select 

244
00:14:05,040 --> 00:14:07,000
on the insert, a little bit more
clunky. 

245
00:14:07,000 --> 00:14:10,080
So from that's from the sports 
table, you want to insert this 

246
00:14:10,080 --> 00:14:13,720
value. 
It kind of works, but yeah, it's

247
00:14:13,760 --> 00:14:15,520
basically. 
Instead of doing like what it 

248
00:14:15,520 --> 00:14:17,960
just said, super base that table
or something. 

249
00:14:17,960 --> 00:14:19,640
Well, that's true, that would 
work. 

250
00:14:21,680 --> 00:14:23,800
The first one is selecting, so 
obviously we're reading the 

251
00:14:23,800 --> 00:14:26,960
values from the database and 
then this insert is writing data

252
00:14:27,120 --> 00:14:29,480
to our super base instance. 
Cool. 

253
00:14:29,760 --> 00:14:32,120
And so when we click on add 
sports, we're just throwing a 

254
00:14:32,120 --> 00:14:36,320
little faker image in there and 
some faker just names. 

255
00:14:36,320 --> 00:14:38,680
Don't use this in production. 
It will kill your site. 

256
00:14:38,680 --> 00:14:41,120
It's huge. 
But for our purposes this works 

257
00:14:41,160 --> 00:14:44,640
well. 
So we have that kind of set up. 

258
00:14:45,200 --> 00:14:48,920
And then the other piece to this
and kind of the important. 

259
00:14:48,920 --> 00:14:52,360
So we are using a couple other 
things I guess next image call 

260
00:14:52,360 --> 00:14:54,640
that out. 
So we get nice images just 

261
00:14:54,640 --> 00:14:58,480
unload and things like that. 
The other big piece to call out 

262
00:14:58,480 --> 00:15:01,120
in here though. 
So let's take a look at our 

263
00:15:01,120 --> 00:15:10,800
sports table at this point. 
So we have this sports table and

264
00:15:10,800 --> 00:15:15,560
of course every time we click. 
So if I this is poor, let's see 

265
00:15:16,360 --> 00:15:18,400
yeah, I gotta quit with all 
these tabs tonight, John. 

266
00:15:21,120 --> 00:15:25,120
All right, so with this sports 
page right here, if I if I start

267
00:15:25,120 --> 00:15:29,080
clicking that it actually we 
click refresh, we'll see the ID 

268
00:15:29,080 --> 00:15:31,480
increment right here. 
And it's cool. 

269
00:15:31,800 --> 00:15:36,040
So that's kind of how that table
update is going through now, 

270
00:15:36,200 --> 00:15:41,320
unlike Firebase, Firebase is 
kind of tracking that directly 

271
00:15:41,320 --> 00:15:45,120
within their own local database.
And then it's doing a sync and 

272
00:15:46,200 --> 00:15:48,680
it's it's kind of creating that 
relationship. 

273
00:15:49,840 --> 00:15:53,360
What's the word I'm looking for?
It's not lazily updating. 

274
00:15:54,400 --> 00:15:58,640
My brain's shutting off tonight.
At some point it will update. 

275
00:15:59,160 --> 00:16:03,160
Eventually consistent database 
stuff. 

276
00:16:03,680 --> 00:16:08,960
Exactly eventual consistency. 
So when we talk about Superbase 

277
00:16:08,960 --> 00:16:12,520
in the back end, the table is 
actually Postgres. 

278
00:16:13,000 --> 00:16:15,600
And so how does, how does this 
functionality work when we're 

279
00:16:15,600 --> 00:16:20,320
actually inserting like this? 
Is the eventing system occurring

280
00:16:20,360 --> 00:16:23,640
through like a Lambda or like 
what's what's throwing that 

281
00:16:23,640 --> 00:16:27,440
event back at us? 
Yeah, So Superbase has a few 

282
00:16:27,440 --> 00:16:29,360
services all kind of grouped 
together. 

283
00:16:30,240 --> 00:16:33,760
And one of those is Postgresed 
with AT. 

284
00:16:33,920 --> 00:16:38,680
So Postgres. 
Yeah, Postgres T as in capital 

285
00:16:38,680 --> 00:16:40,720
REST at the end. 
Yeah, this is this is a better 

286
00:16:40,720 --> 00:16:45,760
way to do this. 
So Postgresed is a REST API that

287
00:16:45,760 --> 00:16:47,720
can sit on top of your Postgres 
database. 

288
00:16:48,520 --> 00:16:53,520
And so this is one of the the 
kind of awesome superpowers of 

289
00:16:53,560 --> 00:16:57,840
of Superbase, I guess is that 
this Postgres layer kind of 

290
00:16:57,840 --> 00:17:03,000
pipes through all of the API key
like who the user is that's 

291
00:17:03,000 --> 00:17:08,200
signed in information so that we
can then use that in our in our 

292
00:17:08,480 --> 00:17:12,079
Postgres policies or in our 
Postgres functions or anything 

293
00:17:12,079 --> 00:17:14,520
like that. 
We can know who the user is 

294
00:17:14,520 --> 00:17:17,079
that's currently trying to to 
perform this action. 

295
00:17:17,400 --> 00:17:21,760
And so when you're calling 
Superbase dot from and then a 

296
00:17:21,760 --> 00:17:24,560
particular table and then 
calling SELECT or INSERT, that's

297
00:17:24,560 --> 00:17:29,440
making a query to or sending a a
request to this Postgres server.

298
00:17:29,440 --> 00:17:36,360
So it's basically forming a REST
style HTTP request for you, 

299
00:17:36,760 --> 00:17:41,640
which hits this layer and then 
goes off to a Postgres database.

300
00:17:42,400 --> 00:17:47,360
And so, yeah, really it's it's 
just making a POST HTTP request,

301
00:17:47,360 --> 00:17:50,520
I guess from the front end 
that's being intercepted by this

302
00:17:50,520 --> 00:17:52,520
and and then writing that data 
to the database a. 

303
00:17:53,320 --> 00:17:55,520
Little bit more. 
Probably that architecture that 

304
00:17:55,520 --> 00:17:57,880
you're used to where you have a 
server and a client and you're 

305
00:17:57,880 --> 00:17:59,760
just sending Http://requests 
between the two. 

306
00:18:00,160 --> 00:18:02,640
Yeah, exactly. 
And the cool part in my mind, 

307
00:18:02,640 --> 00:18:06,280
every time you set up a table 
like this in the back end, like 

308
00:18:06,400 --> 00:18:08,280
you don't have to do any of that
plumbing, right. 

309
00:18:08,280 --> 00:18:10,960
So we automatically get all of 
these rest services 

310
00:18:10,960 --> 00:18:14,680
out-of-the-box. 
John could probably breakdown 

311
00:18:14,680 --> 00:18:17,240
RLS for us a little more. 
We're not quite ready for that, 

312
00:18:17,240 --> 00:18:20,960
but we'll we'll get there. 
So that that's how we limit data

313
00:18:20,960 --> 00:18:23,760
kind of going back and forth. 
And if you've used Firebase, 

314
00:18:23,760 --> 00:18:26,640
that's your security rules 
essentially on the back end. 

315
00:18:28,120 --> 00:18:30,440
Well, if you want to, if you 
want to jump into it, it could 

316
00:18:30,440 --> 00:18:32,480
be, it could be a good time. 
While we're talking about data 

317
00:18:32,480 --> 00:18:34,280
and we're talking about auth and
all of those things. 

318
00:18:35,000 --> 00:18:39,400
So row level security, what this
does by default is just denies 

319
00:18:39,400 --> 00:18:43,320
all actions. 
So all select, update, insert or

320
00:18:43,320 --> 00:18:47,600
delete actions, Superbase will 
just say, Nah, don't trust you 

321
00:18:47,600 --> 00:18:49,360
don't know, don't know what 
you're doing or Postgres will 

322
00:18:49,360 --> 00:18:53,120
say that, but you know. 
And so then if you want to 

323
00:18:53,120 --> 00:18:55,640
access any of that data, you 
need to write a policy to be 

324
00:18:55,640 --> 00:18:58,120
able to access it. 
So you need to enable each of 

325
00:18:58,120 --> 00:19:01,840
those actions. 
So if we were to enable this on 

326
00:19:01,840 --> 00:19:08,400
the sports table, for example, 
and then you go back and refresh

327
00:19:08,400 --> 00:19:12,640
your sports page. 
Oh sorry, this page. 

328
00:19:13,080 --> 00:19:15,960
Yeah, it's. 
Not gonna see it. 

329
00:19:16,440 --> 00:19:20,080
Everything is broken, so all of 
the this action is is now denied

330
00:19:20,080 --> 00:19:21,920
by default. 
You're not allowed access to 

331
00:19:21,920 --> 00:19:25,560
your own super bases. 
No, if you does that throw like 

332
00:19:25,640 --> 00:19:29,040
a A500 or like 401. 
It'll just give you back an 

333
00:19:29,040 --> 00:19:31,560
empty array because it's not 
that you've done anything wrong,

334
00:19:32,400 --> 00:19:34,960
it's just that. 
So the way that row level 

335
00:19:34,960 --> 00:19:38,680
security works is it will check 
on per row that you're trying to

336
00:19:38,680 --> 00:19:40,920
select. 
Is there a policy that allows 

337
00:19:40,920 --> 00:19:42,960
you to see this? 
And if not, then moves on to the

338
00:19:42,960 --> 00:19:44,160
next one. 
Is there a policy that allows 

339
00:19:44,160 --> 00:19:46,680
you to see this? 
And so it's not actually an 

340
00:19:46,680 --> 00:19:49,680
error, it's just that you don't 
have the authorization level to 

341
00:19:49,680 --> 00:19:51,760
see any of the rows. 
So you just get back an empty 

342
00:19:51,760 --> 00:19:53,360
array. 
So if we want to make it that 

343
00:19:53,360 --> 00:19:55,880
you can actually select some of 
that data, we just need to 

344
00:19:55,880 --> 00:19:59,920
create a policy and we'll say. 
So if you click get started 

345
00:19:59,920 --> 00:20:03,960
quickly, there's a few templates
that we have that you can use. 

346
00:20:04,800 --> 00:20:07,320
But if you go back, we can just,
we can just write this one from 

347
00:20:07,320 --> 00:20:12,200
scratch. 
So we're for full customization 

348
00:20:12,480 --> 00:20:13,960
and then our policy name is just
going to be. 

349
00:20:15,400 --> 00:20:18,040
Authenticated users can select 
sports. 

350
00:20:23,400 --> 00:20:26,160
Sure. 
And so we can select which 

351
00:20:26,160 --> 00:20:28,040
action we want to enable. 
So in this case we want to 

352
00:20:28,040 --> 00:20:31,320
enable select and then we'll 
write a separate policy for 

353
00:20:31,320 --> 00:20:34,440
insert. 
And so this one we could just 

354
00:20:34,440 --> 00:20:38,480
say, well, we could just enable 
it for anyone. 

355
00:20:38,480 --> 00:20:40,600
How about we do that? 
How about we enable or select 

356
00:20:40,600 --> 00:20:42,280
for everyone? 
And then our insert policy can 

357
00:20:42,280 --> 00:20:46,840
just be if you're signed in. 
So it's as simple as just 

358
00:20:46,840 --> 00:20:51,320
writing in the expression part. 
This is just an expression that 

359
00:20:51,400 --> 00:20:53,000
evaluates to either true or 
false. 

360
00:20:53,400 --> 00:20:55,560
So you can put any, any kind of 
condition in here that's going 

361
00:20:55,560 --> 00:20:59,120
to give you a boolean result. 
And so since we want to just 

362
00:20:59,120 --> 00:21:02,320
enable it, we can just write 
true, which is just going to 

363
00:21:02,320 --> 00:21:08,200
enable all, all select access. 
So now it anyone can read this 

364
00:21:08,200 --> 00:21:10,320
data. 
So now if you click review, we 

365
00:21:10,320 --> 00:21:13,040
can see that the SQL that this 
generates actually isn't that 

366
00:21:13,040 --> 00:21:15,840
scary. 
It's really just the fields that

367
00:21:15,840 --> 00:21:19,120
we just entered. 
And yeah, that's that's one 

368
00:21:19,120 --> 00:21:21,360
thing that I think we try and do
as much as possible at Superbase

369
00:21:21,360 --> 00:21:25,040
is try and surface what's 
actually the the SQL that's been

370
00:21:25,040 --> 00:21:27,440
generated and running behind the
scenes because we give you full 

371
00:21:27,440 --> 00:21:29,120
access to the Postgres instance,
so. 

372
00:21:29,520 --> 00:21:31,000
I really love that. 
That's cool. 

373
00:21:31,720 --> 00:21:35,560
So let's click save policy and 
that's going to run that SQL on 

374
00:21:35,560 --> 00:21:39,600
our on our table. 
And now if we refresh the page, 

375
00:21:39,600 --> 00:21:41,520
we should hopefully see some 
sports again. 

376
00:21:42,520 --> 00:21:46,320
Woo Hoo, we're in. 
And then if we wanted to click 

377
00:21:46,320 --> 00:21:50,200
Ad Sport, you'll see that that 
also probably fails. 

378
00:21:51,000 --> 00:21:52,720
And have you handled it nicely 
in the I? 

379
00:21:53,000 --> 00:21:56,280
I haven't thrown any messages. 
There you go, and. 

380
00:21:56,880 --> 00:22:00,400
Now this one should give us an 
error because what we're trying 

381
00:22:00,400 --> 00:22:02,960
to do, we're not allowed to do. 
So with SELECT, it's it's 

382
00:22:02,960 --> 00:22:04,800
checking every row to see 
whether we're allowed to see 

383
00:22:04,800 --> 00:22:08,200
that specific row. 
But it it, it could be fine that

384
00:22:08,200 --> 00:22:10,760
we can't see any of those rows. 
But if we're trying to insert, 

385
00:22:10,760 --> 00:22:13,000
we're explicitly not allowed to 
insert anything. 

386
00:22:13,000 --> 00:22:17,680
So we get this new row, row 
level violation. 

387
00:22:17,680 --> 00:22:20,160
Something, something new row 
violates row level security 

388
00:22:20,160 --> 00:22:24,080
policy for table sports. 
Anytime you see that error, it 

389
00:22:24,080 --> 00:22:26,280
should trigger in your mind. 
Hang on, I probably need a 

390
00:22:26,280 --> 00:22:29,120
policy for this. 
Anytime you see row level 

391
00:22:29,120 --> 00:22:32,120
security, anything, then yeah, 
it's time to go write a policy. 

392
00:22:32,560 --> 00:22:35,040
So let's go to the Postgres. 
Sorry, Superbase instance. 

393
00:22:36,120 --> 00:22:39,200
So the the auth side of this, 
John, like for the most part, 

394
00:22:39,200 --> 00:22:43,280
we're passing JWT tokens around.
So it tells us who it is. 

395
00:22:43,280 --> 00:22:46,320
So on a REST call, it's 
typically like a auth header 

396
00:22:46,320 --> 00:22:50,160
bearer token that you guys use 
and that gets passed in, passed 

397
00:22:50,160 --> 00:22:50,920
in. 
Yeah. 

398
00:22:50,920 --> 00:22:52,520
So all of that plumbing happens 
for you. 

399
00:22:52,520 --> 00:22:55,400
So because you're signing in 
through Superbase, in your 

400
00:22:55,400 --> 00:22:58,520
account lives in Superbase, and 
we're the ones that have said, 

401
00:22:58,520 --> 00:23:01,840
Yep, cool, you're signed in. 
All of that stuff gets plumbed 

402
00:23:01,840 --> 00:23:03,920
through to any of these queries 
as well. 

403
00:23:03,920 --> 00:23:07,440
So we can write RLS policies 
that can check who that user is,

404
00:23:07,440 --> 00:23:10,200
which is exactly what we're 
going to do for our inserts. 

405
00:23:10,200 --> 00:23:11,760
So let's do full customization 
again. 

406
00:23:12,840 --> 00:23:16,840
And then this will just be that 
a user can insert an 

407
00:23:16,840 --> 00:23:20,480
authenticated user. 
Let's let's just do 

408
00:23:20,480 --> 00:23:24,440
authenticated because just like,
yeah. 

409
00:23:26,040 --> 00:23:26,520
OK. 
Yeah. 

410
00:23:27,400 --> 00:23:29,840
And then insert is what we're 
writing a policy for. 

411
00:23:30,760 --> 00:23:33,920
And then we can use a special 
helper that Superbase gives us, 

412
00:23:33,920 --> 00:23:38,480
which is auth dot UID, which is 
a function. 

413
00:23:38,480 --> 00:23:41,000
So we do the curly brackets to 
call it. 

414
00:23:41,560 --> 00:23:44,960
And so this is going to give us 
back the user ID for the user 

415
00:23:44,960 --> 00:23:46,360
who's trying to make this 
request. 

416
00:23:46,360 --> 00:23:48,960
So whoever is signed in. 
So then we can check whether 

417
00:23:48,960 --> 00:23:52,000
that equals a particular column 
of the row that's trying to be 

418
00:23:52,000 --> 00:23:55,120
selected. 
So if we say equals, well, space

419
00:23:55,120 --> 00:23:58,680
equals and then no, just single 
equals, we're in post grassland.

420
00:23:58,880 --> 00:24:02,520
Right, I haven't, I haven't 
written sequel in like 6 years. 

421
00:24:03,720 --> 00:24:07,480
So we want to check whether that
auth dot UID that that ID that 

422
00:24:07,480 --> 00:24:11,680
we get back is equal to Oh, 
actually, no, sorry, we don't 

423
00:24:11,680 --> 00:24:13,480
want to do this. 
We don't want to use UID. 

424
00:24:13,480 --> 00:24:15,320
We, I was, I was trying to 
think, hang on, why? 

425
00:24:15,320 --> 00:24:17,760
Why are we checking their ID? 
What column we're checking it 

426
00:24:17,760 --> 00:24:18,880
against? 
All we want to check is that 

427
00:24:18,880 --> 00:24:20,960
they're actually signed in. 
So we can use another helper 

428
00:24:20,960 --> 00:24:25,840
function which is auth dot roll 
and we just want to check 

429
00:24:25,840 --> 00:24:31,600
whether that equals the text. 
So single quotes, I think 

430
00:24:32,840 --> 00:24:40,920
authenticated and just click 
review and we'll see if we if 

431
00:24:40,920 --> 00:24:43,400
everything's all good. 
So we'll do save policy. 

432
00:24:45,400 --> 00:24:48,880
I guess we'll find out. 
We'll find out very quickly. 

433
00:24:48,880 --> 00:24:50,480
Let's click that add sports 
button. 

434
00:24:50,800 --> 00:24:55,800
Hey, awesome. 
So, so the auth dot role, that's

435
00:24:55,800 --> 00:24:57,880
another helper function that we 
get from Superbase that just 

436
00:24:57,880 --> 00:24:59,880
checks whether what their role 
is. 

437
00:24:59,880 --> 00:25:02,240
And so if they don't have a 
role, then they're not signed 

438
00:25:02,240 --> 00:25:03,440
in. 
If they have the role 

439
00:25:03,440 --> 00:25:06,040
authenticated, then we know that
Superbase has given them the 

440
00:25:06,040 --> 00:25:09,640
thumbs up. 
And then, yeah, we could extend 

441
00:25:09,640 --> 00:25:11,400
that and add our own role. 
Roles. 

442
00:25:12,600 --> 00:25:15,600
Yeah, cool. 
Let's let's talk a minute. 

443
00:25:15,600 --> 00:25:19,280
So that's, that's kind of like 
how we're pushing data in how we

444
00:25:19,280 --> 00:25:22,240
can read a table. 
Now we have like roles set up to

445
00:25:22,240 --> 00:25:24,720
like secure our database the way
it should be. 

446
00:25:25,800 --> 00:25:28,800
There's this one tricky part 
with like the difference on 

447
00:25:28,800 --> 00:25:30,960
Firebase. 
Here is how you actually see 

448
00:25:30,960 --> 00:25:33,560
messages. 
So in in Firebase land, like 

449
00:25:33,560 --> 00:25:37,160
we're just hitting that same 
table and as it updates, it just

450
00:25:37,160 --> 00:25:41,200
kind of filters down a 
synchronous what's the word? 

451
00:25:41,200 --> 00:25:45,080
I'm looking for RXJS observable 
type of situation, right? 

452
00:25:45,160 --> 00:25:46,920
So we don't have to really do 
much on there. 

453
00:25:47,480 --> 00:25:51,480
However, in in the Superbase 
world, we actually need to do 

454
00:25:51,480 --> 00:25:53,320
this subscription side of 
things. 

455
00:25:53,320 --> 00:25:56,880
So can you talk through kind of 
what like Superbase from and 

456
00:25:56,880 --> 00:26:02,120
then this subscription does? 
Yeah, so one thing actually, we 

457
00:26:02,120 --> 00:26:05,120
can show kind of the problem of,
of what's going on here, 'cause 

458
00:26:05,120 --> 00:26:09,440
if we if you click add sports 
again, we get a new sport. 

459
00:26:09,760 --> 00:26:11,280
And so this is adding a new 
sport. 

460
00:26:11,840 --> 00:26:14,160
But if you open this up, I don't
know if you can do this, but can

461
00:26:14,160 --> 00:26:19,040
you open up like a a private tab
or something and go back to 

462
00:26:19,040 --> 00:26:20,280
local host? 
Maybe you? 

463
00:26:20,760 --> 00:26:24,720
Might need to create a a second 
account. 

464
00:26:26,520 --> 00:26:28,440
You have another one. 
Oh cool. 

465
00:26:28,640 --> 00:26:31,680
If you want to sign in as the 
other user, actually it 

466
00:26:31,680 --> 00:26:33,160
shouldn't matter. 
You could sign in as either. 

467
00:26:34,520 --> 00:26:35,800
Oh, either one. 
Yeah, 

468
00:26:45,920 --> 00:26:49,240
this is the problem, folks with 
too many profiles and emails and

469
00:26:49,240 --> 00:26:56,320
things. 
OK, I think we're good. 

470
00:26:57,120 --> 00:26:59,360
So we now have. 
So if you go to sports, you 

471
00:26:59,360 --> 00:27:03,280
wouldn't I Yeah, if you go, if 
you go to. 

472
00:27:03,280 --> 00:27:08,000
The you know what triggy Parjan 
is with this magic link I got to

473
00:27:08,000 --> 00:27:12,960
do it in this Incognito windows.
Yeah, and now you get an error 

474
00:27:12,960 --> 00:27:14,480
because you've already used it 
in the other one. 

475
00:27:14,760 --> 00:27:17,040
Yes, see this is this is some of
the fun. 

476
00:27:17,240 --> 00:27:21,560
All right, my bad. 
And so, yeah, what we're just to

477
00:27:21,560 --> 00:27:23,320
explain why you're going through
this, what we're trying to 

478
00:27:23,320 --> 00:27:27,160
simulate is having, even though 
it is the same user signed in, 

479
00:27:27,160 --> 00:27:30,520
just having 2-2 people using the
app at the same time. 

480
00:27:31,560 --> 00:27:33,080
Here I've got another one. 
I'll do this. 

481
00:27:33,680 --> 00:27:39,840
All right. 
In the right e-mail here. 

482
00:27:47,760 --> 00:27:50,560
Make sure you copy and paste it.
I know, I almost clicked it 

483
00:27:50,600 --> 00:27:50,960
again. 
It's. 

484
00:27:52,200 --> 00:27:54,040
Just it's just begging to be 
clicked. 

485
00:27:54,240 --> 00:27:58,520
I mean, so inviting. 
So if you go to sports now and 

486
00:27:58,800 --> 00:28:01,200
you should see all of the same 
sports 'cause they're they're 

487
00:28:01,200 --> 00:28:04,200
all available for both users or 
that they've got different 

488
00:28:04,200 --> 00:28:06,640
pictures, but. 
Yeah, ignore the faker images 

489
00:28:06,640 --> 00:28:07,680
folks. 
Sorry about that. 

490
00:28:08,320 --> 00:28:11,640
Probably not an example. 
If you click add sports on this 

491
00:28:11,640 --> 00:28:13,240
window, we'll see that the 
window. 

492
00:28:13,760 --> 00:28:16,320
Oh no, it does. 
Have we already wired it up? 

493
00:28:16,840 --> 00:28:18,240
Have you already got? 
Yes, yes. 

494
00:28:18,240 --> 00:28:20,240
So I could I could turn that 
off. 

495
00:28:20,640 --> 00:28:23,840
Let's comment that out for a 
second and save and we can just 

496
00:28:23,840 --> 00:28:26,880
show. 
I don't know if you can hear 

497
00:28:26,880 --> 00:28:30,520
that big truck that went past, 
but my office is shaken. 

498
00:28:32,400 --> 00:28:35,560
Probably, yeah, I was. 
And then just the in the return,

499
00:28:35,560 --> 00:28:42,200
yeah. 
That sub sub is not required. 

500
00:28:45,200 --> 00:28:48,480
OK, So before we have real time 
subscriptions, if we add if we 

501
00:28:48,480 --> 00:28:51,720
click add sports on either of 
these, it's only going. 

502
00:28:53,240 --> 00:28:55,360
It it won't update at all right?
Because. 

503
00:28:55,440 --> 00:28:56,600
Yeah, right. 
Cool. 

504
00:28:56,840 --> 00:29:02,880
So when you call, haven't you 
got set sports after the when 

505
00:29:02,880 --> 00:29:04,800
you oh, you're just selecting 
from the first. 

506
00:29:06,160 --> 00:29:10,560
OK, So yeah, when you do the 
insert, you can get back the 

507
00:29:10,560 --> 00:29:15,480
data that you're that you're 
inserting in and then spread it 

508
00:29:15,480 --> 00:29:17,040
into the object. 
But that's not what we want to 

509
00:29:17,040 --> 00:29:19,320
do because then that would only 
work for one user was what I was

510
00:29:19,320 --> 00:29:22,960
trying to trying to demonstrate 
is just like the one user who's 

511
00:29:22,960 --> 00:29:26,520
signed in clicking add sports, 
it's going to update because 

512
00:29:26,520 --> 00:29:30,040
they're the one that inserted 
it, but the other one doesn't 

513
00:29:30,040 --> 00:29:32,200
know anything about that. 
So if we want to subscribe to 

514
00:29:32,200 --> 00:29:34,560
changes that are happening in 
the database, rather than just 

515
00:29:34,560 --> 00:29:38,040
needing to keep a track of that 
state in our, in our front end, 

516
00:29:38,240 --> 00:29:40,320
then that's why we would use 
subscriptions. 

517
00:29:40,360 --> 00:29:44,920
And so Superbase has a real time
server that just basically pumps

518
00:29:44,920 --> 00:29:50,040
out all of the any changes in 
the database through web 

519
00:29:50,040 --> 00:29:52,360
sockets. 
And so we get to use magical web

520
00:29:52,360 --> 00:29:55,440
socket technology without 
needing to actually set that up 

521
00:29:55,440 --> 00:30:00,200
at all. 
And so I'm going to actually set

522
00:30:00,200 --> 00:30:03,800
the subscription instead of 
setting the data, I'll just do a

523
00:30:03,800 --> 00:30:06,720
console log just so we can take 
a peek at like what it's 

524
00:30:06,720 --> 00:30:08,720
actually sending back. 
It's a good call. 

525
00:30:11,680 --> 00:30:15,120
So now if you click the ad 
sports, So what this is doing is

526
00:30:15,120 --> 00:30:17,640
it's going and inserting into 
the database and then the 

527
00:30:17,640 --> 00:30:20,720
subscription is listening to any
changes on that table that are 

528
00:30:20,720 --> 00:30:24,160
happening. 
Yeah, and I noticed you can do 

529
00:30:24,160 --> 00:30:29,360
like a from like star, like any 
change over any table, you can 

530
00:30:29,600 --> 00:30:32,040
check for updates. 
So you can like be listening to 

531
00:30:32,040 --> 00:30:33,280
everything, which is pretty 
wild. 

532
00:30:34,400 --> 00:30:36,440
Yeah, well, I just, I just 
noticed you're. 

533
00:30:36,840 --> 00:30:39,600
So what you're doing currently 
is you're, you're setting up a 

534
00:30:39,600 --> 00:30:42,640
subscription and anytime. 
So you're you're setting a 

535
00:30:42,640 --> 00:30:44,160
subscription on the sports 
table. 

536
00:30:44,520 --> 00:30:46,120
Yeah, I've got a, I've got a 
cursor. 

537
00:30:46,760 --> 00:30:50,600
Yeah, you're, you're setting a 
subscription on sports and 

538
00:30:50,600 --> 00:30:54,400
you're saying you want to oh, 
sorry, up here, what am I doing?

539
00:30:55,360 --> 00:30:59,240
So you're saying from this table
you want to subscribe to any 

540
00:30:59,240 --> 00:31:01,560
events. 
So this star means anything that

541
00:31:01,560 --> 00:31:03,600
changes that's inserts, updates,
deletes. 

542
00:31:05,560 --> 00:31:09,240
And then anytime something does 
change, this function is going 

543
00:31:09,240 --> 00:31:14,520
to be called by Superbase JS. 
And So what you're doing here is

544
00:31:14,520 --> 00:31:18,240
you're going and selecting all 
of the sports again, like, which

545
00:31:18,240 --> 00:31:20,240
is identical to what you're 
doing here. 

546
00:31:21,280 --> 00:31:26,560
But in this payload, we actually
already have the the data of the

547
00:31:26,560 --> 00:31:29,080
thing that that has happened, 
the event that has happened. 

548
00:31:29,360 --> 00:31:36,280
So how about we comment out this
section and we just console log 

549
00:31:38,080 --> 00:31:40,520
is a great way to do it. 
Live coding, that's where it's 

550
00:31:40,520 --> 00:31:42,000
at. 
I'm telling you, this is so 

551
00:31:42,000 --> 00:31:43,800
cool, isn't it? 
Awesome. 

552
00:31:44,360 --> 00:31:50,400
And so now if we click add 
sports again and then I think 

553
00:31:50,400 --> 00:31:53,600
our heads are in the way of 
being able to see it on the 

554
00:31:53,640 --> 00:31:55,320
we'll. 
Get us out. 

555
00:31:56,000 --> 00:31:58,360
Of the way for me. 
We'll come back OK. 

556
00:31:58,840 --> 00:32:00,840
We'll miss this too much, folks.
Good. 

557
00:32:02,240 --> 00:32:04,680
So yeah, we've got our payload 
and then this is what's actually

558
00:32:04,680 --> 00:32:06,760
changed. 
So you'll see we have this new 

559
00:32:06,760 --> 00:32:10,960
object and this old object. 
So this is the new data because 

560
00:32:10,960 --> 00:32:14,360
we're subscribing to all events.
If this was an update event, 

561
00:32:14,360 --> 00:32:17,000
then you would have old would be
set to the old record and you 

562
00:32:17,000 --> 00:32:21,000
would be set to the new record. 
And so because we're inserting 

563
00:32:21,160 --> 00:32:24,200
old is is blank because there 
was no record and new is set to 

564
00:32:24,200 --> 00:32:28,560
this new inserted row. 
And you'll see we have all of 

565
00:32:28,560 --> 00:32:34,960
the data from our from that row.
So all of the columns of of that

566
00:32:34,960 --> 00:32:37,520
newly added data. 
So we don't actually need to 

567
00:32:38,640 --> 00:32:42,040
make another call to Superbase 
to get all of the sports back, 

568
00:32:42,040 --> 00:32:45,640
which is what we were doing on 
in this code that I've commented

569
00:32:45,640 --> 00:32:47,960
out because it's already in the 
payload. 

570
00:32:48,520 --> 00:32:55,640
So we can just do the, yeah, 
we'll need to manually do some 

571
00:32:55,640 --> 00:32:59,000
magic here, but we can set the 
sports to being, we'll get the 

572
00:32:59,000 --> 00:33:03,240
current sports. 
The value of the current sports 

573
00:33:03,240 --> 00:33:05,280
is that's going to be that array
of all of our sports. 

574
00:33:05,720 --> 00:33:08,400
And then we just want to create 
a new array where we spread in 

575
00:33:08,680 --> 00:33:15,040
the current and then our payload
dot new is going to be that new 

576
00:33:15,040 --> 00:33:16,560
object. 
Does that make sense? 

577
00:33:16,760 --> 00:33:19,720
Yeah, totally. 
I'm curious on that though that 

578
00:33:19,720 --> 00:33:22,640
sorting might be. 
Yeah, we'll see. 

579
00:33:22,640 --> 00:33:26,840
We'll see. 
So now if we click add support 

580
00:33:26,840 --> 00:33:29,320
again, do it, does it come in at
the top or at the end? 

581
00:33:29,320 --> 00:33:31,160
I. 
Think the end. 

582
00:33:31,600 --> 00:33:35,680
OK, so all we need to do is just
reverse the position of these 

583
00:33:35,680 --> 00:33:38,400
two. 
So if we take this and put this 

584
00:33:38,400 --> 00:33:41,360
as the first value in our array 
and then we spread in the rest 

585
00:33:41,360 --> 00:33:44,120
of the array and. 
Now you go we're. 

586
00:33:44,120 --> 00:33:46,800
Back to the same that same 
functionality. 

587
00:33:48,720 --> 00:33:51,720
And so the venting mechanism, 
like if we were to leave this 

588
00:33:51,720 --> 00:33:55,760
page how it is just for other 
folks to understand this, if you

589
00:33:55,760 --> 00:33:58,920
were on another page and you 
were, you were creating the 

590
00:33:58,920 --> 00:34:02,320
sport, it's still going to pick 
up that same event, even though 

591
00:34:02,320 --> 00:34:04,800
it's two different people 
causing the event. 

592
00:34:04,800 --> 00:34:08,120
So this this code still works. 
So it's like if you're adding to

593
00:34:08,120 --> 00:34:11,880
Twitter and you're getting that 
live page update coming in, same

594
00:34:11,880 --> 00:34:15,159
deal like boop, boop, boop. 
Yeah, cool. 

595
00:34:15,840 --> 00:34:18,520
Yeah. 
So no matter who is is is 

596
00:34:18,520 --> 00:34:22,040
causing that event to happen 
anytime every user that's signed

597
00:34:22,040 --> 00:34:28,080
in is now subscribing to or the 
the UI is subscribing to any 

598
00:34:28,080 --> 00:34:32,120
changes that are happening in 
the in the the database. 

599
00:34:33,280 --> 00:34:36,840
The cool thing about this though
a a fairly recent addition maybe

600
00:34:36,840 --> 00:34:43,080
like 3 months ago or so, but is 
that this now honours RLS as 

601
00:34:43,080 --> 00:34:45,040
well. 
So these real time subscriptions

602
00:34:45,040 --> 00:34:48,120
now run through the same same 
kind of piping as any regular 

603
00:34:48,120 --> 00:34:52,320
select statement. 
And so if we had an RLS policy 

604
00:34:52,560 --> 00:34:57,120
that said that we weren't 
allowed to to read this 

605
00:34:57,120 --> 00:34:59,000
particular. 
Like I can't. 

606
00:34:59,280 --> 00:35:01,440
I can't see John's updates. 
It would. 

607
00:35:01,480 --> 00:35:02,400
Yeah, exactly. 
Yeah. 

608
00:35:02,400 --> 00:35:06,840
If if we had an RLS policy that 
said I can like John can only 

609
00:35:06,840 --> 00:35:12,920
select sports that he's created,
then that the subscription will 

610
00:35:12,920 --> 00:35:17,040
automatically only subscribe to 
or only get published events 

611
00:35:17,040 --> 00:35:21,360
that John is actually allowed to
see and so you wouldn't get my 

612
00:35:21,400 --> 00:35:23,960
sports. 
That's that's exactly how the 

613
00:35:24,240 --> 00:35:26,200
functionality works in Amplify 
too. 

614
00:35:26,200 --> 00:35:28,960
So when you're at that level for
them inventing, that's really 

615
00:35:28,960 --> 00:35:30,520
cool. 
They're they're doing those 

616
00:35:30,520 --> 00:35:32,960
through app sync. 
Yeah, App sync, right? 

617
00:35:33,240 --> 00:35:35,040
And so, yeah, that's the benefit
of everything you just 

618
00:35:35,040 --> 00:35:36,920
mentioned. 
And Superbase, like they all 

619
00:35:37,080 --> 00:35:39,560
take care of oath for you and 
the data layer. 

620
00:35:39,600 --> 00:35:43,720
And so because you know who that
user is, we can do cool things 

621
00:35:43,720 --> 00:35:46,360
in the data layer to know what 
that user should be able to see.

622
00:35:46,960 --> 00:35:52,320
Awesome, love this. 
So now is kind of the the next 

623
00:35:52,320 --> 00:35:55,880
phase of this that we'll get 
into Basically we want to start 

624
00:35:55,880 --> 00:35:59,000
to like utilize what we have in 
Superbase now. 

625
00:35:59,000 --> 00:36:03,320
So kind of think of this as an 
admin type of back end, if you 

626
00:36:03,320 --> 00:36:05,160
will, like only logged in 
people. 

627
00:36:05,160 --> 00:36:07,400
Even though we're kind of 
allowing everyone, typically 

628
00:36:07,400 --> 00:36:10,600
we'd have like an actual role 
base for Adam admin. 

629
00:36:11,960 --> 00:36:15,040
But what we want to do for this 
homepage now, instead of doing 

630
00:36:15,040 --> 00:36:18,320
that index, I'm going to go 
ahead and put back this path, 

631
00:36:19,040 --> 00:36:25,680
restore that, pull out the 
index, see how bad this 

632
00:36:25,680 --> 00:36:30,280
complaints. 
OK, so this page and this is 

633
00:36:30,640 --> 00:36:32,520
probably new for John, it sounds
like. 

634
00:36:32,960 --> 00:36:36,600
So definitely ask me questions. 
This is this is helping me learn

635
00:36:36,920 --> 00:36:40,640
as we go as well. 
So this is going to set up our 

636
00:36:40,640 --> 00:36:45,120
builder IO feature, I guess of 
our our page. 

637
00:36:45,560 --> 00:36:48,920
So what we have here is in 
builder IO. 

638
00:36:49,280 --> 00:36:53,200
So if, if you haven't done this 
before, go up to builder IO, you

639
00:36:53,200 --> 00:36:57,840
can get, you can go to get 
started and you'll sign up and 

640
00:36:57,840 --> 00:37:00,280
you have an account and then you
create a space. 

641
00:37:00,760 --> 00:37:04,320
And so for us, this is our our 
new space that we created. 

642
00:37:04,880 --> 00:37:08,240
I've created a home page here 
and I'm gonna walk through that 

643
00:37:08,240 --> 00:37:11,280
again, just so like everyone 
understands how this works. 

644
00:37:11,280 --> 00:37:19,200
So I'm gonna go ahead and 
archive this if I can click the 

645
00:37:19,200 --> 00:37:22,600
right button. 
OK, so that home page is gone. 

646
00:37:22,640 --> 00:37:26,600
It should now, I believe it'll. 
There you go, 404. 

647
00:37:26,880 --> 00:37:32,240
So that's gone if I now just 
create a new page and call this 

648
00:37:32,240 --> 00:37:33,840
home. 
But we're gonna leave just the 

649
00:37:33,840 --> 00:37:35,400
slash 'cause that's where we're 
at. 

650
00:37:36,400 --> 00:37:40,920
I can actually pick any template
out here that we want to and 

651
00:37:40,920 --> 00:37:43,640
throw that in here. 
So I'm just gonna pick. 

652
00:37:44,120 --> 00:37:45,880
I don't know what. 
All looks good, John. 

653
00:37:47,400 --> 00:37:51,440
I like the yeah those animated 
purple people. 

654
00:37:51,800 --> 00:37:53,920
These people love them. 
I like those. 

655
00:37:54,680 --> 00:37:57,400
Very hip, very in. 
I think that's from Undraw so 

656
00:37:57,400 --> 00:38:00,280
shout out to what's her name? 
I can never remember her name. 

657
00:38:01,120 --> 00:38:04,440
The undraw person. 
It's very cool. 

658
00:38:05,440 --> 00:38:08,800
So at this point what we're 
actually doing now is previewing

659
00:38:08,800 --> 00:38:12,440
and the only way you can really 
notice at this point is we have 

660
00:38:12,440 --> 00:38:16,160
this home user sports animals. 
So we're we're sitting on local 

661
00:38:16,160 --> 00:38:20,280
host 3000 at this point. 
And if I do publish, like if I, 

662
00:38:20,280 --> 00:38:23,560
if I don't do publish right, 
we're still getting a four O 4 

663
00:38:24,200 --> 00:38:27,920
and we won't get any page here. 
However, I can go into this 

664
00:38:27,920 --> 00:38:30,920
draft view and it throws all 
these fun. 

665
00:38:30,920 --> 00:38:32,520
I don't know why this is 
happening by the way. 

666
00:38:34,000 --> 00:38:38,080
I think I know why this happens 
because I think we are currently

667
00:38:38,640 --> 00:38:41,960
trying because I've now enabled 
RLS. 

668
00:38:42,000 --> 00:38:47,960
I've broken your entire 
everything I think. 

669
00:38:47,960 --> 00:38:51,400
This feels like it's a builder 
side of things though, which is.

670
00:38:51,680 --> 00:38:55,520
Maybe, but it might because 
you're oh what is oh, that API 

671
00:38:55,520 --> 00:38:58,920
key is a builder API key. 
Yeah, and it should be 

672
00:38:59,120 --> 00:39:02,160
expecting. 
I yeah, I don't know why, why 

673
00:39:02,160 --> 00:39:04,840
that's coming through. 
So ignore that for now. 

674
00:39:04,920 --> 00:39:08,080
We'll we'll get there. 
So at this point, you can 

675
00:39:08,080 --> 00:39:13,480
actually publish this page and 
then on this side, we should get

676
00:39:13,800 --> 00:39:18,160
our page. 
Cool so within within builder, 

677
00:39:18,160 --> 00:39:21,560
you're also seeing all these 
boxes kind of light up right? 

678
00:39:21,640 --> 00:39:25,800
So all of this is these are just
different layers sitting inside 

679
00:39:25,800 --> 00:39:27,960
of here. 
So if I want to remove make 

680
00:39:27,960 --> 00:39:32,040
things great, boom, I removed it
and now our page will update and

681
00:39:32,040 --> 00:39:37,880
this is just like whatever 
WordPress web flow, you name it,

682
00:39:37,960 --> 00:39:43,080
visual editing cool right. 
So this is not the aha moment 

683
00:39:43,080 --> 00:39:47,120
yet like we, we always call it 
the aha moment what we want to 

684
00:39:47,120 --> 00:39:50,600
look at in here and I'll, I'll 
just blank this entire page out 

685
00:39:50,600 --> 00:39:53,120
now. 
So we just start with this ad 

686
00:39:53,120 --> 00:39:55,320
block and that's that's the only
thing we have. 

687
00:39:55,400 --> 00:39:59,360
And so John was telling me about
kind of some of this these off 

688
00:39:59,360 --> 00:40:03,680
components that we can get into.
And I believe let's see here. 

689
00:40:04,960 --> 00:40:08,680
Are any of these the pre canned 
ones in your examples? 

690
00:40:08,680 --> 00:40:10,840
Probably not. 
Are we? 

691
00:40:10,880 --> 00:40:13,240
Building an off page 
specifically Or should we just 

692
00:40:13,240 --> 00:40:16,760
build a like pulling the the 
data back out and displaying it 

693
00:40:16,760 --> 00:40:19,320
in builder? 
So that's where I was originally

694
00:40:19,320 --> 00:40:20,360
heading. 
I don't know if we might have 

695
00:40:20,360 --> 00:40:22,760
broke that with the RLS piece. 
But let's no, no, we'll we'll 

696
00:40:22,760 --> 00:40:25,800
just need to, we'll, we'll, 
we'll need to nudge it slightly,

697
00:40:25,800 --> 00:40:26,920
but it'll work. 
It'll. 

698
00:40:26,920 --> 00:40:29,960
Work. 
So the cool part, let's talk 

699
00:40:29,960 --> 00:40:32,080
about that a minute on the next 
GS side. 

700
00:40:32,080 --> 00:40:33,920
So I'll make this a little 
bigger. 

701
00:40:33,920 --> 00:40:36,280
Hopefully we can kind of check 
this out for a minute. 

702
00:40:37,480 --> 00:40:41,160
So let me go back into the path 
area here and talk through this 

703
00:40:41,160 --> 00:40:45,080
just for a second. 
So on path, what we have here is

704
00:40:45,080 --> 00:40:47,960
our builder set up and our 
builder API key. 

705
00:40:47,960 --> 00:40:51,160
So we have the API key being 
registered here. 

706
00:40:51,160 --> 00:40:53,880
And basically what this is 
asking for, and actually this 

707
00:40:53,880 --> 00:40:56,320
might be what's broke breaking 
it 'cause I forgot I put that 

708
00:40:56,320 --> 00:40:57,880
personalization stuff in 
already. 

709
00:40:58,800 --> 00:41:02,520
What what we're basically saying
here is go into builder and 

710
00:41:02,520 --> 00:41:06,480
where the URL path matches slash
in our case, 'cause there's 

711
00:41:06,480 --> 00:41:11,000
nothing after it, go find that 
page and then provide that data 

712
00:41:11,000 --> 00:41:13,680
back to us in this page 
parameter. 

713
00:41:13,680 --> 00:41:16,920
So get static props is happening
on the server. 

714
00:41:17,320 --> 00:41:20,560
It fetches that page on the 
server and then it provides that

715
00:41:20,560 --> 00:41:26,680
page data back to us and that 
page data comes in as a param. 

716
00:41:27,040 --> 00:41:29,360
What's the word I'm looking for?
It is late, John. 

717
00:41:29,360 --> 00:41:32,680
I'm telling you parameter, I 
guess. 

718
00:41:32,680 --> 00:41:35,120
Parameter. 
Yeah, I think prop, there's the 

719
00:41:35,120 --> 00:41:39,760
word immortal in in React world.
So that comes in as a prop. 

720
00:41:39,880 --> 00:41:42,920
And basically we're saying, OK, 
if there isn't a page, go ahead 

721
00:41:42,920 --> 00:41:45,160
and throw an error which we saw 
the 404. 

722
00:41:45,800 --> 00:41:49,560
If this page data is coming 
through, go ahead and put that 

723
00:41:49,560 --> 00:41:53,240
into this builder component. 
And then we have our full 

724
00:41:53,240 --> 00:41:56,000
content page that it creates on 
the server. 

725
00:41:56,000 --> 00:42:00,160
So you're actually creating 
static pages based on the Jason 

726
00:42:00,160 --> 00:42:03,080
data that we're pulling from 
Builder itself. 

727
00:42:03,360 --> 00:42:05,280
So that's kind of the cool, the 
cool part, right? 

728
00:42:05,320 --> 00:42:09,480
Yeah, that's awesome. 
Now the the next part of this is

729
00:42:09,480 --> 00:42:13,880
we can pass any type of state 
based data as well. 

730
00:42:14,520 --> 00:42:18,680
And I have a a cool diagram. 
Maybe I'll share it after this 

731
00:42:18,840 --> 00:42:20,920
how this works. 
I'm gonna actually bring up 

732
00:42:21,200 --> 00:42:25,840
Coding Cats really quick just to
show everyone how to how we do 

733
00:42:25,840 --> 00:42:30,040
this. 
So we actually moved everything 

734
00:42:30,040 --> 00:42:35,080
over on Coding Cat not that long
ago and I have the same kind of 

735
00:42:35,080 --> 00:42:38,440
setup. 
It's a little probably different

736
00:42:38,440 --> 00:42:42,800
though. 
And the the reason I'm looking 

737
00:42:42,800 --> 00:42:45,920
for this is because we pass all 
kinds of data in and I want to 

738
00:42:45,920 --> 00:42:49,240
make sure I'm getting the right 
builder piece here. 

739
00:42:49,240 --> 00:43:05,080
I believe it's this model data. 
OK, yeah. 

740
00:43:05,880 --> 00:43:10,120
So in here, the way that we can 
pass state is through this data 

741
00:43:10,840 --> 00:43:13,960
prop. 
So anything we want as an object

742
00:43:13,960 --> 00:43:17,920
we can pass into that prop from 
data that we're pulling. 

743
00:43:18,800 --> 00:43:20,600
So at this. 
And then that appears in the 

744
00:43:20,600 --> 00:43:24,640
builder IOUI. 
Yeah, so this is this is going 

745
00:43:24,640 --> 00:43:25,920
to break your brain a little. 
Bit. 

746
00:43:26,320 --> 00:43:28,240
Or at least you might get it. 
It broke my brain. 

747
00:43:28,440 --> 00:43:31,320
It's already broken my what? 
It's already impressed my brain.

748
00:43:32,040 --> 00:43:35,520
Fair enough, fair enough. 
So I'm just going to drop that 

749
00:43:35,520 --> 00:43:37,000
data in so I remember what it 
is. 

750
00:43:37,000 --> 00:43:39,760
But basically at this point, and
this is the part I kind of need 

751
00:43:39,760 --> 00:43:43,400
help with on your side, when 
we're doing our get static 

752
00:43:43,400 --> 00:43:47,200
props, I actually want to call 
out to Superbase to be able to 

753
00:43:47,200 --> 00:43:48,520
pull data. 
And this is where you're like, 

754
00:43:48,520 --> 00:43:50,920
let's just stick to client side.
So I don't know if you're ready 

755
00:43:50,920 --> 00:43:53,600
for this. 
No, I am ready for this. 

756
00:43:53,640 --> 00:43:57,720
So the reason that I was the, 
the reason that I thought it 

757
00:43:57,720 --> 00:44:01,000
would, it would take a little 
while to set up is that all of 

758
00:44:01,000 --> 00:44:03,120
our data fetching currently is 
happening client side with 

759
00:44:03,120 --> 00:44:05,040
Superbase. 
And because we're signing in 

760
00:44:05,040 --> 00:44:08,640
client side and all of that 
stuff, Superbase already knows 

761
00:44:08,840 --> 00:44:10,440
all of that our client set up 
correctly. 

762
00:44:10,960 --> 00:44:15,800
When we go through to the server
side, we need to explicitly tell

763
00:44:15,880 --> 00:44:19,880
the server who our user is if we
want to be selecting things on 

764
00:44:19,880 --> 00:44:21,920
behalf of the user. 
But because this is just 

765
00:44:21,920 --> 00:44:26,640
building a static page, this 
data is just like, it doesn't 

766
00:44:26,640 --> 00:44:29,280
matter who the user is that's 
signed in this, this, these 

767
00:44:29,280 --> 00:44:31,800
pages are available to everyone.
So they're not behind like an 

768
00:44:31,880 --> 00:44:36,960
oath wall or anything like that.
So in this case, we can use you 

769
00:44:36,960 --> 00:44:39,560
remember before when we're in 
Superbase and I was pointing out

770
00:44:39,560 --> 00:44:43,960
the a non public key, we can 
actually use the service role 

771
00:44:43,960 --> 00:44:50,600
key in Superbase to create our 
client, which yeah, you might 

772
00:44:50,680 --> 00:44:53,400
you might want to trash this 
instant or re roll your keys 

773
00:44:53,400 --> 00:44:55,640
after we've I'll probably finish
the stream. 

774
00:44:56,320 --> 00:45:00,640
But yes, this service role 
secret key will bypass RLS and 

775
00:45:00,640 --> 00:45:02,440
and basically just give access 
to everything. 

776
00:45:02,440 --> 00:45:07,160
So if we go to your dot EMV dot 
local file, I'm guessing is 

777
00:45:07,160 --> 00:45:09,880
where yeah. 
And then if we create a 

778
00:45:10,440 --> 00:45:13,680
Superbase service key so we 
don't want the next under score 

779
00:45:13,680 --> 00:45:19,080
public in front of it. 
And this is because we don't 

780
00:45:19,160 --> 00:45:22,280
ever want to expose this value 
to the client. 

781
00:45:22,280 --> 00:45:25,040
So this this should be treated 
like your API keys. 

782
00:45:25,040 --> 00:45:30,640
In most other services, the 
unknown key can can be exposed 

783
00:45:30,640 --> 00:45:32,800
to the front end, but the 
service role key never should. 

784
00:45:33,480 --> 00:45:38,040
And just for those who haven't 
used next JS before, when we and

785
00:45:38,040 --> 00:45:40,880
this, this can be really 
confusing if you're just getting

786
00:45:40,880 --> 00:45:43,480
started with it. 
When we are calling get static 

787
00:45:43,480 --> 00:45:45,880
props. 
This is happening server side 

788
00:45:45,880 --> 00:45:49,520
whether it's on. 
So there's get server props I 

789
00:45:49,520 --> 00:45:51,800
believe and get. 
Server side props get static 

790
00:45:51,800 --> 00:45:54,440
props and get initial props. 
I think will run on the server 

791
00:45:54,440 --> 00:45:56,520
as well as anything in your API 
folder. 

792
00:45:56,520 --> 00:45:58,720
So any API route that you have 
in next chance? 

793
00:45:59,320 --> 00:46:02,400
So all of those even though 
we're in a React page 

794
00:46:02,400 --> 00:46:06,480
essentially and you see React 
down here client side, this 

795
00:46:06,480 --> 00:46:08,280
stuff is actually happening on 
server. 

796
00:46:08,280 --> 00:46:10,400
Just clarification. 
OK, cool. 

797
00:46:10,520 --> 00:46:12,240
So how do? 
We, and it's also because we're 

798
00:46:12,240 --> 00:46:16,120
using, get static props to. 
To further confuse this, this 

799
00:46:16,120 --> 00:46:18,360
isn't just happening when the 
user loads the page, but this is

800
00:46:18,360 --> 00:46:21,640
happening when the when the 
server is building the 

801
00:46:21,640 --> 00:46:26,320
application and. 
So or during ISR, so even 

802
00:46:26,400 --> 00:46:29,440
further computers. 
Yeah, yeah, true. 

803
00:46:30,520 --> 00:46:32,280
So it is kind of happening when 
they refresh. 

804
00:46:32,280 --> 00:46:35,440
But anyway, let's let's just 
say, let's not dive into that. 

805
00:46:36,120 --> 00:46:39,080
This is happening when when we 
first create the page, which 

806
00:46:39,080 --> 00:46:40,880
means we don't even have a user 
at that point. 

807
00:46:41,000 --> 00:46:43,840
Like maybe we don't even have 
users sign into our application.

808
00:46:43,840 --> 00:46:46,760
So it doesn't make sense for us 
to use the currently signed in 

809
00:46:46,760 --> 00:46:49,120
user because they don't exist at
build time. 

810
00:46:50,000 --> 00:46:54,120
And so because this is like just
happening on the server and is 

811
00:46:54,120 --> 00:46:56,240
like a server function 
generating pages, that's the 

812
00:46:56,240 --> 00:46:59,440
perfect use case for when we 
would use the service role key 

813
00:46:59,440 --> 00:47:02,120
in Superbase and and sidestep 
RLS. 

814
00:47:03,120 --> 00:47:05,600
So it means that we need to 
create a new client, though we 

815
00:47:05,600 --> 00:47:10,840
can't use the helper that you 
that you used in in the front 

816
00:47:10,840 --> 00:47:14,280
end, this one, because that's 
got that a non key baked into 

817
00:47:14,280 --> 00:47:16,240
it. 
We could create a function where

818
00:47:16,240 --> 00:47:19,360
we could optionally pass it in. 
But yeah, let's just let's just 

819
00:47:19,360 --> 00:47:21,400
create it from scratch in our 
we. 

820
00:47:22,120 --> 00:47:24,840
Do you just want to do this and 
do like a server one? 

821
00:47:25,840 --> 00:47:31,200
Oh yeah cool cool. 
As in that case what we all we 

822
00:47:31,200 --> 00:47:33,480
need to do is change the next 
under score public super based 

823
00:47:33,480 --> 00:47:37,280
on non key to just super based 
service key without the next 

824
00:47:37,280 --> 00:47:39,560
public. 
I'm going to go copy this 

825
00:47:39,560 --> 00:47:41,920
because I will mess this up. 
Guarantee. 

826
00:47:48,760 --> 00:47:53,440
Oops, I totally messed that up. 
Then I I grabbed the wrong cap. 

827
00:47:55,600 --> 00:47:59,520
All right, cool. 
And maybe just to make it even 

828
00:47:59,520 --> 00:48:01,720
more clear, let's make it rather
than super base and non key, 

829
00:48:01,720 --> 00:48:03,720
we'll call the variable super 
based service key. 

830
00:48:03,720 --> 00:48:09,600
Love it. 
And then in the create client as

831
00:48:09,600 --> 00:48:11,760
well. 
Yep, perfect. 

832
00:48:12,200 --> 00:48:14,160
Cool. 
And now we want to pull in this 

833
00:48:14,160 --> 00:48:17,840
super based server. 
And just just for clarification,

834
00:48:17,840 --> 00:48:20,800
John, there's not like a create 
server, it's always create 

835
00:48:20,800 --> 00:48:21,960
client. 
It's just generic. 

836
00:48:21,960 --> 00:48:25,120
Client, yeah, yeah. 
So it's a Superbase client, but 

837
00:48:25,120 --> 00:48:29,080
whether we're using our a non 
key or our service role key 

838
00:48:29,760 --> 00:48:32,720
determines what sort of access 
privileges we have when we 

839
00:48:32,720 --> 00:48:35,480
actually make those requests to 
Superbase. 

840
00:48:36,120 --> 00:48:38,200
Awesome. 
So now we're going to import 

841
00:48:38,280 --> 00:48:48,280
Superbase from server, yeah? 
And then yeah, and so now we can

842
00:48:48,280 --> 00:48:51,480
just do a a regular call. 
So we can just say sports is 

843
00:48:51,480 --> 00:49:01,160
equal to Superbase dot from. 
And then we want to select all 

844
00:49:01,160 --> 00:49:03,080
of the columns. 
So select star. 

845
00:49:04,400 --> 00:49:07,440
And actually if you that'll 
need, yeah, need quotes. 

846
00:49:07,480 --> 00:49:11,960
And then did you want to copy 
across your other sorting logic?

847
00:49:11,960 --> 00:49:15,160
Oh yeah, I guess it doesn't 
really matter, but. 

848
00:49:15,400 --> 00:49:18,840
OK, Yeah. 
Sure, we'll just actually steal 

849
00:49:18,840 --> 00:49:21,240
this whole thing, right? 
Yeah, that works. 

850
00:49:21,960 --> 00:49:28,880
Cool, so then we're going to 
await this I would assume? 

851
00:49:29,400 --> 00:49:31,440
Yep. 
And then get rid of the dot then

852
00:49:32,880 --> 00:49:40,240
and yes, and then sports. 
The the variable sports becomes 

853
00:49:40,280 --> 00:49:41,920
data in curly brackets. 
Yeah. 

854
00:49:43,280 --> 00:49:45,120
Cool, can you do? 
I was phrasing. 

855
00:49:45,160 --> 00:49:46,120
Can you do like? 
Yes. 

856
00:49:46,120 --> 00:49:48,280
So you call that sports. 
Yep. 

857
00:49:49,120 --> 00:49:50,960
And now you'll have a variable 
called sports. 

858
00:49:52,200 --> 00:49:55,160
And so maybe, yeah, let's just 
pass it through. 

859
00:49:55,800 --> 00:50:00,240
And we can pull it in down here 
where we're usually it's that. 

860
00:50:02,720 --> 00:50:05,200
And then I guess we want to pipe
that straight through as our 

861
00:50:05,200 --> 00:50:08,320
data. 
Perfect, I think. 

862
00:50:08,560 --> 00:50:11,240
I think we're good. 
So let's so. 

863
00:50:11,480 --> 00:50:15,600
My magic mixes nicely with your 
magic and gives us like ultra 

864
00:50:15,600 --> 00:50:17,000
magic. 
Like ultra magic. 

865
00:50:17,000 --> 00:50:18,600
I like it. 
Yeah, we're like going. 

866
00:50:18,600 --> 00:50:21,040
To play super magic. 
And then I realized, you know. 

867
00:50:22,520 --> 00:50:25,120
We're building super magic, 
right? 

868
00:50:26,000 --> 00:50:28,120
I use the Super adjective too 
much. 

869
00:50:28,160 --> 00:50:30,600
Like just prior to working at 
Super Mase, I always have to 

870
00:50:30,600 --> 00:50:34,280
catch myself out. 
I I always say perfect, like 

871
00:50:34,280 --> 00:50:36,800
perfect for everything now. 
So same deal. 

872
00:50:36,960 --> 00:50:40,440
We got it the the cool thing 
here. 

873
00:50:40,440 --> 00:50:43,720
Now we'll take a look at this. 
I just wanted for clarification 

874
00:50:43,720 --> 00:50:46,760
on the client side, we had the 
RLS pieces where we're now like 

875
00:50:46,880 --> 00:50:49,720
checking and blocking things. 
Do we have anything when we're 

876
00:50:49,720 --> 00:50:52,000
using that server key? 
It's just wide. 

877
00:50:52,000 --> 00:50:55,240
Open, Yeah. 
So it completely bypasses RLS. 

878
00:50:55,680 --> 00:50:58,960
So it's it's exactly the same as
if you hadn't enabled RLS for 

879
00:50:58,960 --> 00:51:01,720
the. 
So be careful folks, is what 

880
00:51:01,720 --> 00:51:03,680
we're saying. 
Like you can do anything with 

881
00:51:03,680 --> 00:51:06,120
this table now. 
Yeah, which is why we're only 

882
00:51:06,120 --> 00:51:07,920
doing it on the server side, 
because otherwise we would be 

883
00:51:07,920 --> 00:51:11,640
giving clients an access token 
that they could use to do 

884
00:51:11,640 --> 00:51:14,680
anything to our database. 
And so we're only doing this in 

885
00:51:14,680 --> 00:51:16,520
that controlled environment of 
the server. 

886
00:51:16,960 --> 00:51:21,080
Awesome, OK now I hope this 
works. 

887
00:51:21,080 --> 00:51:23,720
It's been a minute since I 
actually played around with the 

888
00:51:23,800 --> 00:51:28,800
the builder side of this. 
There should be on this side 

889
00:51:28,800 --> 00:51:31,800
now. 
What's happening? 

890
00:51:33,240 --> 00:51:39,160
What did Alex mess up? 
I wonder if we're getting an 

891
00:51:39,160 --> 00:51:45,600
error on the superbase side of 
things. 500 internal error 

892
00:51:45,600 --> 00:51:48,320
Superbase client Yeah, I thought
this might might be a problem. 

893
00:51:48,320 --> 00:51:54,440
So because we are importing 
Superbase in this, I think it's 

894
00:51:54,440 --> 00:51:59,000
still trying to run that code on
the client side. 

895
00:51:59,000 --> 00:52:04,040
Where our? 
Oh actually did you restart the 

896
00:52:04,040 --> 00:52:06,920
dev server Whenever we add a dot
amb dot. 

897
00:52:07,240 --> 00:52:08,720
Yeah. 
Value. 

898
00:52:10,160 --> 00:52:12,800
There we go. 
Now let's see if that just 

899
00:52:12,800 --> 00:52:16,040
magically works before I start 
explaining the thing that I was 

900
00:52:16,040 --> 00:52:19,320
about to explain. 
We keep getting that, which I 

901
00:52:19,320 --> 00:52:22,120
still don't get, but we'll 
figure that out at some point. 

902
00:52:23,240 --> 00:52:27,760
OK, so I think let me refresh 
the whole page just to make sure

903
00:52:27,760 --> 00:52:33,960
I'm not completely going crazy. 
So at this point, builder 

904
00:52:33,960 --> 00:52:38,480
actually has functionality built
into in this whole I frame 

905
00:52:38,480 --> 00:52:41,480
craziness world that we're 
living in where we're not only 

906
00:52:41,640 --> 00:52:46,360
viewing our local components 
that are sitting within this 

907
00:52:46,360 --> 00:52:49,960
whole next GS side. 
But we did just send data up to 

908
00:52:49,960 --> 00:52:54,920
it as a state object as well. 
And if we go over here, we 

909
00:52:54,920 --> 00:52:57,600
should be able to see that 
state. 

910
00:52:59,280 --> 00:53:03,880
So here is our sports array 
showing up on the builder side. 

911
00:53:04,280 --> 00:53:07,040
That is so cool. 
So here's where we get a little 

912
00:53:07,120 --> 00:53:09,640
crazier, right? 
So like if you, if you as a 

913
00:53:09,640 --> 00:53:12,880
developer say to your marketing 
team, I will pass you this API 

914
00:53:12,880 --> 00:53:14,680
data, do whatever you want with 
it. 

915
00:53:14,680 --> 00:53:17,800
This is this is kind of fun 
piece now, So I'll make this 

916
00:53:17,800 --> 00:53:21,440
side a little bigger just so 
hopefully people can see it. 

917
00:53:21,880 --> 00:53:25,000
This gets a a little tricky 
'cause there's a window within a

918
00:53:25,000 --> 00:53:27,760
window and it wants to capture a
A+ key. 

919
00:53:27,760 --> 00:53:30,960
So I gotta figure out how to do 
this. 

920
00:53:32,920 --> 00:53:36,320
I think if I go up here, yeah, I
was gonna say I figured this out

921
00:53:36,320 --> 00:53:37,600
the other day. 
OK. 

922
00:53:37,600 --> 00:53:40,040
And it's so cool that all of 
this is working through like 

923
00:53:40,040 --> 00:53:42,920
local hosts like. 
Yeah, it's very cool. 

924
00:53:43,080 --> 00:53:45,960
There's some scary things that 
people occasionally bump into 

925
00:53:45,960 --> 00:53:48,560
that we have to kind of work 
through, but it's all documented

926
00:53:48,560 --> 00:53:50,400
out there somewhere, so you 
should be able to find it. 

927
00:53:50,400 --> 00:53:55,400
But also just on that note, once
you get this set up, like we 

928
00:53:55,400 --> 00:53:58,480
could deploy this to Versailles 
right now and it would work the 

929
00:53:58,480 --> 00:54:02,000
same way, you could then give it
to marketing and say, OK, still 

930
00:54:02,080 --> 00:54:04,880
go do your stuff 'cause they're 
good and they can preview on 

931
00:54:04,880 --> 00:54:06,240
their own site. 
Yeah. 

932
00:54:06,360 --> 00:54:09,040
That's awesome. 
OK, so now we're gonna do 

933
00:54:09,040 --> 00:54:12,640
something a little crazy wacky, 
and we'll see if this works. 

934
00:54:12,720 --> 00:54:16,760
I'm gonna drop in just what's 
called a box. 

935
00:54:17,000 --> 00:54:20,240
And for folks, this is just like
a, a division basically. 

936
00:54:21,240 --> 00:54:26,000
And it has some base kind of CSS
properties built into it. 

937
00:54:26,760 --> 00:54:30,280
And what I want to do on this is
actually probably make, I'm 

938
00:54:30,280 --> 00:54:32,280
going to just clear this whole 
thing for now. 

939
00:54:33,040 --> 00:54:35,920
And I'll, I like leaving this 
layers open. 

940
00:54:35,920 --> 00:54:37,680
So we're going to call this a 
grid. 

941
00:54:38,160 --> 00:54:43,640
And on my CSS properties, I'm 
just going to do display grid 

942
00:54:44,160 --> 00:54:54,080
and then do a grid template, not
column, row, row, column. 

943
00:54:54,760 --> 00:55:00,760
Let's get this screwed up like 
one FR1R1 Fr. 

944
00:55:00,880 --> 00:55:05,520
We'll see what that does. 
OK, And now I can add another 

945
00:55:05,520 --> 00:55:12,800
new box inside of this grid. 
And if I just put text in it for

946
00:55:12,800 --> 00:55:16,040
this moment, so you can see. 
So there's my text. 

947
00:55:16,040 --> 00:55:19,160
If I were to duplicate this, I 
did do it the wrong way. 

948
00:55:20,080 --> 00:55:27,880
I told you. 
Every time, John, it's grid grid

949
00:55:28,240 --> 00:55:33,320
template columns, not rows. 
OK, there we go. 

950
00:55:34,400 --> 00:55:37,600
So now we've got these four 
things, but ideally we don't 

951
00:55:37,600 --> 00:55:40,280
want them to do that. 
What we want to do is actually 

952
00:55:40,280 --> 00:55:42,320
create this dynamically. 
So I'm going to delete those 

953
00:55:42,320 --> 00:55:45,960
back out. 
I'm going to look at this box 

954
00:55:45,960 --> 00:55:50,080
and say, OK, let's go over to 
data and let's do a data binding

955
00:55:50,080 --> 00:55:58,680
to this. 
And we are going to do get no, 

956
00:55:58,680 --> 00:56:00,000
no, no, no, I'm doing this 
wrong. 

957
00:56:00,000 --> 00:56:04,560
Hang on repeat. 
So repeat for each in these 

958
00:56:04,560 --> 00:56:08,600
sports, I assume. 
So I'm repeating all of the 

959
00:56:08,600 --> 00:56:11,440
sports as if they're like at 
these boxes. 

960
00:56:11,960 --> 00:56:15,720
Now what I can do with inside of
those is say, OK, for this text 

961
00:56:15,720 --> 00:56:22,240
right here, I'm going to bind 
from sports the text in here and

962
00:56:22,240 --> 00:56:26,720
sports item name. 
So now I've got all my names. 

963
00:56:28,320 --> 00:56:31,040
Great. 
Did you just say that moment? 

964
00:56:31,280 --> 00:56:33,800
That is so cool. 
We you missed it. 

965
00:56:33,800 --> 00:56:36,120
You weren't fully on screen. 
Hang on, let me make you pick. 

966
00:56:38,720 --> 00:56:42,320
So this is this is the like, 
this is the crazy part. 

967
00:56:42,320 --> 00:56:44,800
Like all of your server stuff's 
happening. 

968
00:56:44,800 --> 00:56:48,240
You're passing state over, and 
then we get to manipulate state 

969
00:56:48,240 --> 00:56:50,800
up in the builder side and do 
all this fun stuff with it, 

970
00:56:50,800 --> 00:56:54,120
right? 
Marketing's gonna go wild. 

971
00:56:54,840 --> 00:56:56,880
Exactly. 
You're gonna have so many pages.

972
00:56:57,080 --> 00:56:59,920
You'll you'll. 
Never get bothered by marketing 

973
00:56:59,920 --> 00:57:02,960
anymore like like we're good. 
You don't have to like bother 

974
00:57:02,960 --> 00:57:04,240
us. 
Thank you we'll we'll talk to 

975
00:57:04,240 --> 00:57:07,120
you later. 
So this is kind of this is cool 

976
00:57:07,120 --> 00:57:09,400
because we're like pulling it 
through the API. 

977
00:57:09,800 --> 00:57:13,360
But the other cool piece and 
this is are you are you good on 

978
00:57:13,360 --> 00:57:14,120
time? 
I know. 

979
00:57:14,680 --> 00:57:17,960
OK cool. 
So we could we could throw like 

980
00:57:17,960 --> 00:57:20,840
images in here and everything 
else if we wanted to. 

981
00:57:20,840 --> 00:57:22,560
So let's just show that real 
quick. 

982
00:57:25,680 --> 00:57:30,200
So these also can be bind. 
You're not currently sharing if 

983
00:57:30,200 --> 00:57:32,800
you think you're sharing. 
Thank you always. 

984
00:57:32,800 --> 00:57:35,560
I always do that. 
So I threw some image boxes in 

985
00:57:35,560 --> 00:57:39,160
there and I am also going to get
this from the image. 

986
00:57:39,400 --> 00:57:43,200
Cool now because I just screwed 
that up with my app to refresh 

987
00:57:43,200 --> 00:57:54,960
ones I get image. 
I do not know why that's 

988
00:57:54,960 --> 00:57:56,000
working. 
Not work. 

989
00:58:06,320 --> 00:58:10,040
We're just going to pretend that
worked just just to move on with

990
00:58:10,040 --> 00:58:13,480
the next thing. 
That's right. 

991
00:58:14,600 --> 00:58:16,800
Magic, super magic is happening 
in builder. 

992
00:58:18,040 --> 00:58:22,000
OK, the next cool piece. 
So we've done this kind of just 

993
00:58:22,000 --> 00:58:25,760
with generic like division based
data on our API, which is fine. 

994
00:58:25,760 --> 00:58:28,720
Like that's, that's pretty cool.
The next thing I want to do is 

995
00:58:28,720 --> 00:58:34,480
take and register a React 
component that Superbase wrote 

996
00:58:34,840 --> 00:58:39,800
and use it in my UI editor. 
So it'll show up over here under

997
00:58:39,800 --> 00:58:43,280
custom components. 
OK, Are you ready for this one? 

998
00:58:43,280 --> 00:58:46,240
This this is this is where my 
head exploded when I first 

999
00:58:46,440 --> 00:58:48,080
checked this out. 
I'm ready. 

1000
00:58:48,640 --> 00:58:54,440
OK, I might have to refer to 
again my sites for notes because

1001
00:58:54,640 --> 00:58:56,920
this part gets a little more 
complicated. 

1002
00:58:56,920 --> 00:58:59,320
I guarantee Steve, or like 
someone else that does this day 

1003
00:58:59,320 --> 00:59:01,080
in day out could do this in a 
heartbeat. 

1004
00:59:01,680 --> 00:59:08,840
Alex is still new to this. 
Let's see if Facebook is the 

1005
00:59:08,840 --> 00:59:12,400
wrong thing. 
I gotta remember where I'm doing

1006
00:59:12,400 --> 00:59:18,000
this setup, so let me do 
register holder. 

1007
00:59:23,330 --> 00:59:28,450
There we go all right so on this
one, what we can actually do is 

1008
00:59:28,450 --> 00:59:31,890
use builder and we don't even 
have to do the dynamic side to 

1009
00:59:31,890 --> 00:59:34,010
this. 
We can because it like makes it 

1010
00:59:34,010 --> 00:59:37,690
more performant, but I'm gonna 
show you how to actually run 

1011
00:59:38,650 --> 00:59:41,210
this. 
So let's just grab one of these.

1012
00:59:42,610 --> 00:59:48,000
I guess it's this whole thing so
I should be able to jump back. 

1013
00:59:48,000 --> 00:59:51,440
Sorry for jump around different 
code bases folks, but I am in 

1014
00:59:51,440 --> 00:59:54,520
our example code base. 
John's still there. 

1015
00:59:54,520 --> 00:59:56,440
Look at that. 
Your cursor just keeps popping 

1016
00:59:56,440 --> 00:59:58,040
up. 
Do you actually follow me around

1017
00:59:58,040 --> 00:59:58,880
is. 
That yeah, I've just, I've 

1018
00:59:58,880 --> 01:00:00,320
clicked follow, so it'll just 
that. 

1019
01:00:00,560 --> 01:00:02,880
Is awesome. 
This is such a cool feature. 

1020
01:00:03,160 --> 01:00:05,160
It is so cool because then, 
yeah, I can just like, 

1021
01:00:05,160 --> 01:00:07,320
occasionally jump in if there's 
something I need to change and 

1022
01:00:07,320 --> 01:00:09,640
my cursor's already right there.
It's very, very well thought 

1023
01:00:09,640 --> 01:00:11,440
out. 
I think we can even chat about 

1024
01:00:11,440 --> 01:00:13,960
it, like right here. 
Hey. 

1025
01:00:14,040 --> 01:00:20,760
Hey, John. 
Oh, I don't know. 

1026
01:00:20,760 --> 01:00:21,360
I don't. 
I don't. 

1027
01:00:21,440 --> 01:00:22,800
Yeah. 
No, it popped up. 

1028
01:00:23,160 --> 01:00:23,680
It's gone. 
I don't. 

1029
01:00:25,880 --> 01:00:32,240
Know for builder from builder 
React I believe. 

1030
01:00:33,080 --> 01:00:35,960
OK. 
So you said and I could be 

1031
01:00:35,960 --> 01:00:39,600
completely off on this, you have
kind of some pre canned 

1032
01:00:39,600 --> 01:00:41,360
components for Superbase, is 
that right? 

1033
01:00:41,640 --> 01:00:44,920
So if you go to, it's called 
Superbase UI. 

1034
01:00:49,760 --> 01:00:52,880
Yeah, that one. 
And so this is AUI library that 

1035
01:00:52,880 --> 01:00:55,160
we actually use for building the
Superbase dashboard. 

1036
01:00:55,160 --> 01:00:57,320
So it's a collection of 
components that are already 

1037
01:00:57,320 --> 01:01:02,880
styled for Superbasey things. 
So if you wanted to just grab 

1038
01:01:03,240 --> 01:01:05,600
like a button or something from 
here. 

1039
01:01:06,400 --> 01:01:07,800
Let's start easy. 
Let's do button. 

1040
01:01:07,800 --> 01:01:12,760
Yeah, so this is what it'll look
like this primary button. 

1041
01:01:12,760 --> 01:01:24,000
OK, so let's drop that in here. 
So this is the use of it. 

1042
01:01:24,000 --> 01:01:25,560
All right, Just double check 
there. 

1043
01:01:26,920 --> 01:01:30,680
The button is kind of 
interesting a little bit because

1044
01:01:30,840 --> 01:01:34,200
we're almost going to have to 
kind of wrap this because you're

1045
01:01:34,200 --> 01:01:38,080
probably going to want like text
that you provide into the 

1046
01:01:38,080 --> 01:01:43,360
button, right. 
So on this, let me jump back 

1047
01:01:43,360 --> 01:01:45,120
again. 
I have a couple of these where I

1048
01:01:45,240 --> 01:01:49,920
I think I call them like wrapped
for next GSI use like next GS 

1049
01:01:49,920 --> 01:01:55,120
link to drag around this right 
here. 

1050
01:01:59,480 --> 01:02:12,440
Just provide that back. 
We'll just do, we'll call it 

1051
01:02:12,600 --> 01:02:19,360
super button. 
And then instead of atref, we're

1052
01:02:19,360 --> 01:02:23,720
actually just going to do text 
probably. 

1053
01:02:25,120 --> 01:02:27,920
Oh, and we're in JavaScript, so 
I can't have all my nice stuff. 

1054
01:02:29,960 --> 01:02:31,360
Well, I can't have any of this. 
That's right. 

1055
01:02:34,720 --> 01:02:38,120
OK. 
And now because of this button, 

1056
01:02:40,120 --> 01:02:42,040
how is button? 
Yeah, OK, All right. 

1057
01:02:42,920 --> 01:02:50,040
I'm like, what is happening? 
OK, So if you're following wrong

1058
01:02:50,040 --> 01:02:54,040
folks, basically what I'm I'm 
going to do here is this is just

1059
01:02:54,560 --> 01:02:55,960
we call this a higher order 
model. 

1060
01:02:55,960 --> 01:02:58,560
I still suck. 
I react this this is like. 

1061
01:02:58,560 --> 01:03:01,400
This would be a higher order 
component because it takes a. 

1062
01:03:01,440 --> 01:03:05,600
No, it would just like a. 
Wrapper component, let's just 

1063
01:03:05,600 --> 01:03:07,680
call it that. 
I'm not good with all these 

1064
01:03:07,680 --> 01:03:10,360
React terms yet. 
So what we're going to do, 

1065
01:03:10,520 --> 01:03:14,080
instead of using dynamic, we 
then have this whole code block 

1066
01:03:14,080 --> 01:03:16,480
right here. 
What this takes is just the 

1067
01:03:16,480 --> 01:03:18,080
component. 
So we're going to call this the 

1068
01:03:18,080 --> 01:03:21,320
Super button and then we have 
all this other stuff. 

1069
01:03:21,320 --> 01:03:24,960
So we'll call this the SUPA 
button. 

1070
01:03:26,800 --> 01:03:29,480
And then we actually don't need 
anything. 

1071
01:03:30,400 --> 01:03:35,320
But let's so input is just gonna
be text. 

1072
01:03:36,360 --> 01:03:38,920
Actually, I think, I don't know 
why that's long text. 

1073
01:03:38,920 --> 01:03:40,560
I'm not familiar with our long 
text. 

1074
01:03:40,560 --> 01:03:46,040
So let's do that string default 
value just that John. 

1075
01:03:47,800 --> 01:03:49,880
Click the John button. 
That's right. 

1076
01:03:51,320 --> 01:03:57,360
OK, so theoretically now, now 
I've registered a component in 

1077
01:03:57,360 --> 01:04:01,760
our next GS site and it's 
exposing that component up to 

1078
01:04:01,760 --> 01:04:14,080
builder and go over here. 
Yes, we probably need to install

1079
01:04:14,080 --> 01:04:17,600
Superbase UI. 
Yeah, so you'll need to do an 

1080
01:04:17,640 --> 01:04:20,600
NPM install. 
So this is a completely separate

1081
01:04:20,600 --> 01:04:22,760
package from superbase. 
This is just a a. 

1082
01:04:27,720 --> 01:04:31,840
Why am I blanking on the term 
design library? 

1083
01:04:33,480 --> 01:04:38,600
Running into all these React 
issues. 

1084
01:04:39,920 --> 01:04:51,120
React 18's here folks. 
What does that not like? 

1085
01:04:54,440 --> 01:04:56,880
Let me try restoring, Sir. 
I don't know what that's 

1086
01:04:57,040 --> 01:05:17,840
planning on. 
Fingers crossed, tight bear. 

1087
01:05:18,400 --> 01:05:20,640
It's so close. 
Why the heck does it care about 

1088
01:05:20,640 --> 01:05:24,560
type register? 
Well, it's not a function. 

1089
01:05:24,640 --> 01:05:27,120
We didn't say dot TS. 
What are you talking about? 

1090
01:05:28,360 --> 01:05:37,840
Did you see a dot TS somewhere? 
No shoot web back import. 

1091
01:05:37,840 --> 01:05:41,800
So it's saying that I think it 
might be the import of register.

1092
01:05:41,800 --> 01:05:46,200
So the builder I think is not a 
default is. 

1093
01:05:46,200 --> 01:05:51,960
Should that be in a in brackets?
I know that is the default 

1094
01:05:52,600 --> 01:05:58,000
export declare that's. 
Interesting, right? 

1095
01:06:00,040 --> 01:06:03,200
I could try it this way, but I 
don't think that's it. 

1096
01:06:15,840 --> 01:06:20,720
Maybe I'm wrong. 
OK, see Super button. 

1097
01:06:21,360 --> 01:06:24,520
We have a super. 
Button and actually we can get 

1098
01:06:24,520 --> 01:06:28,480
even fancier if you have a super
image, but we'll we'll do that 

1099
01:06:28,480 --> 01:06:31,560
some other day. 
So instead of these little 

1100
01:06:31,600 --> 01:06:35,920
brackets over here you can have 
other stuff so actually on all 

1101
01:06:35,920 --> 01:06:40,240
of our different API people we 
can now drop in a super button. 

1102
01:06:42,800 --> 01:06:47,160
There's our John button themed. 
What if we want to change that 

1103
01:06:47,160 --> 01:06:49,240
text though, Alex? 
How would you do that? 

1104
01:06:49,440 --> 01:06:52,000
I don't want all my buttons to 
just say John I. 

1105
01:06:52,000 --> 01:06:54,640
Love this. 
I love when John's just right 

1106
01:06:54,640 --> 01:06:57,200
there. 
OK, so the other cool part? 

1107
01:06:57,200 --> 01:07:01,360
Instead of this text being here,
let's take and bind our button 

1108
01:07:01,360 --> 01:07:07,560
text instead. 
So we're going to grab that name

1109
01:07:07,680 --> 01:07:09,880
from button text. 
But what? 

1110
01:07:13,600 --> 01:07:15,840
Yes, another head explosion. 
How many heads? 

1111
01:07:15,840 --> 01:07:17,840
Do I have left? 
You are going to need ibuprofen.

1112
01:07:17,840 --> 01:07:21,200
I don't know if they have that 
in Australia, but maybe like 

1113
01:07:21,520 --> 01:07:23,560
kangaroo dust. 
I I don't know what you guys 

1114
01:07:23,560 --> 01:07:25,440
think. 
It's night time where you are, 

1115
01:07:25,440 --> 01:07:27,040
but it's it's only like midday 
here. 

1116
01:07:27,040 --> 01:07:30,000
But I think I'm just going to 
need to go take a rest and just 

1117
01:07:30,000 --> 01:07:31,640
like close my eyes. 
This has been. 

1118
01:07:32,000 --> 01:07:34,160
Just lie down, hang out for a 
while. 

1119
01:07:35,080 --> 01:07:38,360
So that's, that's like the most 
probably basic example, but 

1120
01:07:38,360 --> 01:07:42,120
that's how you can register a 
component and actually tie out 

1121
01:07:42,240 --> 01:07:45,760
any inputs that you could in a 
normal React situation. 

1122
01:07:46,240 --> 01:07:50,480
This is all just kind of mixing.
Together, I recommend anyone who

1123
01:07:50,480 --> 01:07:52,960
is watching that wants to take 
this a little bit further, try 

1124
01:07:52,960 --> 01:07:54,440
doing that with the auth 
component. 

1125
01:07:54,440 --> 01:07:58,480
Because I, I kind of you know, 
in the, the fact that our time 

1126
01:07:58,480 --> 01:08:01,280
is getting a little bit short. 
Just wanted to go with something

1127
01:08:01,280 --> 01:08:03,360
simple like a button. 
But if you did use the auth 

1128
01:08:03,360 --> 01:08:07,080
component, which basically just 
gives you a whole form that that

1129
01:08:07,080 --> 01:08:11,400
talks to to superbase and that 
takes in like the superbase and 

1130
01:08:11,400 --> 01:08:13,360
non key and URL and all of that 
stuff. 

1131
01:08:13,360 --> 01:08:17,640
That would be a really good 
extension to to try out. 

1132
01:08:18,120 --> 01:08:20,160
Yeah. 
So like basically if you're, if 

1133
01:08:20,160 --> 01:08:23,080
you're building something like 
with Superbase UI or a Tailwind 

1134
01:08:23,080 --> 01:08:26,279
UI or Tailwind's kind of 
interesting just because of the 

1135
01:08:26,279 --> 01:08:28,760
compiling piece to it, but I 
won't get there. 

1136
01:08:30,359 --> 01:08:33,680
If you're building things with a
component library, so like a 

1137
01:08:33,680 --> 01:08:37,640
material UI or something like 
that, you can take and create 

1138
01:08:37,680 --> 01:08:40,720
and register all of these things
and give them over to again, 

1139
01:08:40,720 --> 01:08:43,840
your marketing team, your like 
dev team in this case, if you're

1140
01:08:43,840 --> 01:08:47,680
creating tools like this and you
can go to town just creating 

1141
01:08:47,960 --> 01:08:50,160
different pages. 
And the cool part is we just 

1142
01:08:50,160 --> 01:08:55,040
hooked up Superbase AP is to it.
And we could actually expose 

1143
01:08:55,040 --> 01:08:58,120
everything out that Superbase 
has too, because it's just, it's

1144
01:08:58,120 --> 01:09:00,160
just a React component at the 
end of the day. 

1145
01:09:00,760 --> 01:09:03,279
Yeah, well, that piping in 
between is just so cool. 

1146
01:09:03,279 --> 01:09:04,960
Yeah. 
It's not like it just takes over

1147
01:09:05,279 --> 01:09:07,960
everything and you just use the 
UI for builder IO. 

1148
01:09:07,960 --> 01:09:10,760
Like being able to tie into that
next JS app in the middle is 

1149
01:09:10,760 --> 01:09:13,920
just, yeah, very powerful. 
Yeah, and a big, a big part of 

1150
01:09:13,920 --> 01:09:17,439
the builder IO story too is I've
mainly stuck kind of with the 

1151
01:09:17,439 --> 01:09:20,000
page example, but we do have 
like sections. 

1152
01:09:20,000 --> 01:09:22,760
So like, let's say you have an 
existing app and you only want 

1153
01:09:22,760 --> 01:09:25,080
to like do a sidebar or 
something like that, you can 

1154
01:09:25,080 --> 01:09:28,479
just drop it into that area and 
that's all you have to work on. 

1155
01:09:28,479 --> 01:09:31,720
Like you don't have to rewrite 
your whole app and which CMSS, 

1156
01:09:31,720 --> 01:09:33,359
you can use three different 
CMSS. 

1157
01:09:33,359 --> 01:09:34,880
They're pulling data from other 
places. 

1158
01:09:34,880 --> 01:09:37,040
So it's all it's all pretty 
cool. 

1159
01:09:37,520 --> 01:09:40,240
That's so cool, is. 
There anything else we missed? 

1160
01:09:40,479 --> 01:09:43,880
Oh, we did miss a big portion. 
I I should I should back up and 

1161
01:09:43,880 --> 01:09:47,359
we we named this one 
personalization at the edge and 

1162
01:09:47,359 --> 01:09:49,399
I knew like we might be a little
tight. 

1163
01:09:49,399 --> 01:09:54,120
I'm getting to that, but if John
promises he might have time for 

1164
01:09:54,120 --> 01:09:57,160
a a Part 2, I will promise I 
have time. 

1165
01:09:57,160 --> 01:09:59,760
All right. 
If you will promise, I will 

1166
01:09:59,760 --> 01:10:01,720
promise if you will be there, I 
will be there. 

1167
01:10:01,720 --> 01:10:05,240
Because yeah, that would be very
cool to see the personalization 

1168
01:10:05,240 --> 01:10:08,280
side of this and how and you 
said personalization at the 

1169
01:10:08,280 --> 01:10:12,280
edge, which makes me think this 
is maybe happening at the CDN 

1170
01:10:12,280 --> 01:10:15,160
layer and very, very quick for 
your users. 

1171
01:10:15,240 --> 01:10:18,320
So I will, I will throw this 
link out there really quick so 

1172
01:10:18,320 --> 01:10:20,640
people have at least something 
to check out. 

1173
01:10:20,640 --> 01:10:25,200
So this is Steve, our CEO and Co
founder talking about this. 

1174
01:10:25,200 --> 01:10:31,120
I believe this video is from the
next comp yeah, next GS comp and

1175
01:10:31,120 --> 01:10:34,160
we kind of talk about when we're
talking about the edge. 

1176
01:10:34,160 --> 01:10:37,760
So if I go all the way down 
here, when we when we start to 

1177
01:10:37,760 --> 01:10:40,440
sorry, am I sharing? 
Yeah, I knew it. 

1178
01:10:40,960 --> 01:10:44,120
I knew it as soon as I started 
talking about and saw myself I 

1179
01:10:44,120 --> 01:10:47,320
was like, that's not right. 
Let's do this. 

1180
01:10:48,840 --> 01:10:52,280
So let me just go back up. 
This this video right here is 

1181
01:10:52,280 --> 01:10:56,680
from Steve, our Co founder. 
As you go down here, we talk 

1182
01:10:56,680 --> 01:10:59,320
kind of through some different 
parts to it, but the cool part 

1183
01:10:59,320 --> 01:11:02,040
here on the the middleware, we 
could do anything. 

1184
01:11:02,040 --> 01:11:05,120
So when a cookie comes in or 
something like that, we can 

1185
01:11:05,120 --> 01:11:09,040
actually grab that GWT token and
say, hey, go grab some super 

1186
01:11:09,040 --> 01:11:14,240
based data and we'll send that 
down for like an IR ISR to build

1187
01:11:14,240 --> 01:11:17,080
or to personalize it. 
So let's say that person like 

1188
01:11:17,680 --> 01:11:20,680
you want sports teams, but you 
love basketball. 

1189
01:11:20,680 --> 01:11:23,840
And now all of a sudden we know 
that by a UTM parameter or 

1190
01:11:23,840 --> 01:11:26,600
something like that super 
basically go grab all the data, 

1191
01:11:26,600 --> 01:11:29,880
pass it to next GS. 
And then that same way we use 

1192
01:11:29,880 --> 01:11:33,880
that state, we can then show you
a page just based on you for the

1193
01:11:33,880 --> 01:11:36,520
personalization. 
And that's the edge piece that 

1194
01:11:36,520 --> 01:11:38,080
we're talking about, that 
middleware. 

1195
01:11:38,120 --> 01:11:40,400
Yeah, you've, you've intrigued 
me enough to come back. 

1196
01:11:40,400 --> 01:11:41,880
I'll, I'll come back for that 
for sure. 

1197
01:11:42,200 --> 01:11:46,000
I knew it would take like a 
little bit of of pushing, so I 

1198
01:11:46,000 --> 01:11:47,560
was really happy we finally got 
there. 

1199
01:11:48,080 --> 01:11:50,720
Yeah, Don, I really appreciate 
it. 

1200
01:11:50,720 --> 01:11:52,240
I always have a blast talking to
you. 

1201
01:11:52,240 --> 01:11:54,320
I'm glad I I made your head 
explode. 

1202
01:11:54,320 --> 01:11:57,160
And we'll do. 
We'll do this next part again. 

1203
01:11:57,640 --> 01:11:59,400
Yeah, it's been fun. 
Thanks, Alex. 

1204
01:11:59,680 --> 01:12:00,920
Cool, take care for the rest of 
your day. 

1205
01:12:00,920 --> 01:12:03,840
Throw a little outro up. 
It's in the wrong branding, but 

1206
01:12:03,960 --> 01:12:04,480
here we go.
