{"id":15272390,"url":"https://github.com/tribalwarshelp/api","last_synced_at":"2025-10-06T14:31:51.415Z","repository":{"id":42570396,"uuid":"268782145","full_name":"tribalwarshelp/api","owner":"tribalwarshelp","description":null,"archived":true,"fork":false,"pushed_at":"2022-04-13T03:01:23.000Z","size":721,"stargazers_count":5,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-01T09:05:24.768Z","etag":null,"topics":["gin","golang","gqlgen","graphql","postgresql","tribal-wars"],"latest_commit_sha":null,"homepage":"https://gitea.dwysokinski.me/twhelp/corev3","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/tribalwarshelp.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":"2020-06-02T11:26:40.000Z","updated_at":"2024-03-31T10:57:07.000Z","dependencies_parsed_at":"2022-09-21T21:02:40.167Z","dependency_job_id":null,"html_url":"https://github.com/tribalwarshelp/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/tribalwarshelp%2Fapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tribalwarshelp%2Fapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tribalwarshelp%2Fapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tribalwarshelp%2Fapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tribalwarshelp","download_url":"https://codeload.github.com/tribalwarshelp/api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235531112,"owners_count":19004901,"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":["gin","golang","gqlgen","graphql","postgresql","tribal-wars"],"created_at":"2024-09-30T09:05:50.391Z","updated_at":"2025-10-06T14:31:46.064Z","avatar_url":"https://github.com/tribalwarshelp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# api.tribalwarshelp.com\n\nA GraphQL API designed for developers who want to create something meaningful for the game [Tribal Wars](https://tribalwars.net).\n\n## Limits\n\nIt is possible to fetch in one GraphQL query:\n\n1. 1000 daily player/tribe stats records\n2. 200 ennoblements\n3. 30 versions\n4. 200 players/tribes\n5. 1000 villages\n6. 100 player/tribe history records\n7. 100 servers\n8. 60 server stats records\n9. 100 tribe changes\n\n## Sample queries\n\n1. Fetch all bonus villages with 10% more population\n\n```graphql\nquery {\n    villages(server: \"en115\", filter: { playerID: [0], bonus: 4 }) {\n        total\n        items {\n            id\n            name\n            x\n            y\n            points\n        }\n    }\n}\n\n```\n\n2. Top 30 players without a tribe, ordered by points.\n\n```graphql\nquery {\n    players(\n        server: \"pl148\"\n        filter: { tribeID: [0] }\n        sort: [\"points DESC\"]\n        limit: 30\n    ) {\n        total\n        items {\n            id\n            name\n            rank\n            points\n            totalVillages\n            rankAtt\n            rankDef\n            rankTotal\n            rankSup\n        }\n    }\n}\n\n```\n\n3. Search a player by a nickname fragment.\n\n```graphql\nquery {\n    players(server: \"pl148\", filter: { nameIEQ: \"%pablo%\" }) {\n        total\n        items {\n            id\n            name\n        }\n    }\n}\n```\n\nMore examples [here](https://github.com/tribalwarshelp/scripts).\n\n## Map generator\n\nYou can generate a server map with this API. The current endpoint is http(s)://youraddress/map/server (replace \"server\"\nwith the server you're interested in, for example, pl151).\n\n### Available query params:\n\n| Param                                            | Default                                                    |\n| ------------------------------------------------ | ---------------------------------------------------------- |\n| showBarbarians                                   | false                                                      |\n| largerMarkers                                    | false                                                      |\n| markersOnly                                      | false                                                      |\n| centerX                                          | 500                                                        |\n| centerY                                          | 500                                                        |\n| scale                                            | 1 (max 5)                                                  |\n| showGrid                                         | false                                                      |\n| showContinentNumbers                             | false                                                      |\n| backgroundColor                                  | #000                                                       |\n| gridLineColor                                    | #fff                                                       |\n| continentNumberColor                             | #fff                                                       |\n| tribe(this param you can define multiple times)  | format: tribeid,hexcolor (for example, tribe=631,#0000ff)   |\n| player(this param you can define multiple times) | format: playerid,hexcolor (for example, player=631,#0000ff) |\n\n### Example\n\n**pl151**\n```\nhttps://api.tribalwarshelp.com/map/pl151?showBarbarian=true\u0026tribe=124,%230000ff\u0026tribe=631,%230000ff\u0026tribe=1675,%230000ff\u0026onlyMarkers=false\u0026scale=1\u0026showGrid=true\u0026showContinentNumbers=true\n```\n![Map](https://api.tribalwarshelp.com/map/pl151?showBarbarian=true\u0026tribe=124,%230000ff\u0026tribe=631,%230000ff\u0026tribe=1675,%230000ff\u0026onlyMarkers=false\u0026scale=1\u0026showGrid=true\u0026showContinentNumbers=true)\n\n## Development\n\n### Prerequisites\n\n1. Golang\n2. PostgreSQL database\n3. Configured [cron](https://github.com/tribalwarshelp/cron)\n\n### Installation\n\n**Required ENV variables:**\n\n```\nDB_USER=your_pgdb_user\nDB_NAME=your_pgdb_name\nDB_PORT=your_pgdb_port\nDB_HOST=your_pgdb_host\nDB_PASSWORD=your_pgdb_password\nLIMIT_WHITELIST=127.0.0.1,::1\nLOG_DB_QUERIES=true\nDISABLE_ACCESS_LOG=false\n```\n\n1. Clone this repo - ``git clone git@github.com:tribalwarshelp/api.git``\n2. Open the folder with this project in a terminal.\n3. Set the required env variables directly in your system or create .env.local file.\n4. Run the app - ``go run ./cmd/api/main.go``\n\n## License\n\nDistributed under the MIT License. See ``LICENSE`` for more information.\n\n## Contact\n\nDawid Wysokiński - [contact@dwysokinski.me](mailto:contact@dwysokinski.me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftribalwarshelp%2Fapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftribalwarshelp%2Fapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftribalwarshelp%2Fapi/lists"}