Swiftpack.co - hummingbird-project/hummingbird as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Lightweight, flexible HTTP server framework written in Swift
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "0.14.0")


Lightweight, flexible server framework written in Swift.

Hummingbird consists of three main components, the core HTTP server, a minimal web application framework and the extension modules.


HummingbirdCore contains a Swift NIO based HTTP server. You will find the code for it in the hummingbird-core repository. The HTTP server is initialized with a object conforming to protocol HBHTTPResponder which defines how your server responds to an HTTP request. The HTTP server can be extended to support TLS and HTTP2 via the HummingbirdTLS and HummingbirdHTTP2 libraries also available in the hummingbird-core repository.

HummingbirdCore can be used separately from Hummingbird if you want to write your own web application framework.


Hummingbird is a lightweight and flexible web application framework that runs on top of HummingbirdCore. It is designed to require the minimum number of dependencies: swift-backtrace, swift-log, swift-nio, swift-nio-extras, swift-service-lifecycle and swift-metrics and makes no use of Foundation.

It provides a router for directing different endpoints to their handlers, middleware for processing requests before they reach your handlers and processing the responses returned, support for adding channel handlers to extend the HTTP server, extending the core HBApplication, HBRequest and HBResponse classes and providing custom encoding/decoding of Codable objects.

The interface is fairly standard. Anyone who has had experience of Vapor, Express.js etc will recognise most of the APIs. Simple setup is as follows

import Hummingbird

let app = HBApplication(configuration: .init(address: .hostname("", port: 8080)))
app.router.get("hello") { request -> String in
    return "Hello"
try app.start()

Hummingbird Extensions

Hummingbird is designed to require the least number of dependencies possible, but this means many features are unavailable to the core libraries. Additional features are provided through extensions. The Hummingbird repository comes with a HummingbirdFoundation library that contains a number of features that can only really be implemented with the help of Foundation. This include JSON encoding/decoding, URLEncodedForms, static file serving, and cookies.

Extensions provided in other repositories include

Extension Description
HummingbirdAuth Authentication framework and various support libraries
HummingbirdCompress Request decompression and response compression (uses CompressNIO)
HummingbirdFluent Interface to the Vapor database ORM (uses FluentKit)
HummingbirdRedis Interface to Redis (uses RediStack)
HummingbirdWebSocket Adds support for WebSocket upgrade to server
HummingbirdMustache Mustache templating engine
HummingbirdLambda Run hummmingbird inside an AWS Lambda


You can find reference documentation and user guides for Hummingbird here. The hummingbird-examples repository has a number of examples of different uses of the library.


Stars: 170
Last commit: 4 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

4 days ago

Minor version changes

  • Add new HummingbirdJobs library that allows you to offload work to another server. PR #104

Patch version changes

  • Apply application log level to lifecycle
  • Only patch responses on routes flagged .editResponse in async-await code

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics