1
00:00:00,000 --> 00:00:02,163
Welcome to another episode of Empower Apps.

2
00:00:02,163 --> 00:00:03,684
I'm Leo Dion.

3
00:00:03,685 --> 00:00:06,799
Today we're once again joined by Tim Condon.

4
00:00:06,799 --> 00:00:09,452
Tim, thank you so much for joining us.

5
00:00:09,836 --> 00:00:11,096
Thanks very much for having me back.

6
00:00:11,096 --> 00:00:12,196
great to be back.

7
00:00:12,820 --> 00:00:18,683
I'm excited for today's episode because we get to hear all the big updates in Vapor 5.

8
00:00:18,865 --> 00:00:19,926
I'll let you

9
00:00:19,926 --> 00:00:22,647
go ahead and introduce yourself for those who don't know.

10
00:00:23,530 --> 00:00:24,641
Yes, I'm Tim.

11
00:00:24,641 --> 00:00:26,744
I'm one half of the Vapor core team.

12
00:00:26,744 --> 00:00:30,226
I'm responsible for building the main Vapor framework.

13
00:00:30,226 --> 00:00:35,870
So the kind of core HTTP server that everyone interacts with or web framework that
everyone interacts with.

14
00:00:35,870 --> 00:00:38,392
And yeah, it's been a busy few months.

15
00:00:38,987 --> 00:00:39,908
Awesome.

16
00:00:39,908 --> 00:00:54,881
What before we get started, what's been some of the big changes since the last time you
were on as far as how how the whole environment of server side technologies have gone and

17
00:00:54,881 --> 00:00:56,672
where they've where they're headed.

18
00:00:57,359 --> 00:01:10,219
So I think for Swift specifically, there's just a period of maturity, I think, kind of
several years ago, especially when Vapor 4 was released, it was still kind of relatively

19
00:01:10,219 --> 00:01:10,959
early days.

20
00:01:10,959 --> 00:01:14,199
Swift has only been open sourced for three, three and a half years.

21
00:01:14,199 --> 00:01:21,959
So it was kind of a different time and a lot of the language features that we now can take
advantage of didn't exist.

22
00:01:22,128 --> 00:01:34,469
In the server world, I think there's been a of a greater focus on security, especially
with kind of AI making it very easy to run security checks on open source code and

23
00:01:34,469 --> 00:01:35,009
servers.

24
00:01:35,009 --> 00:01:44,732
There's a big push for post quantum cryptography as quantum computing becomes more more
tangible and people get worried about encryption being broken.

25
00:01:45,538 --> 00:01:53,997
And then yeah, a lot of streaming stuff, AI is taking over so people want to be able to
stream responses and of reactions from especially large language models as they kind of

26
00:01:53,997 --> 00:01:55,819
output their responses.

27
00:01:56,307 --> 00:01:58,449
You mean MCP type stuff?

28
00:01:58,498 --> 00:02:06,591
But both MCP and also if you're talking to say the OpenAI or ChatGPT API, when you send
it a prompt, it will stream back a response.

29
00:02:06,591 --> 00:02:08,371
So you don't get the whole response at once.

30
00:02:08,371 --> 00:02:12,392
You get it in kind of chunks, which is why it kind of reads out bit by bit in the apps.

31
00:02:12,732 --> 00:02:13,112
And so

32
00:02:13,112 --> 00:02:24,395
kind of that kind of usage of where things are streaming and we now got HTTP/3 as
well, which is kind of another layer of complexity on top HTTP that we need to handle.

33
00:02:24,432 --> 00:02:28,307
So those areas are things that we need to focus on as well.

34
00:02:29,737 --> 00:02:32,859
So Vapor 5, you released

35
00:02:32,859 --> 00:02:35,291
the beta, what was it, a couple of weeks ago?

36
00:02:35,549 --> 00:02:36,955
Yeah, last week I think.

37
00:02:37,033 --> 00:02:44,838
yeah, you wanna kinda go over kind of the big picture as far as what big changes we'll be
seeing in Vapor 5?

38
00:02:47,075 --> 00:02:47,715
Sure, yeah.

39
00:02:47,715 --> 00:02:56,195
I mean, the kind of the I guess the highlight of Vapor 5 is the fact that it's six and a
half years after Vapor 4 was released.

40
00:02:56,528 --> 00:02:59,076
Which i which actually take that as a compliment.

41
00:02:59,076 --> 00:03:03,316
that means Vapor 4 has been pretty rock solid in a lot of ways.

42
00:03:03,316 --> 00:03:09,900
Yeah, and we've managed to not break our API, which has been very hard in some cases and a
bit frustrating in others.

43
00:03:09,900 --> 00:03:11,921
But yeah, we've managed to have a stable API.

44
00:03:11,921 --> 00:03:18,404
Obviously we've kind of deprecated a lot stuff and added new APIs that we've kind of tried
to move people onto.

45
00:03:18,404 --> 00:03:20,715
But the old APIs are still there and still work.

46
00:03:20,715 --> 00:03:26,067
So the main highlight for me is kind of removing six, seven years of tech debt, which is
very nice to do.

47
00:03:26,067 --> 00:03:28,688
There was a lot deleting code, which was very satisfying.

48
00:03:28,705 --> 00:03:29,788
Yes, it is.

49
00:03:29,949 --> 00:03:36,271
But yeah, so the main kind of highlight features for this are we don't have any concept of
futures or promises anymore.

50
00:03:36,271 --> 00:03:36,811
That's

51
00:03:36,811 --> 00:03:37,932
completely gone.

52
00:03:37,932 --> 00:03:46,246
So there's no more trying to understand what the difference between a map and a flatMap
and a tryFlatMap and a flatMapThrowing is, which was a definite confusion point for

53
00:03:46,246 --> 00:03:48,216
people until Swift concurrency came along.

54
00:03:48,216 --> 00:03:51,433
So we are now fully kind of Swift concurrency the entire stack.

55
00:03:51,433 --> 00:03:58,515
all the way down to the low levels of NIO where we have to jump back into a different
world, but that's handled elsewhere now, which is nice.

56
00:03:58,515 --> 00:04:03,377
So we kind of support structured concurrency properly, which has always been a little bit
of a bugbear.

57
00:04:03,377 --> 00:04:06,618
We have a brand new HTTP server.

58
00:04:06,618 --> 00:04:11,420
the new Swift Networking Workgroup has been working on a new HTTP server.

59
00:04:11,420 --> 00:04:17,434
and some other folks as well, which is a modern take on what an HTTP server can be.

60
00:04:17,434 --> 00:04:20,606
it's very, I'm still pre-release.

61
00:04:20,606 --> 00:04:30,443
It requires 6.4, it requires Apple platforms 26, if you're working on platforms, because
it does use all of the very latest features, which allow us to do nice things like

62
00:04:30,443 --> 00:04:33,005
ensuring that you can't like a connection or anything.

63
00:04:33,005 --> 00:04:34,676
It's impossible to do because

64
00:04:34,992 --> 00:04:36,313
the compiler will not let you.

65
00:04:36,313 --> 00:04:43,096
So those kind of things of allowing connections to escape are not possible anymore, which
should make your code safer and your server safer and stay up longer.

66
00:04:43,096 --> 00:04:45,037
We have better integration with the ecosystem.

67
00:04:45,037 --> 00:04:56,153
So there's a number of packages that have been released in the last several years that we
can now properly adopt, like new Swift HTTP Types library that defines kind of HTTP concurrency

68
00:04:56,153 --> 00:04:59,475
types, Swift Service Lifecycle, which we can properly adopt,

69
00:04:59,475 --> 00:05:00,255
which...

70
00:05:00,259 --> 00:05:11,259
will make it lot easier to integrate other services that need start and stop capabilities
and us being able to manage that or you'll be able to manage us alongside.

71
00:05:11,259 --> 00:05:19,639
We use Swift Configuration so that you can choose whichever configuration type you want
and it will just pick it up automatically.

72
00:05:19,639 --> 00:05:20,339
What else we've done?

73
00:05:20,339 --> 00:05:23,599
We've turned on all of the HTTP other Swift flags.

74
00:05:23,619 --> 00:05:26,079
So if you look at our package manifest,

75
00:05:26,279 --> 00:05:34,732
We have 10 or 11 flags that we enable for upcoming features and experimental features that
should make the code a little bit safer and a little bit cleaner.

76
00:05:36,636 --> 00:05:41,229
And then outside of actual core changes, we have, we're kind of streaming by default now.

77
00:05:41,229 --> 00:05:50,604
So anytime you want to deal with a request body or response body, that's streaming as a
kind of first class citizen.

78
00:05:50,604 --> 00:05:55,086
So, which enables us to do some nice things, but we still have all the syntactic sugar on
top.

79
00:05:55,086 --> 00:05:59,188
So if you want to just decode some JSON, that's really easy to write.

80
00:05:59,188 --> 00:06:00,358
There's not any more.

81
00:06:00,358 --> 00:06:01,645
than ever was.

82
00:06:02,976 --> 00:06:08,062
you said something about only supporting OS 26.

83
00:06:08,143 --> 00:06:10,946
Why why is that exactly?

84
00:06:10,977 --> 00:06:15,161
That's primarily because of the spans stuff that we're

85
00:06:15,161 --> 00:06:27,810
So we're making use of new Swift features that can't be backported, one of which is span,
and there's a couple of others that allow us to, not currently, but when we kind of get

86
00:06:27,810 --> 00:06:33,803
closer to release, should allow us to be extremely performant because for span
specifically, it means we can kind of

87
00:06:34,041 --> 00:06:39,705
essentially safely pass a pointer through to wherever one needs to use it.

88
00:06:39,705 --> 00:06:43,247
So that memory is just borrowed instead of having to be allocated and copied everywhere.

89
00:06:43,247 --> 00:06:47,469
And then the compiler gives us guarantees that memory is not going to leak, it can't be
escaped.

90
00:06:47,469 --> 00:06:50,220
So it's a safe, performant way of writing code.

91
00:06:51,225 --> 00:06:54,077
Okay, I wanna really deep dive into that.

92
00:06:54,117 --> 00:07:04,776
like what's there's two things post async/await that I'm not super comfortable with
because of my lack of experience and knowledge.

93
00:07:04,776 --> 00:07:17,196
But like the whole span memory stuff, pointer the new way to do pointers, and then and I
don't know if you touch on this in Vapor 5, but like owning non copyable that stuff.

94
00:07:18,593 --> 00:07:28,094
How do you utilize those and w what's the advantage of them and why for instance why
even do a span if you could just have a class instead?

95
00:07:28,106 --> 00:07:28,916
Yeah.

96
00:07:28,996 --> 00:07:33,759
So on the kind of point of span, so span is a relatively new type.

97
00:07:33,759 --> 00:07:42,665
It's been, some of it's been backported to older OS versions, but for the most part it's
pretty new and the story is still ongoing.

98
00:07:42,665 --> 00:07:46,287
So some of the APIs we use don't have span support.

99
00:07:46,287 --> 00:07:52,050
Some of the foundation types we use don't have span support yet, but they have been
pitched and should land in 6.5.

100
00:07:52,050 --> 00:07:54,872
But essentially the idea is that span is a,

101
00:07:55,173 --> 00:08:00,997
view into memory that you can borrow and the compiler will put constraints on how you use
that memory.

102
00:08:00,997 --> 00:08:11,693
So if you're, say, you wanna write some JSON to your response, so you produce some JSON,
you wanna write it out, what would normally happen is you'd take your response from JSON

103
00:08:11,693 --> 00:08:19,757
encoder, which would be data, you then copy that data into a byte buffer, that byte buffer
that would be transferred into NIO, which then be copied again, which then be copied out

104
00:08:19,757 --> 00:08:20,141
when it,

105
00:08:20,141 --> 00:08:22,621
written to the network.

106
00:08:22,621 --> 00:08:23,432
Yeah.

107
00:08:23,432 --> 00:08:36,236
In an ideal world, would happen, what will happen is that you will create your JSON, which
you will then own that data, because something needs to own the actual underlying data.

108
00:08:36,477 --> 00:08:44,458
And then you pass a span down into Vapor, which then passes a span down into NIO, or into
the HTTP server, which then passes a span down to NIO,

109
00:08:44,458 --> 00:08:45,322
NIO, yeah.

110
00:08:45,322 --> 00:08:46,146
which means that

111
00:08:46,146 --> 00:08:55,131
instead of copying the data every time, you're actually just kind of passing essentially a
pointer, which I think literally is a pointer, down so that it can read the memory

112
00:08:55,311 --> 00:09:03,096
straight from where it was originally created and where it's owned, and then write that
out straight away without having to worry about making copies and stuff like that.

113
00:09:03,096 --> 00:09:09,908
Now, realistically, that's not gonna happen the whole time because of back pressure and
things like that, but that's the ideal view.

114
00:09:09,908 --> 00:09:15,451
And this, essentially, there's two big things we care about for performance.

115
00:09:15,451 --> 00:09:22,554
The first one is reducing the number of instructions, essentially doing as little work as
possible and being as efficient as possible with code.

116
00:09:22,554 --> 00:09:25,596
And the second one is reducing allocations.

117
00:09:25,636 --> 00:09:33,080
So if we can reduce the number of times that we need to allocate memory or make copies of
data or stuff, then that's gonna make us more performant.

118
00:09:33,373 --> 00:09:35,674
And by using span, we don't have to do copies anywhere.

119
00:09:35,674 --> 00:09:38,294
And so it's the same as passing a pointer in.

120
00:09:38,294 --> 00:09:48,898
If you're used to writing C or C++, you just pass that pointer around that star, char star
or pointer or in Swift, it's called an unsafe

121
00:09:48,898 --> 00:09:49,739
buffer pointer.

122
00:09:49,739 --> 00:09:55,812
But with span, the compiler enforces the use of the span itself and the lifetime of the
span itself.

123
00:09:55,812 --> 00:10:00,353
So if you try and copy that span outside of the scope of where it's being used, won't let
you.

124
00:10:00,353 --> 00:10:05,254
The compiler will refuse to compile, which means you not have to worry about leaking
memory anywhere.

125
00:10:05,254 --> 00:10:07,395
And it also ensures things are closed off properly as well.

126
00:10:07,395 --> 00:10:09,775
So that's kind of one the big benefits of using span.

127
00:10:09,775 --> 00:10:18,348
And it solves, it also solves a lot of the problems we've been having in the ecosystem of
we need kind of some kind of generic bag of bytes type.

128
00:10:20,154 --> 00:10:22,655
because that

129
00:10:22,655 --> 00:10:23,555
isn't Data, yeah.

130
00:10:23,555 --> 00:10:31,238
Because data is part of foundation and there are use cases where you probably don't wanna
use foundation and we wanna try and have the same API everywhere.

131
00:10:31,238 --> 00:10:39,101
If the ecosystem can agree on it and we can get the necessary kind of features in Swift,
which I think we're kind of almost there, then we can just pass around span.

132
00:10:39,101 --> 00:10:43,682
So you can own it, own the data, whatever you want, creates the data, can own it.

133
00:10:43,810 --> 00:10:47,770
And if you don't need to copy it anywhere, you can just pass a span around and it doesn't
matter what the type is.

134
00:10:47,770 --> 00:10:49,090
It could be data.

135
00:10:49,090 --> 00:10:51,870
It could be a array of UInt8s.

136
00:10:51,870 --> 00:10:52,950
It could be a byte buffer.

137
00:10:52,950 --> 00:10:53,630
really doesn't matter.

138
00:10:53,630 --> 00:10:54,350
It's just a span.

139
00:10:54,350 --> 00:10:58,170
And if you need to read the bytes to make copies or whatever, then you can do

140
00:10:59,385 --> 00:11:01,808
Okay, that makes a lot of sense.

141
00:11:02,143 --> 00:11:08,461
one of the flags I saw on your blog post was about something called strict memory.

142
00:11:08,461 --> 00:11:10,233
What does that mean exactly?

143
00:11:10,659 --> 00:11:18,498
So there is a setting in Swift that was introduced in, I think it was 6.3, which is strict
memory checking or strict memory safety.

144
00:11:18,498 --> 00:11:20,780
Strict memory safety, that's one, yeah.

145
00:11:20,780 --> 00:11:32,949
And so this is essentially started out as a feature for interacting with unsafe code,
which is C and C++, but has kind of expanded a little bit into Swift world.

146
00:11:32,949 --> 00:11:34,629
So the idea is that,

147
00:11:34,733 --> 00:11:50,773
If you are doing any potential unsafe code, such as you're dealing directly with pointers
or unsafe mutable pointers or whatever, or you're talking to any kind of C code, you can

148
00:11:50,773 --> 00:11:56,513
turn this on and the compiler will force you to write an unsafe call at those call sites.

149
00:11:56,513 --> 00:12:02,493
And without that, can either get a warning or you can turn them to errors and you'll get
compile errors.

150
00:12:02,769 --> 00:12:08,174
And so this makes it makes you kind of think about where you're going to use these things
and if there are better ways.

151
00:12:08,174 --> 00:12:20,303
So as span becomes more prevalent in Swift, the cases where you need to use like an unsafe
mutable pointer or unsafe mutable buffer will reduce so you won't need these.

152
00:12:20,303 --> 00:12:24,516
And also makes you look at your code and how you're using it as well.

153
00:12:24,568 --> 00:12:27,160
so you can really verify because it's very easy to find out.

154
00:12:27,160 --> 00:12:31,964
If you're doing unsafe stuff, can just search your codebase for unsafe and then really
inspect those lines of code.

155
00:12:31,964 --> 00:12:43,212
It has also grown a little bit now as well because if you import a library that was
written before sendable and concurrency stuff in and you have to do @preconcurrency,

156
00:12:43,212 --> 00:12:47,705
that import also has to be marked as unsafe as well with this setting.

157
00:12:47,944 --> 00:12:52,478
because it's potentially an unsafe thing to do because you're kind of giving up sendable
checking.

158
00:12:53,478 --> 00:13:05,043
Does this d would I gain anything with regular i iPhone apps or stuff like that, or is
it strictly only if you're bringing in older Swift packages that are pre-concurrency?

159
00:13:05,366 --> 00:13:14,173
I mean, if you're writing iOS apps that use packages that are not annotated for sendable
checking, it will force you to take a look at those dependencies and question.

160
00:13:14,173 --> 00:13:18,897
can say, is this dependency still something I want to rely on if potentially it is unsafe?

161
00:13:18,897 --> 00:13:19,777
Because you can do

162
00:13:19,777 --> 00:13:28,480
@preconcurrency and it silences all the warnings from the compiler, but your code is
still unsafe unless you've actually opting into full sendable checking.

163
00:13:28,537 --> 00:13:30,241
then your code is still potentially unsafe.

164
00:13:30,241 --> 00:13:32,967
So it's good way of finding those things out.

165
00:13:33,287 --> 00:13:34,478
Yeah, that's a really good idea.

166
00:13:34,478 --> 00:13:34,999
okay.

167
00:13:34,999 --> 00:13:38,441
We talked about well, we talked about the strict memory flag.

168
00:13:38,441 --> 00:13:44,326
Let's talk about some other Swift Package Manager flags you have enabled and explain

169
00:13:44,326 --> 00:13:46,087
like why you're using those.

170
00:13:47,273 --> 00:13:51,908
yeah, so like, one that I'm quite excited by is internal imports by default.

171
00:13:51,908 --> 00:14:05,429
so in the Vapor 4 days and before, because all of our APIs returned futures or EventLoopFutures, we had to publicly export all of the NIO types that we were using.

172
00:14:05,429 --> 00:14:08,623
so if you want, if we wanted to make it easy for people to write

173
00:14:08,623 --> 00:14:09,483
request handlers.

174
00:14:09,483 --> 00:14:14,515
Instead of them also having to import SwiftNIO, we could publicly export them and makes
it lot easier to write.

175
00:14:14,515 --> 00:14:25,860
Which is great from a usability point of view, but from a library maintenance point of
view is terrible because it means that we have now tied our public API to SwiftNIO's

176
00:14:25,860 --> 00:14:26,991
public API.

177
00:14:26,991 --> 00:14:30,372
And that then follows for everything that we were exporting.

178
00:14:30,752 --> 00:14:36,716
So if we wanted to ever change internally what we were using, we can't, because that would
then be a major breaking change.

179
00:14:37,197 --> 00:14:37,577
So

180
00:14:37,577 --> 00:14:47,785
internal imports by default is a compiler flag that essentially tells the package manager
that unless you mark your imports with the public imports, then these are internal imports

181
00:14:47,785 --> 00:14:50,637
and the symbols cannot be exposed unless you opt into it.

182
00:14:50,637 --> 00:14:54,350
So there are times where you wanna do a public import such as

183
00:14:54,602 --> 00:15:01,026
In our request, we return types from the Swift HTTP Types library and we wanna make those public
rather than wrapping them in our own types.

184
00:15:01,026 --> 00:15:09,594
So it's kind of consciously opting into those public inputs, but it does mean that the
things that are now internal, we can then adopt and change.

185
00:15:09,594 --> 00:15:15,794
So if we wanna get rid of SwiftNIO, because internally we're no longer using it, we can
remove that and we don't have to do a major version release.

186
00:15:17,620 --> 00:15:24,549
So that's something I'm quite excited by because the public symbols of Vapor have been
quite annoying as we try to evolve things for sure.

187
00:15:24,946 --> 00:15:26,087
Right, right.

188
00:15:26,087 --> 00:15:29,889
Yeah, I like internal by internal import by default.

189
00:15:29,889 --> 00:15:32,451
that's what I've been using pretty consistently.

190
00:15:32,451 --> 00:15:36,066
and it's just a it's a great practice to get into.

191
00:15:36,066 --> 00:15:37,137
It is, yeah.

192
00:15:37,358 --> 00:15:39,014
okay.

193
00:15:39,755 --> 00:15:45,858
Well let's g let's get the let's get the elephant in the room out of the way.

194
00:15:46,460 --> 00:15:51,683
removing removing all the event loop and future stuff.

195
00:15:52,433 --> 00:15:55,455
How how big of an undertaking was it?

196
00:15:55,455 --> 00:15:55,896
Massive.

197
00:15:55,896 --> 00:16:06,336
it was, so in Vapor 4.50, which was, I think it was released in 2022, if I remember right,
which is just after Swift concurrency.

198
00:16:06,336 --> 00:16:11,396
was like a week after, in fact, maybe even a day after Swift concurrency was enabled on
macOS.

199
00:16:11,396 --> 00:16:16,796
We offered Swift concurrency APIs alongside our EventLoopFuture APIs.

200
00:16:16,796 --> 00:16:18,576
So everything was async/await.

201
00:16:18,821 --> 00:16:26,901
So from a public point of view, you could use async/await, but internally, we were still
jumping between futures and concurrency.

202
00:16:27,221 --> 00:16:29,701
So internally, most of Vapor was still built off futures.

203
00:16:29,701 --> 00:16:33,781
So removing them was essentially, we had to touch every part of the framework.

204
00:16:33,781 --> 00:16:41,941
So any kind of part we were doing, any IO operations, whether that's talking to files or
talking to the network or other libraries, we were doing that with futures pretty much

205
00:16:41,941 --> 00:16:42,901
exclusively.

206
00:16:43,100 --> 00:16:48,802
So yeah, it was a massive undertaking because it was effectively meant we had a full
rewrite of Vapor at that point.

207
00:16:48,802 --> 00:16:54,786
It was massively satisfying because like our code got so much simpler.

208
00:16:54,786 --> 00:17:02,511
Even things like the default middleware or the default responder, like we lost three or
four nesting lines of code.

209
00:17:02,511 --> 00:17:08,123
And anyone who used to work with futures knows it was a pain anytime you kind of had to
deal with like a

210
00:17:08,123 --> 00:17:09,194
if branch or something.

211
00:17:09,194 --> 00:17:10,155
yeah, it

212
00:17:10,155 --> 00:17:13,779
was nice, but it was futures were very, very pervasive through the code base.

213
00:17:13,779 --> 00:17:15,931
So it was, it was a big undertaking to

214
00:17:16,861 --> 00:17:19,823
they work great, pre async/await.

215
00:17:19,823 --> 00:17:22,118
It w did what it was supposed to do, but yeah.

216
00:17:22,118 --> 00:17:25,827
work fantastically, but just not particularly user friendly.

217
00:17:26,047 --> 00:17:27,458
Right, exactly.

218
00:17:27,837 --> 00:17:32,483
what do you have any big challenges that you faced with that refactor

219
00:17:32,483 --> 00:17:34,936
or migration to async/await?

220
00:17:35,838 --> 00:17:42,803
it took, I think it took me a year and a half to land that PR, which isn't just because it
was difficult, but, you know, we're working on both alongside each other.

221
00:17:42,803 --> 00:17:44,964
So we work on Vapor 4 and Vapor 5.

222
00:17:44,964 --> 00:17:48,376
There was a bug fix or a feature request into Vapor 4 that would then get merged.

223
00:17:48,376 --> 00:17:55,582
We then have to merge that into Vapor 5 and trying to run the two side by side for almost
a year and a half, I think it was, was quite difficult.

224
00:17:55,582 --> 00:17:56,865
trying to keep them up to date.

225
00:17:56,865 --> 00:17:58,248
So that was a big challenge.

226
00:17:58,248 --> 00:18:02,837
Yeah, I'm glad that we are now merged and Vapor 4 is now its own separate thing for sure.

227
00:18:03,797 --> 00:18:07,598
are you still gonna be doing anything with Vapor 4 for now?

228
00:18:07,598 --> 00:18:09,338
so Vapor 4 will continue.

229
00:18:09,338 --> 00:18:11,999
It's still the released version of Vapor.

230
00:18:11,999 --> 00:18:15,201
So we will continue to do bug fixes and security releases.

231
00:18:15,201 --> 00:18:26,527
And then at the point when Vapor 5 is released, we will commit to a likely, but not
confirmed, six month support timeline where we'll support Vapor 4 for security fixes and

232
00:18:26,527 --> 00:18:29,328
any serious bug fixes for six months.

233
00:18:29,580 --> 00:18:35,098
but the majority of the feature workers now in Vapor 5, they've branched off and they will
start to diverge.

234
00:18:36,341 --> 00:18:36,841
Okay.

235
00:18:36,841 --> 00:18:47,013
I had a question about streaming, but you kinda answered that because you said one of the
big things has been AI has been a big push towards streaming.

236
00:18:47,013 --> 00:18:52,065
Was there something else I'm supposed to ask about that, you think, or you think we
covered it?

237
00:18:52,065 --> 00:19:01,961
mean, the main push for going streaming first was it was a mixture between performance in
that for like small request bodies, it's fine.

238
00:19:01,961 --> 00:19:02,701
People don't really care.

239
00:19:02,701 --> 00:19:03,912
You just load the whole thing into memory.

240
00:19:03,912 --> 00:19:04,902
But as

241
00:19:04,902 --> 00:19:11,016
soon as anyone wants to do anything that's even moderately big, you kind of want to be
able to stream that.

242
00:19:13,617 --> 00:19:15,788
I mean, I'd say anything over like

243
00:19:16,550 --> 00:19:19,970
few hundred kilobytes is moderately big.

244
00:19:20,113 --> 00:19:20,670
Okay.

245
00:19:20,670 --> 00:19:30,549
Not from like a major issue, but if you have a few hundred kilobytes and scale that up by
10,000 users, that's a significant amount of

246
00:19:30,549 --> 00:19:31,222
Right, right.

247
00:19:31,222 --> 00:19:32,204
I gotcha.

248
00:19:32,470 --> 00:19:36,290
So yeah, we want to be able to do streaming by default.

249
00:19:36,290 --> 00:19:42,630
And we also wanted to make streaming super simple to use as well, because previously it
wasn't.

250
00:19:42,630 --> 00:19:45,810
So we could make use of some of the new async stuff.

251
00:19:46,126 --> 00:19:48,808
And yeah, the APIs have turned out really nicely.

252
00:19:48,808 --> 00:19:51,299
But the main thing is that it's now the same thing.

253
00:19:51,299 --> 00:19:56,221
So your request handlers, don't have to choose between streaming or non-streaming.

254
00:19:56,221 --> 00:19:57,472
It's streaming always.

255
00:19:57,472 --> 00:20:01,714
And you just have like a lazy collection of the body whenever you need it or whatever
needs it first.

256
00:20:02,679 --> 00:20:06,325
is streaming is a pretty much supported by nearly every client.

257
00:20:07,556 --> 00:20:18,085
Yeah, well, so there's difference between streaming at the kind of app level and streaming
at the kind of HTTP level.

258
00:20:18,085 --> 00:20:28,262
So if you send a cURL request using cURL from the command line with like a massive file,
that whole file isn't sent in one packet, it's sent in several packets, which is then...

259
00:20:28,262 --> 00:20:33,406
decoded into several chunks of the kernel level, is then decoded by NIO as several chunks.

260
00:20:33,406 --> 00:20:36,768
So we just make it super simple to iterate over that.

261
00:20:36,768 --> 00:20:39,070
And if you need to load into memory because it's all JSON, sure.

262
00:20:39,070 --> 00:20:44,954
But if you're writing that out to disk, then you can just stream that response straight to
disk and not have to worry about memory.

263
00:20:45,766 --> 00:20:47,828
Okay, that makes total sense.

264
00:20:48,523 --> 00:20:52,795
do you wanna talk about testing or the Swift HTTP server?

265
00:20:53,191 --> 00:21:00,157
Let's talk about talk about the HTTP server first, then we can move on to the shiny new
things in Vapor.

266
00:21:00,776 --> 00:21:11,513
So from what you've told me and from what I read on the blog post, there's basically we
have a layer that anybody can pick up and use.

267
00:21:11,513 --> 00:21:15,646
that's a layer on top of SwiftNIO that's an HTTP server.

268
00:21:15,646 --> 00:21:24,862
And the idea being is that anybody who wants to write a competitor or another HTTP server,
they can use that.

269
00:21:24,862 --> 00:21:29,065
so like Hummingbird could use it and now you're using that in Vapor 5.

270
00:21:29,305 --> 00:21:30,146
what

271
00:21:31,146 --> 00:21:39,110
What what was the thought process and why this was needed and what what are some of the
benefits that you've seen using it?

272
00:21:39,307 --> 00:21:49,324
Yeah, so so the original kind of idea or intention behind this was that everyone in the
ecosystem is using NIO because it's a fantastic, well-tested, well-used, well-developed,

273
00:21:49,324 --> 00:21:50,675
well-maintained library.

274
00:21:50,675 --> 00:21:55,379
But no one's writing, wants to write like channel handler code.

275
00:21:55,379 --> 00:21:56,740
Yeah, like

276
00:21:56,800 --> 00:21:57,541
it's complex.

277
00:21:57,541 --> 00:22:01,760
And realistically, if you're building a web server doing HTTP,

278
00:22:01,760 --> 00:22:05,481
you've got to build an HTTP server and the difference.

279
00:22:06,929 --> 00:22:12,289
between say the Vapor HTTP server and the Hummingbird HTTP server was pretty much nothing.

280
00:22:12,289 --> 00:22:23,129
Like the types are different and the kind of way things were exposed are different, but at
the core level you're dealing with NIO and then handling HTTP.

281
00:22:23,129 --> 00:22:31,209
So the idea was that, you know, there's no point us both writing an HTTP server where we
both need to handle with edge cases.

282
00:22:31,337 --> 00:22:35,062
We both need to handle all these different things that are done in exactly the same way.

283
00:22:35,062 --> 00:22:36,743
We might as well have a shared implementation.

284
00:22:36,743 --> 00:22:42,228
So Hummingbird started this off in Hummingbird 2 with a kind of new HTTP server that
was...

285
00:22:44,422 --> 00:22:48,614
in the very, very early days of Vapor 5 was what we were using and built on top of.

286
00:22:48,614 --> 00:22:58,363
And then the Swift HTTP server kind of spun out that idea and some of that original work
to create a new HTTP server of, what could we build if we wanted to take advantage of all

287
00:22:58,363 --> 00:22:59,417
of the latest for features.

288
00:22:59,417 --> 00:23:01,578
So the idea was to build a...

289
00:23:03,089 --> 00:23:07,883
bidirectional streaming server that was as compiler safe as possible.

290
00:23:07,883 --> 00:23:15,190
So that all of the errors that you might have, all of the program errors that you might
write will become compiler errors rather than runtime errors.

291
00:23:15,190 --> 00:23:20,466
So that's where things like the non-escapable and non-copyable request bodies come into
play.

292
00:23:20,466 --> 00:23:22,217
And...

293
00:23:22,671 --> 00:23:25,204
That then means anyone can write a very simple HTTP server.

294
00:23:25,204 --> 00:23:27,667
You can just depend on that and set up your route handlers.

295
00:23:27,667 --> 00:23:39,370
And then Hummingbird and Vapor and any other web framework on top can then add on routing
and middleware and sessions, cookies and authentication and whatever else like fun

296
00:23:39,370 --> 00:23:41,132
syntactic sugar on top they want.

297
00:23:41,929 --> 00:23:42,494
Got it.

298
00:23:42,494 --> 00:23:44,223
That makes a lot of sense.

299
00:23:45,413 --> 00:23:47,034
What else am I missing?

300
00:23:47,275 --> 00:23:49,442
But that's the stuff you provide on top.

301
00:23:49,442 --> 00:23:59,244
Yeah, so Vapor can provide routing and we can build some really nice routing, syntax sugar
and fun functions with macros that we'll probably talk about in a bit.

302
00:23:59,244 --> 00:24:07,207
We provide session support and authentication support and our middleware types, although
that might be shared as well in the future.

303
00:24:07,207 --> 00:24:09,297
And yeah, so it allows us to write

304
00:24:09,467 --> 00:24:14,772
really nice framework on top that all of the kind low level HTTP stuff we don't have to
really worry about anymore.

305
00:24:14,772 --> 00:24:19,776
We can just concentrate on kind of building a really nice application layer framework.

306
00:24:21,438 --> 00:24:25,561
So I did want to talk about VaporTesting.

307
00:24:26,122 --> 00:24:29,209
So what is new?

308
00:24:29,209 --> 00:24:32,710
I've never used the testing stuff in Vapor, I'll be honest.

309
00:24:33,211 --> 00:24:36,325
What what's new in v in the latest version?

310
00:24:36,325 --> 00:24:43,389
does it use Swift Testing now or like what what are you really taking advantage of with a
new testing library?

311
00:24:43,504 --> 00:24:50,506
Yeah, so VaporTesting has been around for in various iterations for many, many years.

312
00:24:50,506 --> 00:24:52,209
It used to be called XCTVapor.

313
00:24:52,209 --> 00:24:54,280
In fact, the original library was XCTVapor.

314
00:24:54,280 --> 00:25:01,274
And then when Swift Testing was released, we released a a VaporTesting wrapper that would
work with Swift Testing.

315
00:25:01,274 --> 00:25:08,042
But because we've gone from futures to sort of concurrency from XCTest to Swift Testing,

316
00:25:08,042 --> 00:25:17,247
we had five or six different ways of you being able to write a test in Vapor or a kind of
a test route, all doing different things and all not quite working the same way.

317
00:25:17,247 --> 00:25:21,809
So with this major release, we took the opportunity to streamline that.

318
00:25:21,809 --> 00:25:25,071
And so there is now one way to write a test for an application.

319
00:25:25,071 --> 00:25:32,802
You can create your application and you can just call .testing on it and it will deal with
routing it to the right request handler.

320
00:25:32,802 --> 00:25:35,304
You can configure it to be either in memory.

321
00:25:35,304 --> 00:25:37,689
So it never actually sends a real network request.

322
00:25:37,689 --> 00:25:42,493
That kind of all gets bypassed and it just gets written directly through to the responder
chain.

323
00:25:42,493 --> 00:25:49,338
Or if you need to test things like back pressure or kind of anything where you need a real
network, you can send a real request.

324
00:25:49,338 --> 00:25:53,862
So it will spin up the server for you, send an actual HTTP request and then deal with that
all for you.

325
00:25:53,862 --> 00:25:56,114
And now it is built on Swift Testing explicitly.

326
00:25:56,114 --> 00:25:57,855
We had to have some weirds.

327
00:25:58,977 --> 00:26:11,217
patch code in old Vapor where we had to detect if you're running a Swift Testing or XCTest to make sure you're in the right one because they don't play particularly nicely

328
00:26:11,217 --> 00:26:12,017
together.

329
00:26:12,017 --> 00:26:14,837
So yeah, we've gone all in to a testing one way to do it.

330
00:26:14,837 --> 00:26:19,957
It's really nice to streamlines and we've made it really easy to write tests.

331
00:26:19,957 --> 00:26:23,857
I think no matter what kind of what you're testing.

332
00:26:25,478 --> 00:26:36,281
so use a Swift Testing and then you can basically choose how w from what it sounds like
you can choose either r like, I don't want I don't need a full server, I just need you to

333
00:26:36,281 --> 00:26:42,407
test routing or I need you to test some particular feature and then you can mock that
pretty easily.

334
00:26:42,407 --> 00:26:43,898
That's pretty awesome.

335
00:26:44,900 --> 00:26:54,730
Yeah, so for most people and most use cases, if you wanna test your request handlers where
you wanna say, okay, well, I'm sending a a post request with a JSON body to this route and

336
00:26:54,730 --> 00:27:01,055
I wanna ensure that it only allows authenticated users and it writes this to the database
and then returns this response.

337
00:27:01,055 --> 00:27:02,156
You can do all that in memory.

338
00:27:02,156 --> 00:27:06,946
It's almost instant, the kind of request times, because there's no network requests.

339
00:27:06,946 --> 00:27:09,828
If you're talking to a database, then it adds a little bit time on.

340
00:27:09,828 --> 00:27:14,331
But then you have these really quick performance in-memory tests that are nice and easy to
write.

341
00:27:14,331 --> 00:27:23,215
If you do need a real server you wanna talk to, because you might wanna test back pressure
or you wanna test like TLS termination and whatever, then yeah, you can just specify a

342
00:27:23,215 --> 00:27:25,677
single argument and say in-memory.

343
00:27:25,678 --> 00:27:28,739
If you wanna specify the port that it runs on, you can as well.

344
00:27:28,949 --> 00:27:31,144
but by default it will just pick a port for you that's free.

345
00:27:31,144 --> 00:27:35,502
And then, yeah, you can just send us the same API, you can send a real request.

346
00:27:37,033 --> 00:27:40,586
okay I wanted to ask about macros, but

347
00:27:40,586 --> 00:27:42,717
I also want to ask about Fluent.

348
00:27:43,478 --> 00:27:52,426
And maybe because one of the big things about Fluent was or is the use of property
wrappers.

349
00:27:52,426 --> 00:27:53,286
for sure.

350
00:27:53,286 --> 00:27:57,089
And sounds like you've started introducing macros into Vapor.

351
00:27:57,089 --> 00:28:01,873
Kind of what's the tension before we get into the macros and Fluent?

352
00:28:01,873 --> 00:28:05,766
What's the tension between property wrappers and

353
00:28:07,272 --> 00:28:14,517
So property wrappers and macros look very similar, but they work in entirely different
ways.

354
00:28:16,019 --> 00:28:18,241
macros is code generation.

355
00:28:18,241 --> 00:28:27,628
So you annotate your code with a macro and then at compile time, it'll expand that into
whatever the macro is specified into code that then gets compiled and that compiled code

356
00:28:27,628 --> 00:28:29,830
is then what's shipped finally.

357
00:28:29,830 --> 00:28:32,212
Property wrappers are more of like a runtime thing.

358
00:28:32,212 --> 00:28:35,514
So you annotate your properties with a property wrapper.

359
00:28:35,592 --> 00:28:39,163
And then at runtime, it runs through the property wrapper and does whatever it needs to
do.

360
00:28:39,163 --> 00:28:47,490
So because of this, are a bit restrictive in property wrappers, sorry, are a bit
restrictive in what they

361
00:28:47,490 --> 00:28:48,530
can do at runtime.

362
00:28:48,530 --> 00:28:49,871
And they're also super slow.

363
00:28:49,871 --> 00:28:59,825
So one of the big pain points of Fluent has been that for anything where you're dealing
with like a large response sets, it's really, really slow to decode all that into your

364
00:28:59,825 --> 00:29:00,595
Swift.

365
00:29:00,854 --> 00:29:02,140
Fluent models.

366
00:29:02,442 --> 00:29:03,257
Okay.

367
00:29:04,899 --> 00:29:17,881
So yeah, so in in Vapor 5 we've started adding some macros they are purely additive for
now and they are built around routing so if you want to Define a route you can define a

368
00:29:17,881 --> 00:29:24,463
route with your macro instead of having to go through the whole Request handler definition
now

369
00:29:24,463 --> 00:29:26,683
and the macro will expand that for you

370
00:29:26,779 --> 00:29:29,399
And this allows us to do some really nice things.

371
00:29:29,399 --> 00:29:35,859
So number one you can define is a, an @GET macro and then an @POST macro that work
really nicely.

372
00:29:35,859 --> 00:29:41,539
We have a controller macro and this allows us to do things like type-safe routing.

373
00:29:41,539 --> 00:29:53,570
So in Vapor 4, if you wanted to pass say like an integer in the path as a path parameter,
so you do like slash users slash 42, you would have to specify that as a string.

374
00:29:53,570 --> 00:30:01,224
you then have to convert that in your request handler and pull that out and then convert
it to an int or get the library to convert it to an int for you.

375
00:30:01,224 --> 00:30:04,589
And make sure that the types match as well because everything was a string key.

376
00:30:04,589 --> 00:30:09,131
So you'd have to make sure that the parameter that you're requesting is the same that you
defined in your route handler.

377
00:30:09,131 --> 00:30:13,029
And it wasn't very particularly, it wasn't a great user experience.

378
00:30:13,029 --> 00:30:13,692
to get through it.

379
00:30:13,692 --> 00:30:15,241
Yeah.

380
00:30:15,241 --> 00:30:18,913
making a little bit better and stuff, but yeah, the definition of all string types.

381
00:30:18,913 --> 00:30:27,646
So with macros, what we can do is we can take advantage of the kind of code expansion and
do all of that for you in a macro.

382
00:30:27,646 --> 00:30:29,447
And you can annotate your codes.

383
00:30:29,447 --> 00:30:40,241
So you can say @GET, and then you can say this path, and then you can have like Int.self as one of the path parameters and the macro will expand into

384
00:30:40,241 --> 00:30:50,276
a code that pulls that out for you, it names the path parameters for you, it's all written
in code, and your request handler has to have an integer as one of the parameters because

385
00:30:50,276 --> 00:30:52,207
you're parsing in, because you've asked it to pass in.

386
00:30:52,207 --> 00:30:53,827
And if it doesn't, you'll get a compile error.

387
00:30:53,827 --> 00:30:54,787
And vice versa.

388
00:30:54,787 --> 00:31:04,231
you try and pass in, specify a request handler with extra property that isn't defined in
the part in the route registration, then it will also fail to

389
00:31:04,803 --> 00:31:05,983
So those things are really, nice.

390
00:31:05,983 --> 00:31:17,485
And also, hopefully the next beta should have authentication macros as well, where we can
do similar things with macros so that we can make sure that if you want a user as an

391
00:31:17,485 --> 00:31:24,873
authenticated user, then the macro will basically do all of that for you and give you a
guaranteed user without you having to write request.

392
00:31:24,873 --> 00:31:25,744
req.auth.require.

393
00:31:25,744 --> 00:31:27,176
So I'm quite looking forward to that.

394
00:31:27,176 --> 00:31:33,014
But it's been a fun experience dealing with macros, I'll put it that way.

395
00:31:34,639 --> 00:31:36,644
What's what's your biggest headache?

396
00:31:37,452 --> 00:31:42,965
So I think the biggest headache with macros is from an end user's point of view, they're
fantastic.

397
00:31:42,965 --> 00:31:47,348
From a developer's point of view, like the people developing the macros, it's painful.

398
00:31:47,348 --> 00:31:48,569
It's quite hard to test them.

399
00:31:48,569 --> 00:31:53,551
And there are things that you would kind of assume would work that don't work.

400
00:31:53,612 --> 00:31:58,514
So one of the big challenges we've had is that with the authentication macros, for
instance,

401
00:31:58,514 --> 00:32:07,255
they're written and they work and it's great and you pass in your middleware, your
authentication middleware into the macro and that all works and it's great but most people

402
00:32:07,255 --> 00:32:16,957
won't be able to pass in like a logger or a kind of some kind of setup or a database
connection into their middleware that will be the one that retrieves like the

403
00:32:16,957 --> 00:32:18,860
authenticated users from the database.

404
00:32:18,860 --> 00:32:19,708
Right.

405
00:32:19,918 --> 00:32:22,430
That's really difficult with macros because of the

406
00:32:22,430 --> 00:32:33,875
timing of where they're evaluated, you can't say specify a connection pool on a controller
and then read that in the macro that's then defined inside that controller because at the

407
00:32:33,875 --> 00:32:38,536
point where the macro is expanded, it doesn't have the symbols to be able to read the
connection.

408
00:32:38,536 --> 00:32:40,238
So you get these weird compiler errors.

409
00:32:40,238 --> 00:32:44,138
So finding workarounds for that has been really quite painful and quite complex.

410
00:32:44,138 --> 00:32:45,312
of the workarounds?

411
00:32:45,520 --> 00:32:46,340
So

412
00:32:47,168 --> 00:32:49,190
Depending on you're trying to do, you can use a key path.

413
00:32:49,190 --> 00:32:52,413
That works reasonably well, but it's not the nicest to write.

414
00:32:52,413 --> 00:32:56,798
You can use a computed property that's evaluated later that that seems to work as well.

415
00:32:56,798 --> 00:33:02,526
But the way that I think we're gonna go about it is with task locals and just bypass the
problem entirely.

416
00:33:02,526 --> 00:33:03,316
Yep.

417
00:33:04,643 --> 00:33:12,992
So I think that I need to see how we kind of get on with the next beta in the next few
kind of iterations, but I think we're gonna start to use task locals a lot more for

418
00:33:13,053 --> 00:33:16,837
passing things like database connection pools down to where you need them to be.

419
00:33:17,183 --> 00:33:18,634
That makes total sense.

420
00:33:18,673 --> 00:33:28,201
you know, just going off of the routing stuff too, like I've I've kind of switched towards
using the OpenAPI stuff that we

421
00:33:28,201 --> 00:33:29,142
have.

422
00:33:29,262 --> 00:33:36,326
What what are some benefits with going with routing in say Vapor or Hummingbird over just
using OpenAPI?

423
00:33:36,990 --> 00:33:39,313
Well, I mean, the OpenAPI stuff still has to do routing.

424
00:33:39,313 --> 00:33:44,800
Because you can define your routes up front, the server itself needs to...

425
00:33:45,922 --> 00:33:46,843
Yeah.

426
00:33:47,184 --> 00:33:48,084
Yeah.

427
00:33:48,866 --> 00:33:49,530
Because...

428
00:33:49,530 --> 00:33:52,223
why would a user directly want to do routing?

429
00:33:52,861 --> 00:33:55,771
So if you want to define your own routes, there are a number of reasons.

430
00:33:55,771 --> 00:34:00,312
Number one is that you might not want to bother writing an OpenAPI spec.

431
00:34:00,312 --> 00:34:03,336
If you're building something simple, you don't need to write an API spec.

432
00:34:03,336 --> 00:34:05,077
It's like another layer of complexity.

433
00:34:05,077 --> 00:34:12,759
And the other reason that you might want to do it is because some people like the server
code to be the source of truth for the routes rather than the spec.

434
00:34:13,023 --> 00:34:18,423
In Swift, it's slightly different because of the way that the OpenAPI generator works.

435
00:34:18,423 --> 00:34:24,843
It's really nice because if you change your routes, it will recompute the functions that
you need at build time.

436
00:34:24,843 --> 00:34:28,563
So it's very hard for those documents to get out of sync, which is a really, really nice
feature.

437
00:34:28,563 --> 00:34:30,683
Other languages might not have that feature.

438
00:34:30,683 --> 00:34:35,443
So you have to kind of manually recompute or like recalculate the routes.

439
00:34:35,443 --> 00:34:37,623
And it's very easy for those things to get out of sync.

440
00:34:38,440 --> 00:34:44,524
So yeah, Vapor 5 will support OpenAPI routes from both directions.

441
00:34:44,545 --> 00:34:47,367
So we'll have the same OpenAPI generator support.

442
00:34:47,367 --> 00:34:50,589
That PR is actually up by someone from the community, which I'll be reviewing

443
00:34:50,589 --> 00:34:50,929
today.

444
00:34:50,929 --> 00:34:55,132
So that allows you to go from a spec to your Vapor code and generate the routes that way.

445
00:34:55,132 --> 00:35:01,677
But we're also gonna be able to, you're also gonna be able to go from your code, run a
command and it will generate a spec for you.

446
00:35:01,892 --> 00:35:02,721
Next.

447
00:35:03,003 --> 00:35:06,153
So if you want to go that way, because some people prefer it, then you can go that way as
well.

448
00:35:07,663 --> 00:35:13,502
I was gonna say like the the reason I've found is for things that basically are not
supposed to

449
00:35:15,191 --> 00:35:20,525
gRPC is a example of something like that, WebSockets, things like that.

450
00:35:20,525 --> 00:35:23,497
That's where I've ended up having to do my own routing.

451
00:35:23,497 --> 00:35:34,536
and it's funny you mentioned going from code to OpenAPI, 'cause I did that years ago, and
we're now trying to move everything the other way, just because the OpenAPI generator is

452
00:35:34,536 --> 00:35:35,576
so nice.

453
00:35:35,696 --> 00:35:40,481
Yeah, and previously the going from code to an OpenAPI spec was really painful.

454
00:35:40,481 --> 00:35:42,744
It required an extra package.

455
00:35:42,744 --> 00:35:47,789
had to change the way that you defined your routes and yeah, it wasn't very easy to use.

456
00:35:47,789 --> 00:35:48,290
So I can

457
00:35:48,290 --> 00:35:52,254
make that kind of a inbuilt by default behind the traits.

458
00:35:52,894 --> 00:35:55,211
So we talked about it, Fluent.

459
00:35:55,211 --> 00:35:57,778
What's kind of the plan with Fluent right now?

460
00:35:57,778 --> 00:36:00,296
'Cause that's independent of Vapor 5,

461
00:36:00,296 --> 00:36:01,423
more or less.

462
00:36:01,423 --> 00:36:10,432
So back in the very early days, Vapor 2 days, package, Vapor 1 was one big thing, but
everything was in one package, which was great, but it made your app a little heavy.

463
00:36:10,432 --> 00:36:19,126
So in the Vapor 2 days, all those packages kind of got split out as a means of saying,
well, we can then iterate on these separately and evolve them separately and they can

464
00:36:19,126 --> 00:36:20,516
evolve their own paces.

465
00:36:20,955 --> 00:36:24,808
Unfortunately that never really happened and everything evolved alongside each other.

466
00:36:24,808 --> 00:36:32,994
So we're starting now to see like JWTKit for instance, it's now its own package and
that's been on its own new major version for a couple of years.

467
00:36:33,094 --> 00:36:35,096
So it's been really nice to able to evolve that independently.

468
00:36:35,096 --> 00:36:36,912
And Fluent will probably be similar.

469
00:36:36,912 --> 00:36:39,904
So Fluent 4 will be fully supported in Vapor 5.

470
00:36:41,434 --> 00:36:42,514
it works currently.

471
00:36:42,514 --> 00:36:54,974
If you create a new route, I'm sorry, a new project using the Vapor CLI with the Vapor 5
flag, it will create a Fluent based app for you that you can use and it works fine.

472
00:36:54,974 --> 00:36:56,794
So Fluent will kind of evolve independently.

473
00:36:56,794 --> 00:37:00,934
Gwynne, who maintains most of the Fluent, has been working on a lot of the low level
stuff.

474
00:37:00,934 --> 00:37:02,474
So Fluent is...

475
00:37:02,498 --> 00:37:04,399
not just Fluent, there's all of the drivers.

476
00:37:04,399 --> 00:37:08,503
There's also SQLKit which converts Swift code into SQL.

477
00:37:08,503 --> 00:37:10,365
So those things have been worked on.

478
00:37:10,365 --> 00:37:15,949
And then when we have time, like every other open source project, we can start working for
the five.

479
00:37:16,470 --> 00:37:23,215
We have a good idea of what we wanna achieve and how we want it to work, which will be
primarily macros.

480
00:37:24,259 --> 00:37:30,763
because we can use those to generate the code that will give us really fast models and
queries, rather than having to rely on reflection of everything.

481
00:37:30,763 --> 00:37:34,064
But that will be released independently and separately from Vapor.

482
00:37:34,064 --> 00:37:44,910
I wouldn't be too surprised if we did a kind of intermediately release of Fluent, which
would be a new major version that throws away all of the future based stuff and allows us

483
00:37:44,910 --> 00:37:45,910
to adopt.

484
00:37:46,058 --> 00:37:48,982
structured concurrency and some nice things that we're missing there.

485
00:37:48,982 --> 00:37:52,507
But that won't be the new full featured fancy shiny thing.

486
00:37:52,507 --> 00:37:54,269
That will be later on down the line.

487
00:37:54,514 --> 00:37:55,334
Right.

488
00:37:55,376 --> 00:37:57,138
Yeah, that makes total sense.

489
00:37:57,520 --> 00:38:00,614
Is there anything excuse me?

490
00:38:00,647 --> 00:38:06,898
Is there anything in the database space that's changed that you'd wanna adopt in Fluent?

491
00:38:07,929 --> 00:38:09,310
Not massively, think.

492
00:38:09,310 --> 00:38:22,464
think one thing that we've already kind of started to push towards is that Fluent 4 was
written as an ORM that would work with both SQL and NoSQL databases, so it supported

493
00:38:22,464 --> 00:38:23,954
MongoDB as well.

494
00:38:24,115 --> 00:38:26,175
And I think that was a mistake.

495
00:38:26,175 --> 00:38:32,096
I think fundamentally NoSQL databases and SQL databases work very, very differently.

496
00:38:32,271 --> 00:38:33,260
Yeah, I agreed.

497
00:38:33,260 --> 00:38:37,082
build an ORM that works across all of them just gives you the worst of both worlds.

498
00:38:37,082 --> 00:38:38,902
You basically have the lowest common denominator.

499
00:38:38,902 --> 00:38:43,864
So yeah, think that's definitely something that will change and we will change going
forward.

500
00:38:43,864 --> 00:38:46,435
Yeah, that's something that's kind of been decided on.

501
00:38:48,220 --> 00:38:50,082
all right, so we have to do it.

502
00:38:50,082 --> 00:38:51,727
We have to talk about AI.

503
00:38:51,727 --> 00:38:52,576
Mm-hmm.

504
00:38:52,704 --> 00:38:53,664
Okay.

505
00:38:54,025 --> 00:38:58,658
how has AI affected server side Swift?

506
00:38:58,658 --> 00:39:03,691
I guess we've already talked about like streaming being a first class feature.

507
00:39:05,013 --> 00:39:16,060
I'm more I'm more interested in like what how has AI made you rethink server side stuff
before we get into how AI has affected the development process?

508
00:39:16,497 --> 00:39:18,580
I think for server-side stuff

509
00:39:19,580 --> 00:39:24,092
I think it makes it a lot easier to try things out.

510
00:39:24,092 --> 00:39:27,073
I think it's very coupled to the development question to be honest.

511
00:39:28,149 --> 00:39:43,532
I don't think AI itself has changed anything that's specific to the server world outside
of the development world, other than maybe security stuff in that we have gone from maybe

512
00:39:43,532 --> 00:39:47,770
seeing like a security advisory

513
00:39:47,770 --> 00:39:51,781
or people submitting security issues once every few months.

514
00:39:51,781 --> 00:39:53,001
Yeah, people.

515
00:39:53,062 --> 00:40:05,536
Once every few months to like several a month, like a massive influx, which is a server
project is particularly problematic because we handle lots and lots of requests.

516
00:40:05,536 --> 00:40:12,187
And if that, if there's a way of either crashing that process, that's a big problem, or
there's a way of, you know,

517
00:40:12,327 --> 00:40:18,570
losing data or people breaking into other people's data or that kind of thing, that's
another big problem.

518
00:40:18,570 --> 00:40:26,995
So that has been a big effect and the times that that has or the time that that takes up
is significantly more than it used to be.

519
00:40:26,995 --> 00:40:32,398
To be fair, some of the reports are legitimate and we've fixed quite a few things and if
GitHub can...

520
00:40:33,154 --> 00:40:40,414
Also catch up, we should have some of security advisors coming out because they're also
struggling under the weight of requests.

521
00:40:41,064 --> 00:40:44,234
GitHub is struggling a lot right now, so let's

522
00:40:44,234 --> 00:40:52,694
GitHub's one line of reliability is struggling quite a bit, I think previously, like the
main issue we have at the moment is CVE times.

523
00:40:52,984 --> 00:40:53,494
Okay.

524
00:40:53,494 --> 00:41:00,494
It used to take one to two days for a CVE to be issued to us when we requested it, which
is like a...

525
00:41:00,494 --> 00:41:06,729
For those people that don't know, a CVE is like a global identifier, a common
vulnerability.

526
00:41:07,729 --> 00:41:09,440
I want to say enumeration, but that's probably wrong.

527
00:41:09,440 --> 00:41:10,541
It's

528
00:41:10,541 --> 00:41:14,963
basically an ID that's given to your vulnerability in a global database that people have.

529
00:41:14,963 --> 00:41:18,785
And previously we'd do the fix, we'd get the fork up, we'd fix it.

530
00:41:18,785 --> 00:41:23,347
We'd request a CVE that would take one to two days and then we'd publish with the CVE and
that gets distributed.

531
00:41:23,347 --> 00:41:26,129
It's taking months to get CVEs now, which is problematic.

532
00:41:26,129 --> 00:41:28,920
So that's a big problem at the moment that we're facing.

533
00:41:31,483 --> 00:41:33,776
Yeah, what else did you want to talk about?

534
00:41:34,574 --> 00:41:38,007
AI development specifically, yeah.

535
00:41:38,007 --> 00:41:40,522
It's mixed.

536
00:41:40,522 --> 00:41:53,139
I think it's, AI makes it really easy to automate the stuff that you kind of, the gnarly
repetitive stuff that you don't really want to bother, which is great.

537
00:41:53,139 --> 00:41:56,481
It makes it really easy to prototype stuff as well.

538
00:41:57,455 --> 00:42:04,006
So for instance, I was working on server-sent events recently, which is a form of
streaming messaging.

539
00:42:05,307 --> 00:42:10,808
So being able to spin up a client that can prototype that really quickly and make it work
and write tests for it is really easy.

540
00:42:10,808 --> 00:42:15,128
I think from a open source point of view, it's like a double-edged sword.

541
00:42:15,128 --> 00:42:18,639
It means that we can work on a lot more things in some aspects, but.

542
00:42:18,639 --> 00:42:23,661
The other side of that is that we have all this code that what we do, do we trust it?

543
00:42:23,661 --> 00:42:24,531
we submit it?

544
00:42:24,531 --> 00:42:28,012
Especially pull requests are fully AI generated.

545
00:42:28,012 --> 00:42:35,875
Some of them are valid, but more often than not, they're kind of overly verbose or kind of
not going about it the best way.

546
00:42:35,916 --> 00:42:36,996
And that's time sink.

547
00:42:36,996 --> 00:42:43,167
So kind of our workload of managing all of open source pull requests is increased
significantly as well as working on it yourself.

548
00:42:43,167 --> 00:42:51,702
And then the kind of funding point of view is really interesting to watch open source
funding just almost drop off a cliff in the last like six months to a year.

549
00:42:51,702 --> 00:43:00,267
And I know lots of other open source projects are having the same thing as well, where
people would rather spend the money on tokens and sponsoring open source projects because

550
00:43:00,267 --> 00:43:02,218
there's a lot of, I can just build it myself.

551
00:43:02,218 --> 00:43:03,609
So I'll build it myself.

552
00:43:04,070 --> 00:43:06,910
So it's a weird time for the industry, I'll say.

553
00:43:08,005 --> 00:43:13,194
what's your outlook as far as like how long this is gonna last?

554
00:43:13,271 --> 00:43:15,594
Depends on when the investors want their money back.

555
00:43:15,594 --> 00:43:16,164
I don't know.

556
00:43:16,164 --> 00:43:19,399
think, I definitely think it feels like things are starting to turn.

557
00:43:19,399 --> 00:43:21,902
People are getting a bit more.

558
00:43:24,218 --> 00:43:34,042
We're hearing lots about companies kind of getting worried about token spends, bringing
people back that they've laid off because you still need engineers to review what's going

559
00:43:34,042 --> 00:43:34,282
on.

560
00:43:34,282 --> 00:43:38,564
It does feel like we're kind of at the peak, the top of the peak.

561
00:43:38,564 --> 00:43:41,895
And I think AI is going to be a tool that's always going to exist now.

562
00:43:41,895 --> 00:43:46,967
But I don't know what format will take and if they started charging how much it actually
costs them.

563
00:43:46,967 --> 00:43:49,258
I think a lot of people will stop using it quite quickly.

564
00:43:49,507 --> 00:43:50,358
Right, exactly.

565
00:43:50,358 --> 00:43:59,795
what are what are some of the you said verbose pull requests, what are some of the
particular issues you've run into with code generated via AI?

566
00:43:59,795 --> 00:44:02,281
Number one is kind of.

567
00:44:04,497 --> 00:44:07,479
especially Claude really likes to comment on everything.

568
00:44:07,479 --> 00:44:12,341
So you just have lines and lines of comments that are like, just read the code.

569
00:44:12,341 --> 00:44:13,322
This is useless.

570
00:44:13,322 --> 00:44:23,226
And as a kind of maintainer, you have to read all the lines of code to make sure that the
code that you accept is A, both valid and worthy, fits in with what you wanna do and also

571
00:44:23,226 --> 00:44:29,722
is secure because we're a large open source project, people rely on and we're not immune
to people trying to slip back

572
00:44:29,722 --> 00:44:31,642
back doors and to the projects.

573
00:44:31,642 --> 00:44:34,162
We have to make sure that every human review is legit.

574
00:44:34,162 --> 00:44:35,462
So that is a problem.

575
00:44:35,462 --> 00:44:40,762
But yeah, and then you get things of AI trying to reinvent the wheel and re-implementing
stuff.

576
00:44:40,762 --> 00:44:47,542
one line of code would solve it, but here's 250 lines of code because it's come up with a
new way or something.

577
00:44:47,820 --> 00:44:48,240
Right.

578
00:44:48,240 --> 00:44:52,451
Or it overdoes it and builds I think I mentioned in one of my

579
00:44:52,451 --> 00:44:58,933
talks how it's like trying to add a whole new retry and networking layer and it's like
what what are you doing?

580
00:44:58,933 --> 00:44:59,813
Stop.

581
00:44:59,813 --> 00:45:01,173
I don't need that.

582
00:45:01,173 --> 00:45:02,274
Yeah, totally.

583
00:45:02,274 --> 00:45:13,957
before we close, are there any Swift packages you'd recommend folks check out either
server side or not, that you think people should be really taking advantage of?

584
00:45:14,008 --> 00:45:15,714
general packages.

585
00:45:16,714 --> 00:45:18,055
spot here.

586
00:45:18,055 --> 00:45:25,259
I think the, so from a networking point of view, or a server point of view, I think people
should definitely take a look at the HTTP server library.

587
00:45:25,259 --> 00:45:28,742
And there's also a new HTTP client library that is out there.

588
00:45:28,742 --> 00:45:32,364
It's a lot more early stages than the server library.

589
00:45:32,364 --> 00:45:37,772
Most of it's still in the kind of API proposal stage, but there are implementations out
there.

590
00:45:37,772 --> 00:45:41,413
But that is something that the Networking Workgroup is working on actively.

591
00:45:41,413 --> 00:45:47,194
And that will become the new API that Swift will use for making network requests.

592
00:45:47,194 --> 00:45:51,115
So URLSession will become an implementation detail.

593
00:45:51,115 --> 00:45:53,836
AsyncHTTPClient will become an implementation detail.

594
00:45:53,836 --> 00:45:56,966
On Wasm, it will be fetch, but that will become an implementation detail.

595
00:45:56,966 --> 00:45:59,157
So everything should go through these new APIs.

596
00:45:59,157 --> 00:46:01,506
So I highly recommend people check those out.

597
00:46:01,506 --> 00:46:05,042
because it's likely what they will be using in a year or so.

598
00:46:05,758 --> 00:46:06,329
Wow.

599
00:46:06,329 --> 00:46:07,570
Okay, cool.

600
00:46:07,591 --> 00:46:08,751
Very cool.

601
00:46:08,872 --> 00:46:10,914
Tim, thank you so much.

602
00:46:11,066 --> 00:46:13,759
I look forward to seeing you again in Berlin.

603
00:46:14,180 --> 00:46:16,002
where can people find you online?

604
00:46:16,430 --> 00:46:17,881
Yeah, thanks for having me.

605
00:46:17,881 --> 00:46:29,451
So people can find me online as 0xTim on Bluesky, 0xTim on Mastodon under the Hachyderm
server, or you can find me at timc.dev with links to everything there.

606
00:46:29,992 --> 00:46:30,552
Awesome.

607
00:46:30,552 --> 00:46:31,813
Thank you again.

608
00:46:31,813 --> 00:46:35,334
People can find me on Twitter at leogdion.

609
00:46:35,334 --> 00:46:37,635
BrightDigit.com is my website.

610
00:46:37,635 --> 00:46:38,876
Take a look there.

611
00:46:38,876 --> 00:46:46,238
join the Patreon if you want to get early access to episodes like this and be a subscriber
to the newsletter as well.

612
00:46:46,338 --> 00:46:48,925
thank you everybody and I will talk to you again.

613
00:46:48,925 --> 00:46:49,772
Bye.

614
00:46:50,189 --> 00:46:51,236
Thank you very much.