{"id":20314862,"url":"https://github.com/windvalley/traffic-clones-api","last_synced_at":"2026-07-03T19:33:43.034Z","repository":{"id":163372285,"uuid":"438536614","full_name":"windvalley/traffic-clones-api","owner":"windvalley","description":"An apiserver for https://shields.io/endpoint. Get the total number of clones and the total number of unique clones of your github repo.","archived":false,"fork":false,"pushed_at":"2021-12-19T08:52:24.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-29T11:03:01.256Z","etag":null,"topics":["badge","clones-badge","shields","shieldsio-endpoint"],"latest_commit_sha":null,"homepage":"","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/windvalley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-12-15T07:33:15.000Z","updated_at":"2025-01-07T13:23:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8085652-5d3c-4cc8-b397-ba3b473ae89f","html_url":"https://github.com/windvalley/traffic-clones-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/windvalley/traffic-clones-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Ftraffic-clones-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Ftraffic-clones-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Ftraffic-clones-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Ftraffic-clones-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windvalley","download_url":"https://codeload.github.com/windvalley/traffic-clones-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Ftraffic-clones-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35099547,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["badge","clones-badge","shields","shieldsio-endpoint"],"created_at":"2024-11-14T18:16:59.537Z","updated_at":"2026-07-03T19:33:43.017Z","avatar_url":"https://github.com/windvalley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# traffic-clones-api\n\n[![Traffic Clones Total](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi.sre.im%2Fv1%2Fgithub%2Ftraffic%2Fclones%2Ftotal%3Fgit_user%3Dwindvalley%26git_repo%3Dtraffic-clones-api%26type%3Dcount%26label%3Dclones-total)](https://github.com/windvalley/traffic-clones-api)\n[![Traffic Clones Uniques](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi.sre.im%2Fv1%2Fgithub%2Ftraffic%2Fclones%2Ftotal%3Fgit_user%3Dwindvalley%26git_repo%3Dtraffic-clones-api%26type%3Duniques%26label%3Dclones-uniques)](https://github.com/windvalley/traffic-clones-api)\n\nAn apiserver for \u003chttps://shields.io/endpoint\u003e.\nGet the total number of clones and the total number of unique clones of your github repo.\n\n## Description\n\nProvides:\n\n- traffic clones total count api:\n\n  `/v1/github/traffic/clones/total?git_user=\u0026git_repo=\u0026type=count\u0026label=clones-total`\n\n- traffic clones total uniques api:\n\n  `/v1/github/traffic/clones/total?git_user=\u0026git_repo=\u0026type=uniques\u0026label=clones-uniques`\n\n## Deployment Server\n\nLogin your cloud server(like aws EC2) first.\n\n#### 1. Generate a github personal access token\n\nAccess this page \u003chttps://github.com/settings/tokens\u003e,\nand press button `Generate new token` to generate your access token.\n\nFor example, the generated access token is `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`.\n\n#### 2. Deploy backend api server `traffic-clones-api`\n\n```sh\n$ git clone --depth 1 https://github.com/windvalley/traffic-clones-api\n\n$ cd traffic-clones-api\n\n$ go build\n\n# it will listening on :9000 port\n$ nohup ./traffic-clones-api -t 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 \u0026\n```\n\n#### 3. Deploy https proxy server by [Caddy](https://github.com/caddyserver/caddy)\n\nAssume that your domain name `api.sre.im` has been resolved to your cloud server IP.\n\n```sh\n$ wget https://github.com/caddyserver/caddy/releases/download/v2.4.6/caddy_2.4.6_linux_amd64.tar.gz\n\n$ tar zxf caddy_2.4.6_linux_amd64.tar.gz\n\n$ mv ./caddy /usr/local/bin/\n\n$ mkdir api.sre.im\n\n$ cd api.sre.im\n\n$ cat \u003e Caddyfile \u003c\u003cEOF\n{\n    http_port 80\n    https_port 443\n}\n\napi.sre.im  {\n    reverse_proxy 127.0.0.1:9000\n\n    log {\n        output file logs/access.log\n        format single_field common_log\n    }\n}\nEOF\n\n$ nohup caddy run \u0026\n```\n\n#### 4. Test the deployment\n\nRequest the url `https://api.sre.im/v1/github/traffic/clones/total?git_user=your-github-username\u0026git_repo=your-github-repo\u0026type=count-or-uniques\u0026label=clones-xxx`\n\nThe response should be:\n\n```json\n{\n  \"schemaVersion\": 1,\n  \"label\": \"clones-xxx\",\n  \"message\": \"1728\",\n  \"color\": \"orange\"\n}\n```\n\n## Create the badge\n\n#### 1. Open \u003chttps://shields.io/endpoint\u003e in browser explorer\n\n#### 2. Generate the final badge url\n\nAdd the url `https://api.sre.im/v1/github/traffic/clones/total?git_user=your-github-username\u0026git_repo=your-github-repo\u0026type=count-or-uniques\u0026label=clones-xxx` in `url` blank.\n\nThen click `Copy Badge URL` to copy it to system clipboard.\n\nFinally, add your badge link `![traffic clones total](the content of system clipboard)` to the `README.md` of your github repo.\n\nThe badge will be shown as:\n\n[![Traffic Clones Total](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi.sre.im%2Fv1%2Fgithub%2Ftraffic%2Fclones%2Ftotal%3Fgit_user%3Dwindvalley%26git_repo%3Dtraffic-clones-api%26type%3Dcount%26label%3Dclones-total)](https://github.com/windvalley/traffic-clones-api)\n\n## License\n\nThis project is under the MIT License.\nSee the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Ftraffic-clones-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindvalley%2Ftraffic-clones-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Ftraffic-clones-api/lists"}