{"id":17002052,"url":"https://github.com/rusith/game-of-threes","last_synced_at":"2026-04-13T19:33:35.500Z","repository":{"id":235635364,"uuid":"611960651","full_name":"rusith/game-of-threes","owner":"rusith","description":"The game of threes","archived":false,"fork":false,"pushed_at":"2023-03-13T08:37:05.000Z","size":639,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T09:17:31.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/rusith.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":"2023-03-09T22:41:15.000Z","updated_at":"2023-09-24T19:50:58.000Z","dependencies_parsed_at":"2024-04-24T04:15:16.603Z","dependency_job_id":"dfa93390-3bfe-4ce1-aa5d-18795a1d541a","html_url":"https://github.com/rusith/game-of-threes","commit_stats":null,"previous_names":["rusith/game-of-threes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rusith/game-of-threes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2Fgame-of-threes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2Fgame-of-threes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2Fgame-of-threes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2Fgame-of-threes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusith","download_url":"https://codeload.github.com/rusith/game-of-threes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2Fgame-of-threes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31768638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T15:25:13.801Z","status":"ssl_error","status_checked_at":"2026-04-13T15:25:09.162Z","response_time":93,"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":[],"created_at":"2024-10-14T04:26:57.327Z","updated_at":"2026-04-13T19:33:35.479Z","avatar_url":"https://github.com/rusith.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Game of Three\n\nGame of three is a game where you start with a number and repeatedly divide it by 3, by adding -1 or +1 to it, until you reach 1.\n\n\n![](./docs/images/3.png)\n\n\n### How to run?\n\n1. Make sure you have the latest version of Docker with Docker Compose installed on your machine.\n2. Clone the repository.\n3. Run `docker-compose up` in the root directory of the project.\n4. Make sure the app and API are running.\n5. Open `http://localhost:5173` in your browser.\n\nThis will start a development server.\n\n### How does it work?\n\n- A player can create a new game by clicking on the `New Game` on the home page.\n- The player can select a game mode from the dropdown.\n- If the game mode is not automatic, the player will have to enter their name and \nclick the `Join` button.\n- If the game mode is automatic/vs computer, the player will join the game automatically.\n- The player will have to wait for the other player to join the game.\n- The player can share the link to another player or open another browser.\n- Once two players have joined the game, the game will start.\n- The first player will generate a random number.\n- Once the game started, the other player can select an addition in the case of manual mode or the app will select a number autmatically.\n- The game state will be updated in real time.\n- The game will end when one of the players reaches 1.\n- All players have 3 lives and will lose a life if they enter a number not divicible by 3.\n- The game will end when one of the players loses all their lives. and the winner will be the other player.\n\n### High-level architecture\n\n![](./docs/images/high-level.jpg)\n\n\n#### Notes\n\n- The app will connect to the API using only web-sockets.\n- Redis pub/sub will be used to send game updates to the connected players in real time.\n- A database (MongoDB) will be used to persist the game state for later use.\n- The app should be distributable through a CDN.\n- API will only keep connected sockets in memory. the API should be horizontally scalable.\n\n### App notes\n\n- The app is a single page application bulit using React.\n- Uses Socket.io to connect to the API.\n  - Zustand for state management.\n  - React Router for routing.\n  - Tailwind CSS for styling.\n  - Vite for bundling.\n- The `game` folder contains specific components and state for the game which is the main feature of the app.\n- The `shared` folder contains shared components for example, `Modal`.\n\n### API notes\n\n- The API is a a Node.JS application.\n- Uses Socket.io to create the API.\n  - Dotenv for configuration.\n  - Vite for bundling.\n  - Jest for testing.\n  - Mongoose for database connection.\n  - Redis for pub/sub.\n  - Inversify for dependency injection.\n- The `game` module is the main module of the app.\n  - `game.controller.ts` is the controller which binds the incoming socket connections with the game service.\n  - `game.service.ts` is the service which contains the logic of the game.\n  - `game.repository.ts` provides the interface to the database.\n  - `game.pubsub.ts` provides the interface to the pub/sub.\n- All dependencies are injected using the `inversify` library.\n- DB Models are defined in the `models` folder.\n- The `helpers` folder contains specific helper classes for example, `MongoDBHelper`.\n- All components are decoupled by implementing the interfaces defined in the `index.ts` file of respective modules.\n\n### CI/CD\n\n- The app and the API will be tested and linted for every push using Github Actions.\n- The workflow is defined in the `.github/workflows` folder.\n\n### Possible AWS architecture \n\n![](./docs/images/aws.jpg)\n\n\n### UX Design (Initial design)\n\n[Figma](https://www.figma.com/file/XC8AZwsZi2vPGVHY5PK7NT/Game-of-Three?node-id=0%3A1\u0026t=4PQaKn2vrGkvaAuQ-1)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusith%2Fgame-of-threes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusith%2Fgame-of-threes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusith%2Fgame-of-threes/lists"}