I came across Vapor the other day and wondered if it were an "official" Swift.org project. I guess it's not, but it uses SwiftNIO, which is? In any case, a little more googling turned up perfect.org, and I'm wondering if anyone has thoughts on which framework is "better" or "easier" to use for building a webapp with both JSON REST APIs and some kind of simple HTML templating engine.
@JetForMe Definitely try out all the frameworks before settling on one.
Since you're interested in HTML templating, you should also compare Leaf (Vapor's templating language) with Stencil (everyone else's templating language). They accomplish the same, but with a very different syntax.
Perfect
I really enjoyed working with Perfect and deployed a simple server side app to production. I used their Perfect Assistant (PA) Mac App to help me deploy the application to an AWS EC2 instance. I followed a Ray Wenderlich video tutorial and everything worked perfectly. (Server-Side Swift with Perfect, Episode 1: Getting Started | raywenderlich.com). Upon deploying updates to AWS using PA I encountered issues and had to talk to the team on slack to resolve some Swift Package Manager (SPM) versioning issues with regards to Perfect, PA updates and what versions of swift the PA Mac App was writing to compile the application using SPM via PA vs version Xcode and SPM were using. (The PA Mac App would attempt to create a SPM package using a user interface.) Docker some times had issues with the latest image vs the PA Mac App image complier.
After all the back and fourth I decided I didn’t have time to handle the AWS Dev Ops set up along with the Perfect Assistant issues. I wanted to build a server side swift project and deploy it easily, after all the coding was done. That is when I looked into Vapor and saw they offered Vapor Cloud (https://vapor.cloud). Don’t get me wrong I loved Perfect as a server side swift framework. It was simple to use very explicit in what was returned from responses and made a lot of sense as a iOS swift developer. This was back in late 2017 so things may have changed. It is a great framework and highly recommend checking it out.
Kitura
Great that it works on IBM Cloud Platforms. Easy to understand. Had a big issue with the response times of IBM support (was almost a month and a half and the issue was not responded to), attempting to use Watson with some server side swift. Seemed ok. It was not better than Perfect though.
Vapor
Vapor seems to handle issues straight out of the box. Error responses were handled amazingly, Codable was a game changer and there were sufficient docs and community support for many issues. I do recommend Vapor as the winner.
Again Perfect was used a while ago (a year and a bit ago, an eternity in tech), it was great but Vapor seemed ahead of the game.
This benchmark might help you choose! They are all computed on DigitalOcean
Personally I prefer Kitura due to syntax. Second is Vapor due to my love to version 2. I don't like v3. that much. Perfect seems to be best in terms of result. However I do hate that syntax.
There's perfect-nio but I haven't play with it yet.
Language (Runtime) Framework (Middleware) Average 50th percentile 90th percentile 99th percentile 99.9th percentile Standard deviation
swift (4.2) perfect (3.1) 22.11 ms 21.81 ms 26.35 ms 33.46 ms 56.41 ms 3607.00
swift (5.0) vapor (3.3) 65.25 ms 27.59 ms 49.31 ms 1354.51 ms 3496.16 ms 228498.67
swift (5.0) kitura (2.6) 35.61 ms 33.10 ms 48.56 ms 74.07 ms 647.15 ms 26 433.67
swift (5.0) kitura (2.7) 62.88 ms 61.14 ms 83.65 ms 115.44 ms 533.98 ms 21219.00
swift (5.0) kitura-nio (2.7) 177.09 ms 65.25 ms 115.28 ms 3343.02 ms 6831.05 ms 555543.00
Language (Runtime) Framework (Middleware) Requests / s Throughput
swift (4.2) perfect (3.1) 44599.00 41.93 MB
swift (5.0) vapor (3.3) 32438.67 54.37 MB
swift (5.0) kitura (2.6) 28 626.67 53.09 MB
swift (5.0) kitura (2.7) 15597.00 29.04 MB
swift (5.0) kitura-nio (2.7) 13049.00 24.67 MB
Kitura used to be supported by IBM, but stopped doing so a couple of years ago. The website seems pretty stale. Last blog post in 2021. Latest GitHub release a year ago.