{"id":21044384,"url":"https://github.com/ashikka/golf-it","last_synced_at":"2025-06-15T21:39:31.097Z","repository":{"id":46804854,"uuid":"408885152","full_name":"ashikka/golf-it","owner":"ashikka","description":"A game designed to let you show off your code-fu by solving problems in the least number of characters :sparkles:","archived":false,"fork":false,"pushed_at":"2022-01-11T19:21:37.000Z","size":9349,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T14:52:17.558Z","etag":null,"topics":["code-executor","codegolf","react","redis","socket-io","typescript"],"latest_commit_sha":null,"homepage":"https://golfit.ashikka.tech","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/ashikka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-21T16:01:06.000Z","updated_at":"2025-03-21T05:46:25.000Z","dependencies_parsed_at":"2022-09-11T17:02:45.469Z","dependency_job_id":null,"html_url":"https://github.com/ashikka/golf-it","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"csivitu/Template","purl":"pkg:github/ashikka/golf-it","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashikka%2Fgolf-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashikka%2Fgolf-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashikka%2Fgolf-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashikka%2Fgolf-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashikka","download_url":"https://codeload.github.com/ashikka/golf-it/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashikka%2Fgolf-it/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260054170,"owners_count":22952048,"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":["code-executor","codegolf","react","redis","socket-io","typescript"],"created_at":"2024-11-19T14:16:36.479Z","updated_at":"2025-06-15T21:39:31.077Z","avatar_url":"https://github.com/ashikka.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Issues][issues-shield]][issues-url]\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/ashikka/golf-it\"\u003e\n    \u003cimg src=\"./docs/golfing.png\" alt=\"Logo\" width=\"80\"\u003e\n  \u003c/a\u003e\n\n  \u003cb\u003e\u003ch2 align=\"center\"\u003eGolf it!\u003c/h2\u003e\u003c/b\u003e\n\n  \u003cp align=\"center\"\u003e\n    Golf it! is a game designed to let you show off your code-fu by solving problems \u003cbr\u003e in the least number of \u003cb\u003echaracters\u003c/b\u003e :sparkles:\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/ashikka/golf-it\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/ashikka/golf-it\"\u003eView Demo\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/ashikka/golf-it/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://github.com/ashikka/golf-it/issues\"\u003eRequest Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n## :dart: Table of Contents\n\n* [About the Project](#about-the-project)\n  * [Built With](#built-with)\n* [Getting Started](#getting-started)\n  * [Prerequisites](#prerequisites)\n  * [Installation](#installation)\n* [Usage](#usage)\n* [Roadmap](#roadmap)\n* [Contributing](#contributing)\n* [License](#license)\n* [Contributors](#contributors-)\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n##  :open_book: About The Project\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/ashikka/golf-it\"\u003e\n    \u003cimg src=\"./docs/golf.gif\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nOne of our teammates loves to solve [codegolf](https://codegolf.stackexchange.com) questions. We thought it would be a good idea to implement this as a one on one competition, where two players can compete live to write the shortest snippet of code to solve a question.\n\nCode Golf refers to attempting to solve a problem using the least amount of characters possible i.e. to have the smallest source code. The term is derived from the sport golf where the player’s goal is to hit their ball in the hole using the least number of shots possible. In Code Golf the developer that solves the problem (usually writing a function) using the fewest number characters possible wins.\n\n## :gear: How we built it\n\nThe backend was built using `NodeJS` and `Typescript`. We used `expressJS` to implement all the routes required for submitting code. The backend uses an npm library called `code-executor` which was built in the past by one of our teammates, to execute code against test cases in isolated `Docker` containers. To implement real-time communication when a head-to-head game started, we used `socket.io` to connect both the players in the same room. We used firestore as a database.\n\nThe frontend was built using React and Bootstrap. We used `socket.io-client` to interact with the socket server, and axios to interact with the express backend. To display the code editor on the website with multiple themes and syntax support for languages, we used a library called `react-ace`.\n\n## :rocket: What's next for Golf-it!\nWe have many features planned for golf-it in the future:\n\n* Global leaderboards across the website, for players who regularly win more and more head-to-head games to showcase their skills.\n* User accounts (registering and logging in)\n* The ability for users to submit their own questions, and people to vote for questions they found interesting.\n* Picking avatars for your own profile\n* Having live competitions with even more people, instead of just head-to-head ones.\n\n### Built With\n\n\n| Backend | Frontend     | \n| :--------: | :-------: | \n| [Typescript](https://www.typescriptlang.org/download)    | [Javascript](https://www.javascript.com/) | \n| [express](https://www.npmjs.com/package/express)   | [axios](https://www.npmjs.com/package/axios) |  \n|[firebase](https://www.npmjs.com/package/firebase)   | [React](https://reactjs.org/) |\n| [code-executor](https://www.npmjs.com/package/code-executor?activeTab=readme)   | [react-redux](https://react-redux.js.org/) |\n|   [socket.io](https://www.npmjs.com/package/socket.io)  |  [socket.io-client](https://www.npmjs.com/package/socket.io-client)| \n| [joi](https://www.npmjs.com/package/socket.io)   | [react-router-dom](https://www.npmjs.com/package/react-router-dom) | \n|  [redis](https://redis.io) | [react-ace](https://www.npmjs.com/package/react-ace) | \n\n\n\n\n\n\u003c!-- GETTING STARTED --\u003e\n## :airplane: Getting Started\n\nTo get a local copy up and running follow these simple steps.\n\n### Prerequisites\n\nThis is an example of how to list things you need to use the software and how to install them.\n* yarn\n```sh\nnpm install -g yarn\n```\n\n### Installation\n \n1. Clone the repo\n```sh\ngit clone https://github.com/ashikka/golf-it.git\n```\n2. Install yarn packages\n```sh\nyarn\n```\n3. Add necessary environment variables to the project using: \n```sh\n{\n        echo 'API_KEY='\n        echo 'AUTH_DOMAIN='\n        echo 'PROJECT_ID='\n        echo 'STORAGE_BUCKET='\n        echo 'MESSAGING_SENDER_ID='\n        echo 'APP_ID='\n\n} \u003e\u003e .env\n```\n\u003c!-- USAGE EXAMPLES --\u003e\n## :wrench: Usage\n\nStart the project locally by following these steps. \n\n1. Run a Redis broker on your system\n\n```sh\ndocker run -p6379:6379 redis\n```\n\n2. Start the worker which is going to interact with the library `code-executor`.\n```sh\ncd backend\n\nts-node worker.ts\n```\n3. Start the backend using:\n```sh \nyarn run dev\n```\n4. Start the frontend using:\n```sh\ncd frontend\n\nyarn start\n```\n## :triangular_flag_on_post: Routes\nThe backend of the project supports the following routes: \n\n### 1. Code submission\n```http\nPOST /code/submission/:questionName\n```\n\n| Parameter | Type     | Description                     |\n| :--------: | :-------: | :------------------------------: |\n| `params`    | `string` | questionName |\n| `body`    | `string` |  language |\n| `body`    | `string` | code |\n| `body`    | `Date` | submitTime |\n\n\n### 2. Create new room\n```http\nPOST /room/create\n```\n| Parameter | Type     | Description                     |\n| :--------: | :-------: | :------------------------------: |\n| `body`    | `string` | clientId|\n| `body`    | `number` |  payload |\n\n### 3. Get room\n```http\nGET /room/:roomId\n```\n| Parameter | Type     | Description                     |\n| :--------: | :-------: | :------------------------------: |\n| `params`    | `string` | roomId|\n\n\u003c!-- ROADMAP --\u003e\n## :world_map: Roadmap\n\nSee the [open issues](https://github.com/ashikka/golf-it/issues) for a list of proposed features (and known issues).\n\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## :mechanical_arm: Contributing\n\nContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'feat: Add some AmazingFeature'`)\n4. Push to the Branch (`git push -u origin feature/AmazingFeature`)\n5. Open a Pull Request\n\nYou are requested to follow the contribution guidelines specified in [CONTRIBUTING.md](./CONTRIBUTING.md) while contributing to the project :smile:.\n\n\u003c!-- LICENSE --\u003e\n##  :page_facing_up: License\n\nDistributed under the MIT License. See [`LICENSE`](./LICENSE) for more information.\n\n\n\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[csivitu-shield]: https://img.shields.io/badge/csivitu-csivitu-blue\n[csivitu-url]: https://csivit.com\n[issues-shield]: https://img.shields.io/github/issues/csivitu/Template.svg?style=flat-square\n[issues-url]: https://github.com/ashikka/golf-it/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashikka%2Fgolf-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashikka%2Fgolf-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashikka%2Fgolf-it/lists"}