{"id":20988581,"url":"https://github.com/doorbash/leaderboard-api","last_synced_at":"2025-06-25T09:32:59.364Z","repository":{"id":57545513,"uuid":"526735660","full_name":"doorbash/leaderboard-api","owner":"doorbash","description":"A simple api for game leaderboards","archived":false,"fork":false,"pushed_at":"2022-09-09T09:26:03.000Z","size":53,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-19T06:24:43.069Z","etag":null,"topics":["api","game","leaderboard","leaderboards","score","scoreboard","scores"],"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/doorbash.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}},"created_at":"2022-08-19T19:56:28.000Z","updated_at":"2023-03-27T20:07:14.000Z","dependencies_parsed_at":"2022-09-15T02:02:52.153Z","dependency_job_id":null,"html_url":"https://github.com/doorbash/leaderboard-api","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doorbash%2Fleaderboard-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doorbash%2Fleaderboard-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doorbash%2Fleaderboard-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doorbash%2Fleaderboard-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doorbash","download_url":"https://codeload.github.com/doorbash/leaderboard-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234757147,"owners_count":18881935,"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":["api","game","leaderboard","leaderboards","score","scoreboard","scores"],"created_at":"2024-11-19T06:22:03.120Z","updated_at":"2025-01-20T07:44:33.885Z","avatar_url":"https://github.com/doorbash.png","language":"Go","readme":"## Prerequisites\n- Go (only for developement)\n- Docker\n- Docker Compose\n\n## Configuration\n- Create `.env`:\n```\nAPP_VERSION=1.1.1\n\nDATABASE_ROOT_PASSWORD=\"DATABASE_ROOT_PASSWORD\"\nDATABASE_USER=\"DATABASE_USER\"\nDATABASE_PASSWORD=\"DATABASE_PASSWORD\"\nDATABASE_NAME=\"DATABASE_NAME\"\n\nPMA_URI=\"https://your.domain/pma/\"\n\nIMAGE_MYSQL=\"mysql:8.0.30\"\nIMAGE_PMA=\"phpmyadmin/phpmyadmin:5.2.0\"\nIMAGE_NGINX=\"nginx:1.23.1-alpine\"\nIMAGE_REDIS=\"redis:7.0.4-alpine3.16\"\n```\n\n## Run\n```\nstart (develoment)  : ./run.sh\nstart (production)  : ./run.sh prod\nstop                : ./run.sh stop\nclean database      : ./run.sh clean\n```\n\n## How to\n\n### Create a new Game\n1. Go to `phpMyAdmin`-\u003e`leaderboard`-\u003e`games`\n2. Click `Insert`\n3. Set `id` (lowercase, no spaces), `name` and `data` (json)\n4. Click `Go`\n\n### Create a new Leaderboard\n1. Go to `phpMyAdmin`-\u003e`leaderboard`-\u003e`leaderboards`\n2. Click `Insert`\n3. Select `gid`\n4. Set `name` (whatever you want. doesn't really matter)\n5. Set `value1_order`, `value2_order` and `value3_order` based on what you need: \u003cbr /\u003e\n\n```\n 0 :    unused\n 1 :    higher is better (ex: score, num levels,...)\n-1 :    lower is beter (ex: time)\n```\n\nThe leaderboard will be sorted later based on `value3_order` (if not zero).\n\nThe rows having equal `value3`, will be sorted based on `value2_order` (if not zero)\n\nThe rows having equal `value2`, will be sorted based on `value1_order` (if not zero)\n\n6. Set `value1_limit`, `value2_limit`, `value3_limit`\n\nAny player who exceeds these limits will get banned and also their IP address get banned for a week. (0 means no limit)\n\n### Get Game\n**GET** `https://your.domain/api/awesome-game`\n\nFirst result is from database and then for the next 20 minutes results are from cache.\n\n### Get Leaderboard\n**GET** `https://your.domain/api/leaderboards/put_leaderboard_uid_here?offset=0\u0026count=50`\n\nTo get data from cache set `offset` to 0 and `count` to 100 (or not set them)\n\nCached results are 0 ~ 20 minutes old but they are faster.\n\n### Get Leaderboard by Player UID\n**GET** `https://your.domain/api/leaderboards/put_leaderboard_uid_here/put_player_uid_here?offset=1\u0026count=3`\n\n### Set new leaderboard data\n**POST** `https://your.domain/api/leaderboards/put_leaderboard_uid_here/new`\n\n**BODY**\n```\n{\n    \"pid\": \"put_player_uid_here\",\n    \"name\": \"John\",\n    \"value1\": 400,\n    \"value2\": 3,\n    \"value3\": 1\n}\n```\n\nNot setting `pid` (player uid) means it's a new player.\nThe `pid` will be returned in the response.\n\nIf `pid` is set, `name` can be set or not. If `name` is set then it gets updated in database if it's changed.\n\nValues only get updated if they are better than what already exists in database. For example if a player has finished the game in 300 seconds before now only values less than 300 are accepted. \n\nIf there are limits set for values, any player who exceed those limits gets banned as noted before.\n\n## Postman\nhttps://documenter.getpostman.com/view/13117984/VUqpscfn\n\n## License\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoorbash%2Fleaderboard-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoorbash%2Fleaderboard-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoorbash%2Fleaderboard-api/lists"}