{"id":19490565,"url":"https://github.com/simonrenoult/pokemon-kata","last_synced_at":"2026-04-15T23:33:26.851Z","repository":{"id":141882014,"uuid":"133928665","full_name":"simonrenoult/pokemon-kata","owner":"simonrenoult","description":"🐼 Kata to practice your code design skills","archived":false,"fork":false,"pushed_at":"2018-05-18T08:52:55.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T19:43:21.489Z","etag":null,"topics":["api","clean-architecture","kata","nodejs","pokemon","software-craftsmanship"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/simonrenoult.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-05-18T08:50:21.000Z","updated_at":"2019-03-01T09:32:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2c3f731-5a2b-42c7-ae06-566a0b74f6d0","html_url":"https://github.com/simonrenoult/pokemon-kata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simonrenoult/pokemon-kata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrenoult%2Fpokemon-kata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrenoult%2Fpokemon-kata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrenoult%2Fpokemon-kata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrenoult%2Fpokemon-kata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonrenoult","download_url":"https://codeload.github.com/simonrenoult/pokemon-kata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrenoult%2Fpokemon-kata/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31865068,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api","clean-architecture","kata","nodejs","pokemon","software-craftsmanship"],"created_at":"2024-11-10T21:13:34.170Z","updated_at":"2026-04-15T23:33:26.834Z","avatar_url":"https://github.com/simonrenoult.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clean Architecture kata: the Pokemon case\n\n\u003e Kata to practice your code design skills.\n\n\n## Kata\n\nRefactor the code in `src/server.js` using the Clean Architecture pattern. Make sure the tests remain green. TDD is a must!\n\n\n## Description\n\nThis code decides who would win in a fight between two pokemons. It offers a single endpoint `GET /fight-prediction` and takes two query parameters: `pokemonAId` and `pokemonBId`. The endpoint returns the id of the pokemon supposed to win.\n\n\n## Context\n\nThe Clean Architecture allows developpers to organize their code in concentric layers where the **business rules** (called **Entities** or **Domains**) live at the core of applications and do not depend on anything else but themselves.\n\nThese rules are orchestrated through controllers (called **Use-cases**) which represent sets of application-specific business rules. Once defined, the **Use-cases** are used by **Adapters** and exposed to the outside world: UI, REST APIs, etc.\n\nMore details here: [The Clean Architecture](1).\n\n\n## Commands\n\nStart the application:\n```sh\n$ npm start\n```\n\nStart the application in watch mode:\n```sh\n$ npm run watch\n```\n\nRun the tests:\n```sh\n$ npm test\n```\n\nRun the tests in watch mode:\n```sh\n$ npm run test:watch\n```\n\n\n## Hints\n\nNeed help to get started? No worries! Here are a few tips:\n\n* Start by extracting the business rules, namely the code comparing pokemon weights and returning the fattest as the winner. You can create a dedicated file called `src/domain.js` with a function `getFattest` which takes two pokemons and return... the fattest! Now use this function in `src/server.js`.\n\n* Extract the code responsible of querying `pokeapi.co` in `src/repository.js` with a function called `findPokemon` that takes an ID and return a pokemon object. Use this function in `src/server.js`.\n\n* Extract the two previous parts in `src/use-case.js` (without the routing part) in a function named `makePrediction` that takes two IDs, retrieve the pokemons associated using the `repository` and use the `domain` to make a prediction. It returns the most likely winner. Use this function in `src/server.js`.\n\n\n## License\n\nSee `License.txt`.\n\n[1]: https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonrenoult%2Fpokemon-kata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonrenoult%2Fpokemon-kata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonrenoult%2Fpokemon-kata/lists"}