[Pitch] Vapor

Hello everyone,

We'd like to pitch the main Vapor package to the SSWG incubation process. Vapor is one of the oldest and biggest server-side Swift frameworks used by many companies big and small.

Motivation

Server-side Swift frameworks provide the tools to allow developers to write backends, APIs and server-applications in Swift without application developers needing to know all of the internals of interacting with the kernal, parsing HTTP packets, managing routing, handling request and response bodies or even interacting with SwiftNIO. This allows developers to focus on their business logic.

Proposed Solution

Vapor has been around since 2016, with Vapor 4 being the current version for the last 4 years. It's evolved over the years and currently supports async/await and compiles with no warnings with strict concurrency checking in Swift 5.9 (a few warnings in 5.10 which will be fixed very soon).

Vapor supports parameter based routing and route handlers as closures (or functions):

app.get("hello", "vapor") { req in 
    return "Hello, vapor!"
}

Dynamic path parameters are also supported:

app.get("hello", ":name") { req -> String in
    let name = req.parameters.get("name")!
    return "Hello, \(name)!"
}

Vapor also supports Codable based types for request and response bodies:

struct Greeting: Content {
    var hello: String
}

app.post("greeting") { req in 
    let greeting = try req.content.decode(Greeting.self)
    print(greeting.hello) // "world"
    return HTTPStatus.ok
}

This could then handle the following request:

POST /greeting HTTP/1.1
content-type: application/json
content-length: 18

{"hello": "world"}

Vapor also supports middleware, authentication, websockets, validation, external HTTP requests, testing, and many more features. See Vapor's documentation for the full features and documentation and our API docs.

34 Likes

This would be awesome since it's literally my goto for any serious server work on swift and has been for a few years now.

I even went through the exercise of porting over a legacy rails app that was already hooked up to a production Postgres rds instance, to vapor, and swapping it out and having vapor run the show worked without a hitch.

2 Likes

Obvious good candidate and thumbs up for doing a review and including :+1:

Along wiht the other web frameworks like hummingbird and others it makes sense to include the stable frameworks along vetted "libraries" in the sswg package collection.

3 Likes

I'm surprised a pitch is being posted just now :sweat_smile:
Would agree it's an obvious candidate! :+1:

For a while we didn't think to include frameworks, for no real reason actually, so we're collectively going to be pitching a bunch :)

2 Likes

Assuming the pitch is for Vapor 4 and it gets accepted, I'm curious how major version updates are handled.
When Vapor 5 releases, is that a new pitch process or is it covered by this one?

1 Like

Packages in the incubation process are not dependant on version so it covers the current version and future versions. We run a package review every 6 months or so, so if there are issues with new versions or it no longer meets the requirements for that level then the workgroup can remove it or move it down a level etc

3 Likes