Kitura Sample: A Swift Server example demonstrating the features of Kitura.

By Andrew Lees

Created on 2018-10-02

We have rewritten the Kitura Sample demo application to better showcase the capabilities of Kitura. This update adds interactive webpages so you can try out the features live. You can also easily view the code for each feature by clicking on the embedded links.

Furthermore, we have added new demos for popular features such as databases, sessions and authentication. Altogether, these changes produce an example app which is a great resource for learning to develop using Kitura.

Blog pic 1

Kitura Sample demonstration of rendering dynamic webpages using Stencil

Swift Server example

Our sample server shows off the following features available in Kitura:

Running Kitura Sample

To start the Swift server example locally, follow the steps below:

  1. Open your terminal window
  2. Clone the Kitura Sample project:

    git clone
  3. Move into the Kitura-Sample directory:

    cd Kitura-Sample
  4. Run the example server and wait while the code compiles:

    swift run
  5. Open your browser at http://localhost:8080.

You should see the Kitura-Sample website being run by the server.

Blog pic 2

The landing page for Kitura-Sample displaying a Hello World example

Interacting with the app

You can access all the Kitura-Sample demos via the menu on the left hand side. The inner page will provide you with a demonstration description, any further set-up required, and the method of interacting with the server. We then encourage you to view the relevant code on Github or within your local Kitura-Sample project. This sample also includes example tests for the routes and has used Kitura-OpenAPI to auto-generate an OpenAPI (AKA Swagger) file as well as an OpenAPI user interface.

Blog pic 3

View the OpenAPI user interface at http://localhost:8080/openapi/ui

We hope you enjoy trying out our new Swift server example and it helps you to understand and use the features of Kitura. If you have any questions or comments, Please join the vibrant Kitura community on Slack!