{"id":22001113,"url":"https://github.com/rsginer/idle-capitalist","last_synced_at":"2025-05-01T10:13:21.723Z","repository":{"id":43987163,"uuid":"241343651","full_name":"RSginer/idle-capitalist","owner":"RSginer","description":"React Redux Node.js Websockets Express Idle Capitalist Video Game like Adventure Capitalist - Full Stack JS","archived":false,"fork":false,"pushed_at":"2025-04-19T10:59:09.000Z","size":4664,"stargazers_count":12,"open_issues_count":16,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-01T10:13:12.756Z","etag":null,"topics":["cqrs","express","idle-capitalist","idle-game","mongodb","nodejs","react-redux","reactjs","redux-saga","videogame","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/RSginer.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-02-18T11:26:24.000Z","updated_at":"2025-04-19T10:59:12.000Z","dependencies_parsed_at":"2023-02-07T12:16:11.390Z","dependency_job_id":"40fd997a-b80a-42f1-9c7d-c93c138c6a9e","html_url":"https://github.com/RSginer/idle-capitalist","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/RSginer%2Fidle-capitalist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RSginer%2Fidle-capitalist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RSginer%2Fidle-capitalist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RSginer%2Fidle-capitalist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RSginer","download_url":"https://codeload.github.com/RSginer/idle-capitalist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251857020,"owners_count":21655121,"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":["cqrs","express","idle-capitalist","idle-game","mongodb","nodejs","react-redux","reactjs","redux-saga","videogame","websocket"],"created_at":"2024-11-29T23:12:40.937Z","updated_at":"2025-05-01T10:13:21.711Z","avatar_url":"https://github.com/RSginer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Idle Capitalist\n\u003cspan style=\"display:block;text-align:center\"\u003e\n\n![alt text](https://raw.githubusercontent.com/RSginer/idle-capitalist/master/screenshot.gif \"Idle Capitalist\")\n\n\u003c/span\u003e\n\n\n### Features\n  - ✅ Buy Business.\n  - ✅ Multiple Business to choose\n  - ✅ Upgrade Business.\n  - ✅ Manage orders.\n  - ✅ Hire Managers.\n  - ✅ Managers automatically manage orders.\n  - ✅ Your businesses make money for you while you are out, even if the server is down or the websocket is disconnected.\n  - ✅ Websocket reconnection.\n\n## Getting Started 🎉\n* Clone the repository. \n```bash\ngit clone https://github.com/RSginer/idle-capitalist.git\n```\n### Docker\n* Build images.\n```bash\ncd idle-capitalist\ndocker-compose build\n```\n\n* Run the containers.\n```bash \ndocker-compose up\n```\n\n* Go to http://localhost:3000 🤘\n### npm\n* This option needs Node.js v12.16.1 installed and a MongoDB instance running on your localhost\n#### Start Server\n\n* Install dependencies\n```bash\ncd idle-capitalist/server\nnpm install\n```\n\n* Start the server\n```bash\nnpm run start\n```\n\n* Start the server in development mode\n```bash\nnpm run start:dev\n```\n#### Start Client\n* Install dependencies\n```bash\ncd idle-capitalist/client\nnpm install\n```\n\n* Start Webapp\n```bash\nnpm run start\n```\n\n* Go to http://localhost:3000 🤘\n\n## 👨‍💻 Technical things\n\nWorkflow: \n`Web browser -\u003e React Component -\u003e Dispatch Redux Action -\u003e Redux Saga Catch -\u003e Websocket Emmit -\u003e Server Websocket -\u003e Controller -\u003e RPC Exec Command -\u003e Service -\u003e Repository -\u003e Database`.\n\nInitial game state is fetched from an REST API `GET /api/v1/game/initialGameState`.\n\nClient and server communicates their commands throght a **websocket**.\n\n### Client\nClient is a **React-Redux webapp**, with **Redux-Saga**, so is a implementation of the flux pattern.\nIt's also ready to use with **[Redux-DevTools](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en)**\n\n### Server\nServer is a **Node.js** with **Express** server.\n\n### Database\nServer uses a **MongoDB** database.\n\n#### Game Model Schema\nThis Model is used to store the game data.\n```js\nGame: {\n  totalCashAmount: Number,\n  businesses: [Business],\n  lastEventDateInMs: Number\n}\n```\n\n#### Business Model Schema\nThis Model is used to store the businesses data for each `Game`\n```js\nBusiness: {\n  businessKey: String,\n  level: Number,\n  manager: Boolean,\n  lastOrderStarted: Number\n}\n```\n### Maths\n* Calculating expand business cost.\n\n$cost_{next} = cost_{base} \\times (rate_{growth})^{owned}$\n\n$cost_{base} = \\text{Initial Cost}$\n\n$rate_{growth} = \\text{Coefficient}$\n\n$owned = \\text{Business Level}$\n\n* Calculating business revenue per second\n\n$production_{total} = (production_{base} \\times owned)$\n\n$owned = \\text{Business Level}$\n\n$production_{base} = \\text{Initial Productivity}$\n\n* 👨🏻‍💼 Managers price is fixed depends on the business:\n  - **Lemonade Stand**: $1,000\n  - **Newspaper Delivery**: $15,000\n  - **Car Wash**: $100,000\n  - **Pizza Delivery**: $500,000\n  - **Donut Shop**: $1,200,000\n\n* Initial values\n\n\u003cimg src=\"https://cdn1.kongcdn.com/assets/files/0001/8435/anthony_idle_1.png\" alt=\"Maths of Idle capitalist table\" width=\"500px\" /\u003e\n\n* 👨🏻‍🎓📚 **Bibliography**: https://blog.kongregate.com/the-math-of-idle-games-part-i/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsginer%2Fidle-capitalist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsginer%2Fidle-capitalist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsginer%2Fidle-capitalist/lists"}