{"id":27323358,"url":"https://github.com/ninjainshade/clash-armies","last_synced_at":"2025-04-12T10:47:31.601Z","repository":{"id":233099390,"uuid":"755543449","full_name":"NinjaInShade/clash-armies","owner":"NinjaInShade","description":"A website where users can view, create, copy and learn clash of clans armies/attack strategies.","archived":false,"fork":false,"pushed_at":"2024-04-13T12:51:35.000Z","size":63480,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-13T21:11:11.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Svelte","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/NinjaInShade.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}},"created_at":"2024-02-10T14:36:21.000Z","updated_at":"2024-04-20T13:24:16.753Z","dependencies_parsed_at":"2024-04-20T13:34:21.829Z","dependency_job_id":null,"html_url":"https://github.com/NinjaInShade/clash-armies","commit_stats":null,"previous_names":["ninjainshade/clash-armies"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NinjaInShade%2Fclash-armies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NinjaInShade%2Fclash-armies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NinjaInShade%2Fclash-armies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NinjaInShade%2Fclash-armies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NinjaInShade","download_url":"https://codeload.github.com/NinjaInShade/clash-armies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557882,"owners_count":21124165,"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":[],"created_at":"2025-04-12T10:47:26.901Z","updated_at":"2025-04-12T10:47:31.595Z","avatar_url":"https://github.com/NinjaInShade.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nClash Armies is a website where users can find, create, share and learn clash of clans armies.\n\nJoin the [discord server](https://discord.gg/9wCmfXhZM6) to keep up to date with discussions, sneak peaks and releases!\n\n# Run locally\n\nIf you need extra help, or have suggestions on improving the dev workflow, give me a message on discord/github.\n\n## Prerequisites\n\n- `npm` \u003e= 10.5.0\n- `node` \u003e= 21.0.0\n- `docker` \u003e= 20.10.24\n- `docker compose` \u003e= 2.20.3\n\n## Running app\n\nClone the repo and go into:\n\n```bash\ngit clone https://github.com/NinjaInShade/clash-armies.git\ncd clash-armies\n```\n\nThe first setup step before being able to run the app and have it function is to create a google oAuth project and generate a client id and secret which are needed for the login to work. This is totally free. These are the steps:\n\n- Go to the [Google API dashboard](https://console.cloud.google.com/apis/dashboard)\n- Go to `credentials` and create an oAuth client id/secret. In the setup wizard add `http://localhost:5173` as an authorized javascript origin, and `http://localhost:5173/login/google/callback` as an authorized redirect URI.\n- Go to `oAuth consent screen` and customize the oAuth consent screen to your liking\n\nNext thing you will need to do is create a `.env` file at the root of the project with the following vars:\n\n- DB_PORT\n- DB_ROOT_PASSWORD\n- DB_USER\n- DB_PASSWORD\n- BASE_APP_URL (set this to `http://localhost:5173`)\n- GOOGLE_AUTH_CLIENT_ID (use the google client id from before)\n- GOOGLE_AUTH_SECRET (use the google secret from before)\n\nOnce all that is done, install the dependencies:\n\n```bash\nnpm i\n```\n\nAnd run the app:\n\n```bash\nnpm start\n```\n\nYou should now have the app running locally on port 5173!\n\n# Contributing\n\nI appreciate any contributions, I find it really cool people can help make the project better for everyone.\n\nIf you wish to contribute, give me a shout on discord/github and we can discuss the idea/fix you want to do (or I can help with ideas).\n\n# Useful documentation/reading\n\nDuring the making of this I had to find resources myself so for anyone making a similar tool, or even anything to do with clash of clans, these may be useful.\n\n## Army links\n\nFound on the [Clash API Developers discord](https://discord.gg/clashapi) FAQs. For internal troop/spell ID's see [Static data](./README.md#static-data)\n\n\u003e Army Link URLs enable sharing of army compositions externally from the Clash of Clans game client. Other players can then use the link to import the army composition to one of their army slots in game. These URLs can be generated programmatically if you know the troop and spell IDs.\n\u003e\n\u003e Example of a simple army link breakdown:\n\u003e\n\u003e https://link.clashofclans.com/en?action=CopyArmy\u0026army=u10x0-2x3s1x9-3x2\n\u003e\n\u003e First are troops, (prefixed with the \"u\" character):\u003cbr /\u003e\n\u003e First item is 10 troops with id 0, which are Barbarians.\u003cbr /\u003e\n\u003e Next item is 2 troops with id 3, which are Giants.\u003cbr /\u003e\n\u003e\n\u003e Then come the spells (starting with the s character):\u003cbr /\u003e\n\u003e First is 1 spell with id 9, which is a Poison Spell.\u003cbr /\u003e\n\u003e Second is 3 spells with id 2, which is a Rage Spell.\u003cbr /\u003e\n\u003e\n\u003e The army= query string value can be parsed with regex into two groups (troops and spells):\n\u003e\n\u003e u([\\d+x-]+)s([\\d+x-]+)\n\n## Static data\n\nTo achieve this I needed the metadata for things such as troops, spools etc. I realized early on this wasn't going to be feasible, maintainable and prone to error if I tried to manually enter data myself from wikis etc. Also some of the properties like internal troop IDs aren't easy to find.\n\nI found some resources from [Clash API Developers discord](https://discord.gg/clashapi) FAQs:\n\n## Sanitised JSON Files\n\n\u003e Provided by @Magic?! | ClashKing (docs)\n\u003e\n\u003e https://api.clashking.xyz/json/troops \u003cbr/\u003e \u003e https://api.clashking.xyz/json/spells \u003cbr/\u003e \u003e https://api.clashking.xyz/json/heroes \u003cbr/\u003e \u003e https://api.clashking.xyz/json/buildings \u003cbr/\u003e \u003e https://api.clashking.xyz/json/pets \u003cbr/\u003e \u003e https://api.clashking.xyz/json/supers \u003cbr/\u003e \u003e https://api.clashking.xyz/json/translations \u003cbr/\u003e\n\u003e\n\u003e https://api.clashking.xyz/assets (Zip File of Game Assets) \u003cbr/\u003e \u003e https://api.clashking.xyz/csv (Zip File of all Game CSV's) \u003cbr/\u003e\n\n### Raw JSON Conversions\n\n\u003e Provided by @spAnser\n\u003e\n\u003e Root URL path: https://coc.guide/static/json/\n\u003e\n\u003e Followed by:\n\u003e\n\u003e capital_buildings.json\u003cbr /\u003e\n\u003e capital_characters.json\u003cbr /\u003e\n\u003e capital_obstacles.json\u003cbr /\u003e\n\u003e capital_projectiles.json\u003cbr /\u003e\n\u003e capital_spells.json\u003cbr /\u003e\n\u003e capital_traps.json\u003cbr /\u003e\n\u003e characters.json\u003cbr /\u003e\n\u003e client_globals.json\u003cbr /\u003e\n\u003e globals.json\u003cbr /\u003e\n\u003e heroes.json\u003cbr /\u003e\n\u003e languages.json\u003cbr /\u003e\n\u003e object_ids.json\u003cbr /\u003e\n\u003e obstacles.json\u003cbr /\u003e\n\u003e pass_tasks.json\u003cbr /\u003e\n\u003e pets.json\u003cbr /\u003e\n\u003e projectiles.json\u003cbr /\u003e\n\u003e replay.json\u003cbr /\u003e\n\u003e spells.json\u003cbr /\u003e\n\u003e supers.json\u003cbr /\u003e\n\u003e tasks.json\u003cbr /\u003e\n\u003e townhall_levels.json\u003cbr /\u003e\n\u003e traps.json\u003cbr /\u003e\n\u003e upgrade_tasks.json\u003cbr /\u003e\n\u003e weapons.json\u003cbr /\u003e\n\u003e\n\u003e Localisation:\n\u003e\n\u003e lang/texts_AR.json\u003cbr /\u003e\n\u003e lang/texts_CN.json\u003cbr /\u003e\n\u003e lang/texts_CNT.json\u003cbr /\u003e\n\u003e lang/texts_DE.json\u003cbr /\u003e\n\u003e lang/texts_EN.json\u003cbr /\u003e\n\u003e lang/texts_ES.json\u003cbr /\u003e\n\u003e lang/texts_FA.json\u003cbr /\u003e\n\u003e lang/texts_FI.json\u003cbr /\u003e\n\u003e lang/texts_FR.json\u003cbr /\u003e\n\u003e lang/texts_ID.json\u003cbr /\u003e\n\u003e lang/texts_IT.json\u003cbr /\u003e\n\u003e lang/texts_JP.json\u003cbr /\u003e\n\u003e lang/texts_KR.json\u003cbr /\u003e\n\u003e lang/texts_MS.json\u003cbr /\u003e\n\u003e lang/texts_NL.json\u003cbr /\u003e\n\u003e lang/texts_NO.json\u003cbr /\u003e\n\u003e lang/texts_PT.json\u003cbr /\u003e\n\u003e lang/texts_RU.json\u003cbr /\u003e\n\u003e lang/texts_TH.json\u003cbr /\u003e\n\u003e lang/texts_VI.json\u003cbr /\u003e\n\u003e lang/texts_TR.json\u003cbr /\u003e\n\n## Official API considerations\n\nThis refers to the [Official API](https://developer.clashofclans.com/#/).\n\n**Response caching**\n\nFound on the [Clash API Developers discord](https://discord.gg/clashapi) FAQs:\n\n\u003e Each API response from the Clash of Clans API is cached for a certain amount of time. This means that the response will not change until the cache timer has expired, therefore there isn't any benefit from repeating the request again until this time. The cache timer varies by API endpoint:\n\u003e\n\u003e Clan - 120 seconds (2 minutes)\u003cbr /\u003e\n\u003e Current War (Classic) - 120 seconds (2 minutes)\u003cbr /\u003e\n\u003e Other War (CWL) - 600 seconds (10 minutes)\u003cbr /\u003e\n\u003e Player - 60 seconds (1 minute)\u003cbr /\u003e\n\u003e\n\u003e When making an API request, you can check the response headers for a cache-control header and the value of this is the number of seconds until the cache expires.\n\n**Rate limit**\n\nFound on the [Clash API Developers discord](https://discord.gg/clashapi) FAQs:\n\n\u003e Each API Token for the Clash of Clans API is to rate limitations. There isn't an official rate limit figure provided, however we have tested 30-40 requests per second without issues.\n\u003e\n\u003e If you exceed the rate limit, the API will respond with a 429 error and you will be temporarily unable to make API requests with that token (it can last 1 hour).\n\n**IP restrictions**\n\nFound on the [Clash API Developers discord](https://discord.gg/clashapi) FAQs:\n\n\u003e Each API Tokens for the Clash of Clans API is restricted to specific IP addresses (IPv4). This can cause issues when attempting to access it from a connection with a dynamic IP address. There are a couple workarounds:\n\u003e\n\u003e 1. Use a library with dynamic IP address support\n\u003e\n\u003e A number of the community created API libraries have the ability to create and use a new API token each time your IP address changes. This happens seamlessly with each request, so enable you to make API requests without needing to manually create a new API Token each time your IP changes.\n\u003e\n\u003e 2. Use an API proxy\n\u003e\n\u003e Making your API requests via a proxy will mean that the API will \"see\" the requests as coming from the IP address of the proxy service. If you create your token using the IP address of the proxy service and then make your API calls via that service, you will be able to make API requests from any IP address.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninjainshade%2Fclash-armies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fninjainshade%2Fclash-armies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninjainshade%2Fclash-armies/lists"}