Swift HTTP server using the pre-fork worker model



Build Status

Curassow is a Swift Nest HTTP Server. It uses the pre-fork worker model and it's similar to Python's Gunicorn and Ruby's Unicorn.

It exposes a Nest-compatible interface for your application, allowing you to use Curassow with any Nest compatible web frameworks of your choice.


Full documentation can be found on the Curassow website: https://curassow.fuller.li


To use Curassow, you will need to install it via the Swift Package Manager, you can add it to the list of dependencies in your Package.swift:

import PackageDescription

let package = Package(
  name: "HelloWorld",
  dependencies: [
    .Package(url: "https://github.com/kylef/Curassow.git", majorVersion: 0, minor: 6),

Afterwards you can place your web application implementation in Sources and add the runner inside main.swift which exposes a command line tool to run your web application:

import Curassow
import Inquiline

serve { request in
  return Response(.ok, contentType: "text/plain", body: "Hello World")

Then build and run your application:

$ swift build --configuration release

Example Application

You can find a hello world example application that uses Curassow.


Curassow is licensed under the BSD license. See LICENSE for more info.

  • Curassow issues on Cloud Foundry

    Curassow issues on Cloud Foundry

    I had to downgrade to tag 0.2 for the app. to work on Cloud Foundry.

    The Hello World app (pinned to swift 2.2 but don't think that matters) is at


    and the Curassow tag 0.2 (for convenience) is at


    Am I missing something or is it a bug in master branch?

    opened by ragsns 12
  • Performance benchmark

    Performance benchmark

    Here is a simple benchmark result with wrk on my iMac 5K. Just Hello World. Compiled with swift build --configuration release. 4 workers.

    ~ wrk -c 1k -t 10 --timeout 5s --latency
    Running 10s test @
      10 threads and 1000 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency     1.24ms    1.02ms  10.22ms   88.24%
        Req/Sec   557.81      1.17k    6.55k    94.44%
      Latency Distribution
         50%    1.16ms
         75%    1.50ms
         90%    1.96ms
         99%    5.96ms
      3818 requests in 10.10s, 371.77KB read
      Socket errors: connect 757, read 375, write 0, timeout 0
      Non-2xx or 3xx responses: 620
    Requests/sec:    377.98
    Transfer/sec:     36.80KB

    About half of the responses are [worker] Failed to decode data from client.

    opened by lexrus 10
  • Workers timeout when accessing request body

    Workers timeout when accessing request body

    When a request is received, something seems to be sticking when accessing the body's data. It's been reproducible on 0.5.0 100% for me.

    Swift Version: DEVELOPMENT-SNAPSHOT-2016-03-01-a

    Platform: osx

    Minimum Reproducible Example

    serve { req in
        var mutable = req
        print("Body: \(mutable.body?.next())") // will never get past this line
        return Inquiline.Response(.Ok, contentType: "text/html", content: "Did Stuff")

    Let me know if I'm doing something wrong here, everything else works, it only fails when I try to use next()

    opened by loganwright 9
  • Recommended debugging techniques

    Recommended debugging techniques

    I was wondering how you approach debugging Curassow (with lldb), since it forks off worker processes at the beginning and lldb doesn't support automatic following of forks.

    I found a very tedious way:

    • run your server in terminal window 1
    • in another window launch lldb for your binary
    • run attach WORKER_PID, which is visible when the server starts
    • continue as usual in the lldb instance, allowing to inspect the incoming requests in the debugger

    This will obviously get untenable as a codebase grows, so I'm wondering what your thoughts on this are.

    opened by czechboy0 6
  • Parse HTTP message body

    Parse HTTP message body

    I was trying to put together a slightly less trivial demo app and realized that there was no logic yet for reading in body data. This is a first pass at implementing that behavior. It only tries to read the body if the Content-Length header is present and doesn't try to deal with Transfer-Encoding at all, but this seems to be sufficient for the basic case that I'm looking for right now.

    opened by briancroom 5
  • Handling binary data

    Handling binary data

    If the body must be represented as a string (Nest spec), how would one respond with binary data? e.g. image/gif? I find myself wanting a more general representation like [UInt8], or even more general, something that can express itself as a sequence (streamable).

    For instance, Ruby's Rack just wants a body that responds to .each.

    opened by danneu 4
  • Update README.md

    Update README.md

    Not 100% sure how the Swift PM works just yet, but if you specify minor: 1, it won't download the latest release (e.g., 0.2.3). I'm assuming minor: 1 limits us to just 0.1.x.

    Came across this issue while trying to install Currasow for the first time via the Swift PM. Everything linked properly when I changed the minor version to 2.

    opened by ArtSabintsev 4
  • Package Manager with

    Package Manager with "12-18-b" Snapshot release of Swift fails to build Curassow


    I've had success building a small example app with the 12-01 Swift snapshot release, but the new 12-18 snapshot release appears to break building Curassow. I'm targeting the 0.2 release of Curassow in my package file, and it's the only dependency I directly declare. Below is the results of running swift build.

    I tracked this down to the SPM throwing an error in https://github.com/apple/swift-package-manager/blob/master/Sources/dep/Manifest+configureTargets.swift#L51 but I can't immediately see why this happens.

    $ swift build
    Cloning Packages/Curassow
    Using version 0.2.0 of package Curassow
    Cloning Packages/Nest
    Using version 0.2.1 of package Nest
    Cloning Packages/Inquiline
    Using version 0.2.2 of package Inquiline
    Cloning Packages/Commander
    Using version 0.4.0 of package Commander
    Compiling Swift Module 'Nest' (1 sources)
    Linking Library:  .build/debug/Nest.a
    Compiling Swift Module 'Inquiline' (3 sources)
    Linking Library:  .build/debug/Inquiline.a
    Compiling Swift Module 'Commander' (8 sources)
    Linking Library:  .build/debug/Commander.a
    swift-build: Your source structure is not supported due to conflicting directories: /path/to/project/Packages/Curassow-0.2.0

    Other data:

    OS: Ubuntu 14.04 (so I'm using the -b snapshot build)

    $ uname -a
    Linux ubuntu 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    $ swift --version
    Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 0ddf238ad7)
    Target: x86_64-unknown-linux-gnu
    opened by stupergenius 4
  • Increased visibility of Arbiter.stop()

    Increased visibility of Arbiter.stop()

    We need public access to Arbiter.stop() in order to properly integrate as a server driver for Vapor as per https://github.com/qutheory/vapor-curassow-server/pull/1.

    opened by shnhrrsn 3
  • Simplify your Makefile

    Simplify your Makefile

    SPEC_FILES=$(foreach spec,$(SPECS),Tests/$(spec)Spec.swift)
    // add these
    LIB_FILES=$(shell ls .build/debug/*.a)
    STATIC_LIBS=$(foreach lib,$(LIB_FILES),-Xlinker $(lib))
    // modify your run-tests
        @$(SWIFTC) -o run-tests \
            Tests/main.swift \
            $(SPEC_FILES) \
            -I.build/debug \
    opened by ssoper 3
  • Prevent crashing due to SIGPIPE

    Prevent crashing due to SIGPIPE

    By default, calling send on a socket which has been closed on the remote end causes SIGPIPE to be sent to the process, which terminates it. These changes change the behavior to disable the signal, and instead make send return an error code if the socket has been closed.

    This situation arises frequently when deploying to Cloud Foundry, as its healthcheck process opens a connection to the app and then closes without sending any data.

    opened by briancroom 3
  • 0.6.1(Apr 7, 2017)

  • 0.5.0(Mar 5, 2016)

  • 0.4.1(Mar 5, 2016)


    • The WEB_CONCURRENCY environment variable can be used to configure the amount of workers.
    • The PORT environment variable can be used to configure the default listening port.
    • You can now daemonize Curassow via the --daemon option.
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Feb 12, 2016)

  • 0.3.0(Jan 24, 2016)

  • 0.2.3(Jan 2, 2016)

  • 0.2.2(Dec 24, 2015)

  • 0.2.1(Dec 24, 2015)

  • 0.2.0(Dec 16, 2015)

    • Bodies of HTTP requests are now parsed and available to Nest callbacks.
    Bug Fixes
    • Fixes a crash in a worker if a client disconnects before we send a response to them.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Dec 11, 2015)

    • Curassow now parses request headers and exposes them in the request.
    Bug Fixes
    • Fixes a problem where some requests would fail to be decoded.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Dec 6, 2015)

    • Improved logger format which shows PID and time of event.
    Bug Fixes
    • Restores Linux compatibility, it was accidentally broken in the previous release by introducing OS X support.
    • Fixes a potential crash when Curassow failed to bind to a port.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.1(Dec 6, 2015)

    • Adds support for OS X.

    • Allow dynamically changing the worker count using the TTIN and TTOU signals.
      To increase the worker count by one, where $PID is the PID of the master process.

      $ kill -TTIN $PID

      To decrease the worker count by one:

      $ kill -TTOU $PID
    Bug Fixes
    • Resolves a problem where some HTTP requests we're not getting passed.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Dec 6, 2015)

Kyle Fuller Archive
Older / Less maintained projects
Kyle Fuller Archive
💧 A server-side Swift HTTP web framework.

Vapor is an HTTP web framework for Swift. It provides a beautifully expressive and easy-to-use foundation for your next website, API, or cloud project

Vapor 22.4k Jan 3, 2023
libuv base Swift web HTTP server framework

Notice Trevi now open a Trevi Community. Yoseob/Trevi project split up into respective Trevi, lime, middlewares and sys packages at our community. If

leeyoseob 46 Jan 29, 2022
A Swift web framework and HTTP server.

A Swift Web Framework and HTTP Server Summary Kitura is a web framework and web server that is created for web services written in Swift. For more inf

Kitura 7.6k Dec 27, 2022
Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux

Embassy Super lightweight async HTTP server in pure Swift. Please read: Embedded web server for iOS UI testing. See also: Our lightweight web framewor

Envoy 540 Dec 15, 2022
Tiny http server engine written in Swift programming language.

What is Swifter? Tiny http server engine written in Swift programming language. Branches * stable - lands on CocoaPods and others. Supports the latest

null 3.6k Jan 5, 2023
A small, lightweight, embeddable HTTP server for Mac OS X or iOS applications

CocoaHTTPServer CocoaHTTPServer is a small, lightweight, embeddable HTTP server for Mac OS X or iOS applications. Sometimes developers need an embedde

Robbie Hanson 5.5k Jan 7, 2023
GCDWebServer is a modern and lightweight GCD based HTTP 1.1 server designed to be embedded in iOS, macOS & tvOS apps.

GCDWebServer is a modern and lightweight GCD based HTTP 1.1 server designed to be embedded in iOS, macOS & tvOS apps. It was written from scr

Pierre-Olivier Latour 6.3k Dec 27, 2022
PillowTalk - An iOS & SwiftUI server monitor tool for linux based machines using remote proc file system with script execution.

An iOS & SwiftUI server monitor tool for linux based machines using remote proc file system with script execution.

Lakr Aream 416 Dec 16, 2022
HTTP Implementation for Swift on Linux and Mac OS X

Swift HTTP Server Simple HTTP implementation for Swift using POSIX socket API. Running on Mac OS X and Linux. For Mac users: You can install new Swift

Huy 451 Jul 28, 2022
A lightweight library for writing HTTP web servers with Swift

Taylor Disclaimer: Not actively working on it anymore. You can check out some alternatives Swift 2.0 required. Working with Xcode 7.1. Disclaimer: It

Jorge Izquierdo 925 Nov 17, 2022
Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and more…)

Perfect: Server-Side Swift 简体中文 Perfect: Server-Side Swift Perfect is a complete and powerful toolbox, framework, and application server for Linux, iO

PerfectlySoft Inc. 13.9k Dec 29, 2022
Swift Express is a simple, yet unopinionated web application server written in Swift

Documentation <h5 align="right"><a href="http://demo.swiftexpress.io/">Live ?? server running Demo <img src="https://cdn0.iconfinder.com/data/icons/

Crossroad Labs 850 Dec 2, 2022
Swift backend / server framework (Pure Swift, Supports Linux)

NetworkObjects NetworkObjects is a #PureSwift backend. This framework compiles for OS X, iOS and Linux and serves as the foundation for building power

Alsey Coleman Miller 258 Oct 6, 2022
Simple server APIs in Swift

Simple server APIs in Swift

null 4 Apr 25, 2022
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.

Why Zewo? • Support • Community • Contributing Zewo Zewo is a lightweight library for web applications in Swift. What sets Zewo apart? Zewo is not a w

Zewo 1.9k Dec 22, 2022
High Performance (nearly)100% Swift Web server supporting dynamic content.

Dynamo - Dynamic Swift Web Server Starting this project the intention was to code the simplest possible Web Server entirely in Swift. Unfortunately I

John Holdsworth 68 Jul 25, 2022
Reliable Server Side Swift ✭ Make Apache great again!

mod_swift mod_swift is a technology demo which shows how to write native modules for the Apache Web Server in the Swift 3 programming language. The de

The ApacheExpress Alliance 174 Oct 22, 2022
A light-weight server-side service framework written in the Swift programming language.

Smoke Framework The Smoke Framework is a light-weight server-side service framework written in Swift and using SwiftNIO for its networking layer by de

Amazon 1.4k Dec 22, 2022
iOS Tweak to redirect Discord API calls to a Fosscord server.

FosscordTweak iOS Tweak to redirect Discord API calls to a Fosscord server. Installation Manual Download .deb file from release and install on jailbro

null 8 May 16, 2022