{"id":18654318,"url":"https://github.com/sepisoad/robot-challange","last_synced_at":"2025-11-05T16:30:36.913Z","repository":{"id":151230112,"uuid":"507242589","full_name":"sepisoad/robot-challange","owner":"sepisoad","description":"robot-challange","archived":false,"fork":false,"pushed_at":"2022-06-25T07:41:58.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-27T14:12:46.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sepisoad.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":"2022-06-25T07:19:32.000Z","updated_at":"2022-06-25T07:44:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d71a429-bccb-4923-88bc-670abb5b1268","html_url":"https://github.com/sepisoad/robot-challange","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepisoad%2Frobot-challange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepisoad%2Frobot-challange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepisoad%2Frobot-challange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sepisoad%2Frobot-challange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sepisoad","download_url":"https://codeload.github.com/sepisoad/robot-challange/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239467426,"owners_count":19643604,"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":"2024-11-07T07:14:38.164Z","updated_at":"2025-11-05T16:30:36.854Z","avatar_url":"https://github.com/sepisoad.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Robot Warehouse\n\n## introduction\n\nThis project consists of the following sub-projects:\n- **api**\n- **simulator**\n- **web**\n\nAlso API definition is based on OpenAPI specification and the definition yaml file is located under **api-definition** directory. The SDK interface is implemented in **simulator** sub-project. \n\nCommunication between **api** and **simulator** happens asynchronously via message queue. It is built this way to demonstrate that remote robots are not always connected to the cloud and I would like to reduce the impact of that on customer experience. \n\nIt is using an event driven architecture to decouple the direct communication between customer and robots, hence allowing the robots to process the created tasks in an asynchronous way.  I have used  [NATS](https://nats.io/) message queue to achieve this.\n\n\n## API-First approach\n\nAn API-first approach means that for any given development project, your APIs are treated as “first-class citizens.” That everything about a project revolves around the idea that the end product will be consumed by mobile devices, and that APIs will be consumed by client applications. \n\nI have used OpenAPI to define the contract between **web** and the **api-server**. I used [oapi-codegen](https://github.com/deepmap/oapi-codegen) to generate golang code for server interface and the models as well as validating the data structure coming through the API.\n\n## code generation\nI heavily rely on code generation in order to avoid mistakes. code generation is used to generate\nserver interface, models and mocked contracts to be used by our tests.\n\nall the generated codes are already commited but you can regenerate them by running the following\ncommand:\n\n```bash\nmake generate\n```\n\nnote that you need to have installed these binaries on your system in order for code generation\nto work:\n\n[oapi-codegen](https://github.com/deepmap/oapi-codegen)\n[mock-gen](https://github.com/golang/mock)\n\n## architecture\n\n```mermaid\ngraph LR\nW(WEB)-- REST --\u003e A\nA -- Websocker --\u003eW\nA -- REST --\u003eW\nA(API-SERVER) -- events --\u003e B((NATS))\nB -- events --\u003e A\nB -- events --\u003e C(WAREHOUSE/SIMULATOR)\nC -- events --\u003e B\n```\nAs can be seen in the diagram above, **api** and **simulator** are completely decoupled from each other and you can safely manipulate them separately as long as the contracts remains the same.\n\nit is beyond the scope of this technical test but [AsyncAPI](https://www.asyncapi.com/)   contract can be used to define the contracts between **api** and **simulator**\n\n## how to start the project\n\nyou can run the whole project by running:\n```bash\ndocker-compose up --build -d\n```\nneedless to say that you need to have docker and docker compose on your system.\n\n## web \nthere is also a little web dashboard that shows the grid and robots in a simple graphical way, you can interact with robots by selecting them and sending movement commands to the selected robot.\n\nafter starting the whole system using docker-compose, you can access the web by opening  [http://localhost:8080](http://localhost:8080) \n\n![screenshot](screenshot.png)\n\nnote that the web uses a hard-coded port to access websockets on **api**, so if you change the docker-compose configuration and change the ports for **api**, web would not be accessible anymore, but the rest of the system would work as expected\n\n## unit test\nto run unit tests execute the following command, this will look for all unit tests and will execute them.\n```bash\nmake test\n```\n\n## integration test\nI've implemented one simple integration test to demonstrate how a given component can be tested including all its external dependencies such as messaging system and/or api. to run the integration test run the following command:\n\n```bash\nsimulator-integration-tests/run.sh\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsepisoad%2Frobot-challange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsepisoad%2Frobot-challange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsepisoad%2Frobot-challange/lists"}