Around The Table: example project using Kitura and Stencil

I've recently open sourced and documented a project I've been working on for the past year and a half: GitHub - svanimpe/around-the-table: An open source platform that supports tabletop gaming communities, written in Swift.

It demonstrates the following:

  • Kitura:
    • Basic routing.
    • Structured routing using subrouters and extensions.
    • Type-safe form parsing using Codable forms.
    • Type-safe rendering using Codable view models.
    • Using the Session middleware to store credentials and preferences.
    • Using the Credentials middleware.
    • Authentication using Facebook Web Login.
    • Authentication using an email address and password.
  • Stencil:
    • Creating and rendering Stencil templates.
    • Template inheritance using {% extends %} .
    • Template composition using {% include %} .
    • Creating custom Stencil filters.
  • Persistence:
    • Implementing a persistence layer using MongoDB and MongoKitten.
  • Configuration:
    • Using JSON files to configure settings.
    • Using environment variables to configure settings and secrets.
    • Using the Configuration package to load settings and cloud services.
  • Testing:
    • Unit testing with XCTest.
    • End-to-end testing with SwiftyRequest.
    • Testing on Linux using Docker.
  • Other:
    • Deploying to IBM Cloud.
    • Caching images in Cloud Object Storage.
    • Calling external APIs using SwiftyRequest.
    • Parsing XML using Foundation.
    • Basic internationalisation using localized strings and templates.

This is a server-side web app (not a REST API with a web front-end) as I wanted to show that server-side Swift can do more than build back-ends for mobile apps. There's over 8000 lines of Swift for you to study, pick apart and critique.

The code is BSD-licensed. I'm hoping it will help you kickstart your own (open or closed sourced) projects.

If you're interested in contributing: please get in touch! This has all been unpaid volunteer work, so all help is welcome in implementing the remaining features and speeding up development. We still need to add a REST API, mobile apps, an admin dashboard and some serverless stuff, so whatever your expertise, there should be something you can contribute :slight_smile:

Enjoy!

7 Likes