Shape Shape point chapter-list Group Group Group Shape Copy 12 Shape Shape Copy 3 Shape Shape dropdown editor editor Combined Shape grid Shape Copy 4 Shape Copy 7 Shape language language Shape megaphone paperback Shape platform noun_419259-2 copy play-icon BS-Question-Rounded-Circle quotes noun_610406 stacked-books-1 stacked-books-2 Group Group Group Group Group

Server Side Swift with Kitura

$59.99 4.9/5 7 reviews · Write a Review
  • Platform iOS 13
  • Language Swift 5.1
  • Editor Xcode 11

Kitura gives you the power to create production-ready RESTful APIs written in Swift.

Coupled with the power of Docker and Kubernetes, and KueryORM and KituraStencil to pull it all together, Kitura lets you take your Swift to the Server and beyond!

Developer Guide


For Beginner Developers

Master server-side Swift frameworks and deployments with ease!

Kitura gives you the power to create production-ready RESTful APIs written in Swift. Coupled with the power of Docker and Kubernetes, you can take your Swift to the Server and beyond!

Server Side Swift with Kitura will walk you through the development of EmojiJournal, a social network focused on your feelings. You'll learn how REST works, how to document your API, how to set up an ORM and user authentication, and even how to create a web front-end as well as an iOS front-end! You'll also learn about how to use powerful deployment tools to manage and run your API in any popular cloud that you choose!

Who This Book Is For

This book is for any developer who has had some exposure to Swift and wants to learn how to use those skills to write code that operates on the server.

Topics Covered in Server Side Swift with Kitura

  • KueryORM: Learn how to map your Swift API to PostgreSQL, a very popular database.
  • The OpenAPI Spec: Learn how to self-document your API, and to provide a tool for rapidly testing and iterating on it.
  • Stencil: Use an open-source templating tool to create a web-app for your Swift app on the Server.
  • Authentication: Protect your Swift API from unwanted requests and learn how to apply multiple different types of protection.
  • Security: Demystify the world of TLS and learn how to secure communications to and from your server.
  • Deployment: Localhost isn't enough - push your server to production with Docker & Kubernetes.
  • ...and much, much more!

Table of Contents



You'll learn about Swift's history on the server, about the Backend for Frontend (BFF) design pattern and what you will create in EmojiJournal.


Hello, World!

Swift on the Server comes with a difference in workflow, and, in this chapter, you'll dive into the world of the Swift Package Manager and how to create your own server application from scratch.



It's a standard that's been battle-tested around the block, but it might be totally new material for some! You'll take a walk through the basics of RESTful communication, how a server manages state, as well as all of the possibilities you have in front of you when you communicate with your API.


Introduction to Codable

In Swift 4, Codable came out of the darkness and made JSON parsing a whole lot easier. You'll use an Xcode playground to step through examples of encoding and decoding native structs to and from JSON, and you'll learn more about how powerful Codable is as you work with dates and different formatting styles.


Codable Routing

Now that you understand how Codable works, you'll take Kitura's 2.0 flagship feature for a spin. You'll set up the core HTTP routes for EmojiJournal using Codable Routing, which allows you to never have to worry about parsing parameters from a request ever again.


The OpenAPI Specification

Documentation is a critical component of any project you will ever work on, and, in this chapter, you'll learn how to leverage an open-source tool that documents your entire API for you and how it works to allow you to rapidly test your API as you continue to develop it. You'll also learn how you can even generate a client-side SDK for your project, automatically!



Everything you learned about in the previous chapter, you'll put it into practice right away by adding some more routes to your EmojiJournal server. After that, you'll finally kick the tires on your iOS app and include KituraKit for communicating with your API.



Just about every server you work with in production will need a production-ready database, and Kitura has an ORM module to help you interact with it. Get ready to delete a ton of code as you simplify your API and persist your objects to PostgreSQL!



You don't want to just let anyone have access to your API, so you'll learn how to ensure that certain resources are protected. After taking a trip through all of the available authentication choices for Kitura, you'll implement one of them using Codable Routing and enforce user authentication for the important routes on your API.


Multi-User Support

In this chapter, you'll take another step towards making EmojiJournal ready for production by expanding on your work to handle multiple users. You'll update your database to take a new kind of object, and to associate your journal entries with a specific user.


KituraStencil: Getting Started

Having an iOS client for your API is great, but wouldn't it be nice to have a web client so that everyone can use your awesome app? You'll learn the basics of HTML templating with an open-source tool called Stencil and how to create a web front-end for EmojiJournal.


KituraStencil: Authentication, Adding & Deleting

Now that you've got a web client, you'll dive into making it fully functional. You'll add user management capabilities to your web UI, and you'll link up the existing UI out of the box to all of the HTTP routes that you've written for your API. By the end of this chapter, you can show off your work on EmojiJournal to all of your friends, not just the ones with blue text bubbles!


Using Other Services

So far, your server has been responding to all sorts of requests, but what if your server needs to make a request of its own? You'll implement SwiftyRequest to do just that and add a touch of good fortune to EmojiJournal.


HTTPS Certificates

Authentication isn't the only kind of security you'll need to implement. HTTP is no longer acceptable on its own, and, in this chapter, you'll learn about TLS and how to implement a certificate to secure all of the communication to and from your server.


Going Live

By now, localhost has been pulling all of the weight serving up your shiny new EmojiJournal app. Now, you'll learn how to manage a Kubernetes cluster of Docker containers that can host everything you've worked with so far. By learning how to run EmojiJournal in this setting, you can take your app anywhere!

Meet the team

Average Rating

4.9 /5

Leave a review for this product

7 reviews

Server Side Swift with Kitura

Kitura gives you the power to create production-ready RESTful APIs written in Swift.

Coupled with the power of Docker and Kubernetes, and KueryORM and KituraStencil to pull it all together, Kitura lets you take your Swift to the Server and beyond!