{"id":16171949,"url":"https://github.com/smoya/ghtop","last_synced_at":"2025-03-19T00:30:41.118Z","repository":{"id":144880505,"uuid":"103337379","full_name":"smoya/ghtop","owner":"smoya","description":"A simple Golang http service that lists the top Github contributors given a location.","archived":false,"fork":false,"pushed_at":"2017-09-14T13:26:55.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T13:18:34.638Z","etag":null,"topics":["github-api","golang","httpserver"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smoya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"asyncapi","patreon":null,"open_collective":"asyncapi","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-09-13T01:17:44.000Z","updated_at":"2023-12-05T15:52:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"891f1ace-f785-4df9-8e96-9a6b8fe854ef","html_url":"https://github.com/smoya/ghtop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoya%2Fghtop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoya%2Fghtop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoya%2Fghtop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smoya%2Fghtop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smoya","download_url":"https://codeload.github.com/smoya/ghtop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955755,"owners_count":20374373,"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":["github-api","golang","httpserver"],"created_at":"2024-10-10T03:44:26.203Z","updated_at":"2025-03-19T00:30:41.113Z","avatar_url":"https://github.com/smoya.png","language":"Go","funding_links":["https://github.com/sponsors/asyncapi","https://opencollective.com/asyncapi"],"categories":[],"sub_categories":[],"readme":"# ghtop\n[![Build Status](https://travis-ci.org/smoya/ghtop.svg?branch=master)](https://travis-ci.org/smoya/ghtop)\n\nA simple Golang http service that lists the top Github contributors given a location.\n\nFeatures included:\n\n* Top contributors by a given location.\n* Cached results with a given TTL.\n* Number of results customizable (Max 150).\n* Sort by the amount of **repositories**, **followers** or by the **date they joined**. \n\n## Installation\n\n### From docker:\n\nThere is a Docker image called `smoya/ghtop`. In order to run the service, just do:\n\n```bash\ndocker run --publish 8080:8080 smoya/ghtop:latest -gh-token=\u003cgithub token\u003e\n```\n\n### From source\n\nGhtop requires Go 1.9 or later.\n```bash\ngo get -u github.com/smoya/ghtop\n```\n\n## Usage\n\nRun the server:\n\n```bash\nghtop -gh-token=\u003cgithub token\u003e -ttl=\u003cttl in seconds\u003e\n```\n\nThe `GET /top` endpoint should be now mounted.\n\nCurl [http://localhost:8080/top?location=barcelona](http://localhost:8080/top?location=barcelona) in order to see the top dev contributors in Barcelona area.\nReplace `barcelona` with whatever location you want to look at. \n\n```bash\ncurl 'http://localhost:8080/top?location=barcelona'\n```\n\n## Authentication\n\nIf authentication is required, the application is ready for use Basic HTTP authentication [rfc2617](https://tools.ietf.org/html/rfc2617).\nIn further versions [JWT](https://jwt.io) could be implemented.\n\nIn order to prompt the authentication dialog on the `/top` endpoint, you must specify the user and password when running the service.\n\n### Arguments reference:\n\n| name           | type   | description                                                                             | required | default |\n|----------------|--------|-----------------------------------------------------------------------------------------|----------|---------|\n| -port          | int    | Server's listening port                                                                 | no       | 8080    |\n| -env           | string | Sets the environment. Just for logging.                                                 | no       | prod    |\n| -gh-token      | string | Github personal access token.  Create yours from https://github.com/settings/tokens/new | yes      |         |\n| -ttl           | int    | The ttl in seconds for the repository cache.                                            | no       | 300     |\n| -auth-user     | string | The username for basic Http Authentication. No Auth if empty                            | no       |         |\n| -auth-password | string | The password for basic Http Authentication.                                             | no       |         |\n\n## Tests\n\nGhtop library tests are split in two:\n\n* Unit tests\n* End To End tests (features are located in the [e2e pkg](pkg/e2e/features))\n\nRun `make tests` and `make e2e` respectively, or `make check` in order to run all of them.\n\n## Design considerations\n\n* The code allows us to easy implement a new repository for any other vcs system rather than github.\n* The limit has no fixed values but the max is 150 results (avoiding possible performance issues). I considered that adding the possibility to the user to \nlimit the amount of results in each request was better for UX.\n* The Github token is set at application level rather than by the user in each request. \nThis is a design decision since I considered this service as a simple API endpoint for a possible nice frontend application.\nHowever this could be changed handling a given Github token in each `GET /top` request.  \n\n## TODO\n\n* Repository cache can be improved by checking if the specified limit is lower or equal than the cached one and use that cache.\n* We could retrieve more data from Github like user full name, email, organizations, etc. \n* Add a multiple repository constructor in order to allow using several repositories (from different vcs) at the same time.\n* Add a proper authentication mechanism ([JWT](https://jwt.io) for example). This could be done through an in memory database + a simple http middleware.\n* Adding more tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoya%2Fghtop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmoya%2Fghtop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmoya%2Fghtop/lists"}