Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


A sample app running Swift + Kitura on Google App Engine's Flexible Environment.

Setup Instructions

Before you begin

Follow the first three instructions on the GAE Flex Quickstart to create a GCP Project, install the GCloud SDK, and initialize your environment.

Running Kitura-Flex

Running Swift and Kitura on GAE Flex is as easy as:

git clone
cd kitura-flex
gcloud app deploy
gcloud app browse

Advanced Usage

Modifying Source

App code is available in Sources/ and contains main.swift and Controller.swift. main.swift is the application entry point. It initializes the controller, and starts the app server. Controller.swift contains all the routes, including the GAE specific routes. New routes can be added here, or in additional files and called from here.

An area for future improvement would be to package the GAE routes as middleware similar to how Cloud Foundry is implemented in the original sample.


Logs are output to Google Cloud Logging in two phases:

  1. Container Builder > $build_id
  2. GAE Application > $service_name > $version

The first set of logs are useful for debugging the container build and deployment, while the second are used for monitoring the app in production. Any log statements from your Kitura app will be forwarded to Cloud Logging.

Continue reading the docs for more info on application logging.

Lifecycle management

Per Building GAE Flex Custom Runtimes your application should handle certain lifecycle events, such as start, stop , and health events.

// Respond to GAE Health checks (mandatory)
router.all("/_ah/health", handler: health)

// Respond to GAE start, stop requests (optional)
router.all("/_ah/start", handler: start)
router.all("/_ah/stop", handler: stop)

Continue reading the docs for more info on lifecycle events.

Tweak app.yaml

app.yaml currently has the bare minimum required for a GAE Flex app, but can be configured to do far more than run an app. You can use app.yaml to specify resource allocation, configure health checks, and tune autoscaling params.

Continue reading the docs for more info on app.yaml.


Sample app running Swift + Kitura on GAE Flex







No releases published


No packages published