{"id":15641971,"url":"https://github.com/alexellis/leaderboard-app","last_synced_at":"2025-04-28T16:20:34.892Z","repository":{"id":44302377,"uuid":"170404204","full_name":"alexellis/leaderboard-app","owner":"alexellis","description":"GitHub leaderboard for your organisation or repo (Serverless SPA)","archived":false,"fork":false,"pushed_at":"2023-01-03T23:23:24.000Z","size":2592,"stargazers_count":67,"open_issues_count":15,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T11:11:35.376Z","etag":null,"topics":["kubernetes","lambda","openfaas","serverless","serverless-spa","single-page-app","vue-js"],"latest_commit_sha":null,"homepage":"https://www.openfaas.com/blog/serverless-single-page-app/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexellis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-12T22:56:32.000Z","updated_at":"2024-01-18T13:02:55.000Z","dependencies_parsed_at":"2023-02-01T13:17:19.206Z","dependency_job_id":null,"html_url":"https://github.com/alexellis/leaderboard-app","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fleaderboard-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fleaderboard-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fleaderboard-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexellis%2Fleaderboard-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexellis","download_url":"https://codeload.github.com/alexellis/leaderboard-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342721,"owners_count":21574245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","lambda","openfaas","serverless","serverless-spa","single-page-app","vue-js"],"created_at":"2024-10-03T11:53:13.311Z","updated_at":"2025-04-28T16:20:34.868Z","avatar_url":"https://github.com/alexellis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leaderboard-app - a serverless application\n\n[![OpenFaaS](https://img.shields.io/badge/openfaas-cloud-blue.svg)](https://www.openfaas.com)\n\nThis 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.\n\n* The front-end is written with Vue.js\n* The backing data-store data is Postgres with a remote DBaaS or in-cluster deployment\n\nSee a live example tracking the openfaas/openfaas-incubator organizations: [https://alexellis.o6s.io/leaderboard-page](https://alexellis.o6s.io/leaderboard-page)\n\nTo test out the functionality comment on this issue: [Issue: Let's test the leaderboard!](https://github.com/openfaas/org-tester/issues/18)\n\nHere's a preview of the app when the dark theme is enabled: \n\n![Dark Leaderboard example](docs/leaderboard-dark.png)\n\nSubscribe to events by adding a webhook to the github-sub function:\n\n![Subscribe](docs/subscribe.png)\n\n## Blog post / tutorial\n\nRead all the details here on how to build a portable Serverless Single Page App for any cloud:\n\nSee also: [Blog: How to build a Serverless Single Page App](https://www.openfaas.com/blog/serverless-single-page-app/)\n\n## Functions\n\n* github-sub\n\nReceives webhooks from GitHub via an organization or repo subscription. Secured with HMAC by Alex Ellis\n\n* leaderboard\n\nRetrieves the current leaderboard in JSON by Alex Ellis\n\n* leaderboard-page\n\nRenders the leaderboard itself as a Vue.js app by Ken Fukuyama\n\n## Schema\n\n* [schema-1.0.sql](sql/schema-1.0.sql)\n\n## Secrets\n\nYou can seal your secrets for use with OpenFaaS Cloud:\n\n```\nfaas-cli cloud seal \\\n  --name teamserverless-leaderboard-app-secrets \\\n  --literal=password=\"$PASS\" \\\n  --literal=username=\"$USER\" \\\n  --literal=host=\"$HOST\" \\\n  --literal=webhook-secret=\"${WEBHOOK}\"\n```\n\n## Running locally\n\n* Deploy OpenFaaS\n\nThe quickest/easiest option is to use Swarm.\n\n* Grab custom templates\n\n```\nfaas-cli template store pull node8-express\nfaas-cli template store pull golang-middleware\n```\n\n* Create the required secrets\n\n```\nexport PASS=\"\"\nexport USER=\"\"\nexport HOST=\"\"\nexport WEBHOOK=\"secret\"   # As set on the webhook page on GitHub\n\n# Kubernetes\nfaas-cli secret create leaderboard-app-secrets-password \\\n  --from-literal=password=\"$PASS\" \\\n  --from-literal=username=\"$USER\" \\\n  --from-literal=host=\"$HOST\" \\\n  --from-literal=webhook-secret=\"${WEBHOOK}\"\n\n# Swarm\n\nfaas-cli secret create password --from-literal=\"$PASS\"\nfaas-cli secret create username --from-literal=\"$USER\"\nfaas-cli secret create host --from-literal=\"$HOST\"\nfaas-cli secret create webhook-secret --from-literal=\"${WEBHOOK}\"\n\n# Then apply each secret to the required function in local.yml\n```\n\n* Rename the stack.yml to local.yml\n\nEdit local.yml and rename the functions:\n\n```\nleaderboard =\u003e alexellis-leaderboard\ngithub-sub =\u003e alexellis-github-sub\nleaderboard-page =\u003e alexellis-leaderboard-page\n```\n\nThen add a prefix for each function's Docker image name and run `faas-cli build -f local.yml`\n\n* Deploy `of-router`:\n\nVia: https://github.com/openfaas/openfaas-cloud/tree/master/router\n\nDeploy a fake auth function:\n\n```\nfaas-cli store deploy figlet\n```\n\nDeploy the router:\n\n```\nTAG=0.6.0\ndocker service rm of-router\n\ndocker service create --network=func_functions \\\n --env upstream_url=http://gateway:8080 \\\n --env auth_url=http://figlet:8080 \\\n --publish 8081:8080 \\\n --name of-router \\\n -d openfaas/cloud-router:$TAG\n```\n\n* Create entries in: `/etc/hosts`\n\n```\n127.0.0.1 alexellis.local-o6s.io\n```\n\n* Initialize Postgres\n\nProvision Postgres 10 and set up your initial table schema and function:\n\n```\nexport CONNECTION_STRING=\"\"\ndocker run -ti postgres:10 psql ${CONNECTION_STRING}\n```\n\nCopy/paste from [schema-1.0.sql](sql/schema-1.0.sql)\n\n* Test the JSON function:\n\nhttp://127.0.0.1:8080/function/alexellis-leaderboard\n\n* Test the Vue.js page:\n\nhttp://alexellis.local-o6s.io:8081/leaderboard-page\n\n## Contributing \u0026 license\n\nPlease feel free to fork and star this repo and use it as a template for your own applications. The license is MIT.\n\nTo contribute see [CONTRIBUTING.md](./CONTRIBUTING.md)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexellis%2Fleaderboard-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexellis%2Fleaderboard-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexellis%2Fleaderboard-app/lists"}