5 ms·
I tried out Swift + Vapor back in 2017 when I was still a Mac user and a Swift enthusiast. I remember that at the time, I had quite a positive experience with V
by vkoskiv 3y ago
I tried out Swift + Vapor back in 2017 when I was still a Mac user and a Swift enthusiast. I remember that at the time, I had quite a positive experience with Vapor 2 on Swift 3. I built a backend websocket server[1] for a hobby project[2], and managed to get it mostly working even though I was quite inexperienced in general.
The pain came later. They eventually deprecated Vapor 2, and I found that the new version of Vapor required essentially a complete rewrite, using some kind of async paradigm I couldn't quite grok.
I kept using the program I wrote for longer than I anticipated, and more pain came when I could no longer figure out how to set up the toolchain needed to even build the thing. Eventually the only way to build and run it was to use an old Ubuntu 16.04 installation.
This experience left me with a distaste for modern tooling with lots of churn, so last year I decided to rewrite the thing in C with minimal dependencies, so it's guaranteed to compile with minimal modifications even in 30 years time. Really happy with the result[3]. I added new features, optimized the websocket messaging with binary messages and zlib compression, and generally made it way faster than needed.
It compiles in less than a second vs. the minutes it took to build the Vapor version, and the resulting binary is 324K with debug symbols, 144K when stripped + -Os, and 68K when UPX-compressed.
It also uses a local SQLite db instead of a separate MySQL server, which makes deployment quite trivial (git clone && make run). The web client is still built with React, I've been thinking of rebuilding it with a single .html file and minimal JavaScript.
[1] https://github.com/vkoskiv/NoMansCanvas https://github.com/vkoskiv/NoMansCanvas
[2] https://pixel.vkoskiv.com https://pixel.vkoskiv.com
[3] https://github.com/vkoskiv/nmc2 https://github.com/vkoskiv/nmc2
- cco 3y agoSo funny that this came up today! I just had a developer reach out to me about whether we had a backend Swift SDK at my current company (stytch.com), or if we'd seen anybody else use us with Vapor. Googled around to get some more context on Vapor's history and sure enough, found this thread from today. Sounds like I should point him away from Vapor in your opinion?
- favorited 3y agoI'm not the person you asked, but Vapor hasn't had a major version change since 2020 (Vapor 4). Vapor 5 is at least another year out, probably more like 2 or 3. Vapor 5 is definitely going to be a breaking change, but that's not a bad thing. The current major version predates async/await, actors, Sendable, macros, move-only types, variadic generics, and lots of other language features. It's been able to adopt some in incremental releases, but it wasn't designed with those things in mind.
- vkoskiv 3y agoI don't have a valid opinion on the current state of Vapor - 2017 was a long time ago, and the people developing it have worked very hard to improve it in that time.
- wredue 3y agoI’m honestly surprised you got this far with swift 3 on Linux, as swift 2, 3, and 4 on Linux were all bug ridden messes. You couldn’t reasonably compile between minor versions, let alone major ones, and expect your same lines of code to have consistent behavior.