So I was wondering if anyone here is using Swift and or Vapor for backend development?
What are the other alternatives, Nim?
I have deployed my backend on a tiny DO droplet using Docker, and it just works. There was a slight bit of learning curve for deploying it, but I can now create images locally on my Mac and pull them remotely for a fresh deployment/migration in less than a minute. Being able to build locally using Docker for Mac also means that the speed is great.
Before that, I had the app live on a Heroku setup but it cost quite a bit.
My app is at https://apps.apple.com/nl/app/instint/id1454800508
Other alternatives would be Kotlin, C#, Go, or even Java.
We (Transeo [1]) use Swift and Vapor to power our application which serves millions of users and regularly hits 20k requests per second. We're running on substantially less hardware than we budgeted for, which is great, and the performance is also notable - our p99 response time at peak rps is ~250ms.
That being said, performance isn't the only thing that you should look for when choosing your backend language/framework, as you've noted. We've been using Swift/Vapor for more than 5 years now so we've seen the community grow alongside it, and I am really excited about where it's going. While the ecosystem at one time was a bit of challenge (in terms of finding a package to do something, etc), over the last ~2 years we have rarely run into problems finding code snippets or packages to accomplish our tasks. We do a lot of bulk CSV processing (hundreds of gb's at a time), SFTP transfers, PDF generation/merging, calculated database locking, all of which has been relatively seamless ecosystem-wise. Check out the SSWG projects [2] for some more cool stuff happening in the ecosystem.
Hiring has been fine as well - we have a number of developers on the team that did not have Swift or Vapor experience coming in and were able to map other frameworks on top of it and pick it up quickly.
All of that being said, I will admit that I am biased on this topic :) Frameworks and programming languages are merely tools in your tool-belt, and different tools are right for different workloads.
Regarding Swift I am not sure how popular it is for the backend, you might not have a lot of libs for example for doing common things. Also no idea well a Swift backend performs under load. Swift is a nice language for sure, maybe if you can risk it, go for it but keep also this in mind - https://boringtechnology.club/
If you really really need something high-performance, then Rust is the main contender. Don't be fooled by superficially similar angle brackets syntax. It's not similar to C++, it's is not even a C-family language (closer to ML). Things like having multiple string types may seem like the same mess, but it's not a legacy baggage like in C++, but an explicit meaningful choice exposing ownership and encoding semantics.
If you merely need pretty good performance, go for golang. It's very successful for services.
I don't see room for Swift in server-side languages. It won't be able to shake being Apple's technology first, and having Linux support as a second class. It's not low-level enough to beat Rust on performance. It can't compete with popularity and ease of use of JS/TS and golang.
I've been happy with it thus far, even though I should note that my usage is pretty low stakes / trivial. It has just enough of what I want of modern language conveniences that I'm not sad about using it. I certainly derive some happiness from having a zero impedance inclusion on the iOS and server side; conversely, were I to use Rust, my early reading seemed to indicate I' have to navigate a bit of FFI and library inclusion on the iOS side that I'd much prefer not to.
So, at hobbyist level, it's been fine. If I were to go purely on technical merits and language niceties I would have chosen Rust, as the depth of language features and standard library features is really really nice for me, but the fact that I can just have something that works in either of my desired platforms has made it okay to deal with a slightly less mature (IMO) ecosystem.
Also, as a note, I've done just a tiny bit of SwiftWASM with this same toolset, and it's not bad either. Pretty far behind Rust's WASM capabilities in my experience, but accomplishes what I need and is generally nice. Tokamak ( a WASM-friendly UI framework like SwiftUI ) has been nice in my initial usage as well. I'm definitely at a firm hobbyist level of using this stuff tho, no production anecdotes to give you unfortunately.
> a performant, statically-typed, systems programming language.
What is your project about? What are the latency requirements? How many concurrent users you expect to have? If these numbers are not high, why are you not using a general purpose language like go or Kotlin?
I used vapor for a evaluation project a while ago and abandoned it quickly. While Swift is a nice language, it is still a 2nd class citizen on non-Mac systems.
You can do a small PoC project and see if you like it.
Such a squandered opportunity on Apple's part. In the early years, the Swift team talked a big game about wide industry adoption goals, but multiplatform seems to just be a defeated box-ticking exercise now.
People say Apple are an unstoppable marketing machine, but they did an absolutely horrific job of engaging the wider software development community with Swift.
The community tries to expand swift's horizon with all its heart, but as long as apple is the main force behind the language there's going to be no real incentive for it to become a serious contender on other platforms.
I'd recommend go, if it's a serious project you plan to maintain for years.
You should check out Kotlin. Design-wise, it's very similar to Swift, but it has a bigger userbase on the backend and an (imo) more promising future.
Asked differently, why are Java (or a mature JVM language) or C# not a good fit?
For myself, I won't use it on the server, but that's because I write servers for relatively low-cost, limited-skill, demographics. I use PHP.
Java is the "obvious" choice for statically typed web backends. Personally I'll recommend Go and C#. Both have a low learning barrier to entry, check your boxes for backend languages, and have ample resources online. I would choose C# (on ASP.NET Core) if you want flexible typing and inheritance, and Go if you want "simple" imperative code. Rust is also popular but I don't know enough to comment on it.
If you intend to make money and or invite a team into the project over time then maybe look for something lots of people use (.Net Core, C++, TypeScript, Java, etc.)
If you want this project to be a labor of love that is mostly powered by you then pick whatever esoteric thing you want that fits the bill (again sounds like you know the options, Rust, Crystal, Nim, Server Side Swift, etc.)
Swift is a really nice language, much easier to skill up than Rust and MUCH better ergonomics, but again, IBM pulled out and the working group moves at a glacial pace...
I'd be curious to hear as well if there are any corps quietly relying on it.
Crystal (like Ruby but fast and statically typed)
D (a "better" C/C++ with GC)
Pascal (a C/C++ competitor which has fallen out of favor, but is still being developed as FreePascal)
It’s been mostly great. Only downside is the server-side swift community is smaller than others, so you don’t get the deep software library selection something like Python would have.
You can say the same for Swift. But just like with C++, you can always stick to simpler and smaller subset and make great things with it.
See Very Good Ventures own Dart Frog:
Rust 1.65 didn't add a new feature, it removed a limitation on an existing feature.
That's the direction I want my languages to be going in.
from Swift using https://www.perfect.org/
to Rust using https://github.com/http-rs/tide