Build your websites in Swift!

Swift is a fantastic language, and now that enthusiasm can spill over into the website domain!

Swiftfire was created with the goal to be able to create websites that are (sever side) completely written with Swift.

To allow this exiting feature it was necessary to reinvent the server and extend it with features that allow Swift code to inject HTML, CSS and/or Javascript into an outgoing webpage.

The result of this effort is a webserver we call Swiftfire.

Out of the box, Swiftfire is a fully functional webserver that can deliver static & PHP-based websites to clients.

However, Swiftfire uses two methods that allow the insertion of dynamic features into a static website by user written Swift code.

First off, there are ‘Services’. Every domain is implemented as a stack of ‘services’. Once an HTTP request is received for a domain, its services are executed one after the other. Until finally a response is created which is then send back to the client. The static server is in fact a stack of default services that is assigned to each new domain. And of course you can create your own services.

Secondly, there are ‘Functions’. The service that will return a page to the client can scan that page first for occurrences of functions. If a function is found, it will execute that function and replace the function with the code that the function generated. The function itself is a Swift function that must have been registered during startup.

An example: “This page has been returned .functioncall() times”. If I replace the name ‘functioncall’ with the actual name of the function ‘nofPageHits’ the following happens: “This page has been returned .nofPageHits() times”.

If you are looking at this page on then you will see a number between ‘returned’ and ‘times’. If however you are using port 80 ( then you will see the function call itself. Why is that?, because on our server at port 80 the standard Apache webserver is running, while at port 6678 the Swiftfire webserver is running. And Swiftfire will replace the functioncall with the result from the function.

Of course Swiftfire also offers support for multiple domains, HTTPS, sessions, accounts, blacklisting etc etc.

Open Source

All code is open source. You are encouraged to download the source code from github and customize the Swift code as necessary for your own website/project. Up until version 1.0 is released this will be the only way to install Swiftfire. From v1.0 on, there will be builds that can be downloaded from the AppStore for convenience or non-programmers.


Before you get going please read the readme page to get familiar with some basic terminology and the general design of Swiftfire.


The Swiftfire project is split into smaller projects, most of which are usable on their own:

  • BRUtils: Mostly type extensions used throughout the project.
  • Ascii: Ascii character definitions.
  • BRBON: An in-memory storage manager.
  • KeyedCache: A general purpose dictionary like cache.
  • SwifterLog: A general purpose logging utility.
  • VJson: A JSON code interpreter/generator.
  • SwifterSockets: A collection of networking utilities at the POSIX level.
  • SecureSockets: A collection of networking utilities that implement SSL.
  • Http: An API for HTTP messages.
  • Html: Some definitions & functions that make creating HTML code easier.
  • Swiftfire: The webserver.

All of these are open source and can be found on github.