Skip to content
GitHub leaderboard for your organisation or repo (Serverless SPA)
Branch: master
Clone or download
alexellis Update local testing instructions
Signed-off-by: Alex Ellis <>
Latest commit 0efb9ef Mar 14, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
github-sub Update local testing instructions Mar 14, 2019
leaderboard-page Changed default number of rows to 50. Feb 14, 2019
leaderboard Add comments to both Go functions Feb 14, 2019
.DEREK.yml Create .DEREK.yml Feb 14, 2019
.gitignore Create Feb 14, 2019
LICENSE Update local testing instructions Mar 14, 2019
stack.yml Update local testing instructions Mar 14, 2019

leaderboard-app - a serverless application


This application is an example of how to write a Single Page App (SPA) with a Serverless approach. It provides a live leaderboard for your GitHub organisation or repos showing comments made and issues opened by your community and contributors.

  • The front-end is written with Vue.js
  • The backing data-store data is Postgres with a remote DBaaS or in-cluster deployment

See a live example tracking the openfaas/openfaas-incubator organizations:

To test out the functionality comment on this issue: Issue: Let's test the leaderboard!

Here's a preview of the app when the dark theme is enabled:

Dark Leaderboard example

Subscribe to events by adding a webhook to the github-sub function:



  • github-sub

Receives webhooks from GitHub via an organization or repo subscription. Secured with HMAC by Alex Ellis

  • leaderboard

Retrieves the current leaderboard in JSON by Alex Ellis

  • leaderboard-page

Renders the leaderboard itself as a Vue.js app by Ken Fukuyama


Running locally

  • Deploy OpenFaaS

The quickest/easiest option is to use Swarm.

  • Grab custom templates
faas-cli template store pull node8-express
faas-cli template store pull golang-middlware
  • Create the required secrets
export PASS=""
export USER=""
export HOST=""
export WEBHOOK="secret"   # As set on the webhook page on GitHub

# Kubernetes
faas-cli secret create leaderboard-app-secrets-password
  --from-literal=password="$PASS" \
  --from-literal=username="$USER" \
  --from-literal=host="$HOST" \

# Swarm

faas-cli secret create password --from-literal="$PASS"
faas-cli secret create username --from-literal="$USER"
faas-cli secret create host --from-literal="$HOST"
faas-cli secret create webhook-secret --from-literal="${WEBHOOK}"

# Then apply each secret to the required function in local.yml
  • Rename the stack.yml to local.yml

Edit local.yml and rename the functions:

leaderboard => alexellis-leaderboard
github-sub => alexellis-github-sub
leaderboard-page => alexellis-leaderboard-page

Then add a prefix for each function's Docker image name and run faas-cli build -f local.yml

  • Deploy of-router:


Deploy a fake auth function:

faas-cli store deploy figlet

Deploy the router:

docker service rm of-router

docker service create --network=func_functions \
 --env upstream_url=http://gateway:8080 \
 --env auth_url=http://figlet:8080 \
 --publish 8081:8080 \
 --name of-router \
 -d openfaas/cloud-router:$TAG
  • Create entries in: /etc/hosts
  • Initialize Postgres

Provision Postgres 10 and set up your initial table schema and function:

docker run-ti postgres:10 pql ${CONNECTION_STRING}

Copy/paste from schema-1.0.sql

  • Test the JSON function:

  • Test the Vue.js page:

Contributing & license

Please feel free to fork and star this repo and use it as a template for your own applications. The license is MIT.

To contribute see

You can’t perform that action at this time.