{"id":13630328,"url":"https://github.com/goldbergyoni/node-chaos-monkey","last_synced_at":"2025-04-09T14:06:45.607Z","repository":{"id":57197039,"uuid":"124506331","full_name":"goldbergyoni/node-chaos-monkey","owner":"goldbergyoni","description":"Extremly naughty chaos monkey for Node.js","archived":false,"fork":false,"pushed_at":"2023-03-30T10:21:57.000Z","size":1351,"stargazers_count":231,"open_issues_count":29,"forks_count":10,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-12-23T21:33:55.619Z","etag":null,"topics":["chaos-engineering","chaos-monkey","chaos-testing","express","javascript","nodejs","testing"],"latest_commit_sha":null,"homepage":null,"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/goldbergyoni.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-09T07:46:13.000Z","updated_at":"2024-11-05T18:26:53.000Z","dependencies_parsed_at":"2024-01-14T08:48:56.444Z","dependency_job_id":"b9b34faf-e802-4385-b902-f7c32583cf9d","html_url":"https://github.com/goldbergyoni/node-chaos-monkey","commit_stats":null,"previous_names":["i0natan/node-chaos-monkey"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldbergyoni%2Fnode-chaos-monkey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldbergyoni%2Fnode-chaos-monkey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldbergyoni%2Fnode-chaos-monkey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldbergyoni%2Fnode-chaos-monkey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goldbergyoni","download_url":"https://codeload.github.com/goldbergyoni/node-chaos-monkey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054227,"owners_count":21039952,"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":["chaos-engineering","chaos-monkey","chaos-testing","express","javascript","nodejs","testing"],"created_at":"2024-08-01T22:01:38.539Z","updated_at":"2025-04-09T14:06:45.575Z","avatar_url":"https://github.com/goldbergyoni.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Extremely naughty Node.js chaos monkey\n\n\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"docs/chaos-monkey.png\" alt=\"Chaos Monkey\" /\u003e\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/⚙%20Build%20-%20Passing-blue.svg\" alt=\"74 items\"\u003e \u003cimg src=\"https://img.shields.io/badge/%F0%9F%93%85%20Coverage%20-%2076-green.svg\" alt=\"Last update: October 7th, 2018\"\u003e \u003cimg src=\"https://img.shields.io/badge/%E2%9C%94%20Pranks%20%20-%209%20Items-brightgreen.svg\" alt=\"Updated for Node 8.11.3 LTS\"\u003e\n\u003c/div\u003e\n\n### **Caution: Alpha mode, we're now stabilizing the functionality and enhancing the docs. Consider contributing or visiting again soon**\n\n\u003cbr/\u003e\n\n## Don't go to production without 10 minutes of application-level chaos testing\n\n\u003e \"A software QA engineer walks into a bar\n\u003e \n\u003eHe orders a beer. Orders 0 beers. Orders 99999999999 beers. Orders a lizard. Orders -1 beers. Orders a ueicbksjdhd.\n\u003e\n\u003eFirst real customer walks in and asks where the bathroom is. The bar bursts into flames, killing everyone.\"\n\u003e\n\u003eCredit @brenankeller\n\nFunctional bugs are just a subset of the bad things that happen in production. In reality, unplanned chaos will affect your application reliability. How? your process will crash, the event loop might get blocked, many exceptions will not get caught, some unknowns will slow your API, other unknowns will increase your error rate. To name a few. **Unlike most chaos tools, our project is focused on application-level chaos and specifically bad things that happen in Node.js applications**.\n\nDeploy like a pro by spending as little as 10 minutes on Chaos Testing:\n\n**1.** Simulate some bad things (e.g. event loop is blocked, error rate is inclining)\n\n**2.** Approach your APIs to ensure they function correctly \n\n**3.** Ensure your monitoring systems became aware of the situation\n   \n**We can seamlessly perform the two first tasks for you using our nit UI or command line**\n\n\u003cimg src=\"./docs/basic-flow.png\"\u003e\n\n\n## 3 min start\n### Great for quick experiments, some pranks (damage) won't be available\n\nA. **Install:** `npm install node-chaos-monkey`\n\nB. **Add a flag to start command:** `node -r node-chaos-monkey {your start file.js}`\n\nC. **Trigger chaos using API or UI**: \n- Browse to `http/s://{host}/chaos` and trigger some chaos\n- Invoke the API `POST: http/s://{host}/chaos/random`\n\nThis will trigger a random chaos, multiple pranks will get executed (e.g. memory overload, uncaught exceptions). Follow the log or the UI to see whatg happened and whether your app stayed resillience\n\n## 5 min start (full functionality)\nA. **Install:** `npm install node-chaos-monkey`\n\nB. **Add a reference in your code:** \n\nRequire this package at the very beginning of your app, before registering other routes\n\n```javascript\nconst ChaosMonkey = require('chaos-monkey');\n//pass in a reference to express app so the monkey can generate damage also within Express routes. This param is optional //but without it some pranks won't be available\nChaosMonkey.initialize(your-express-app);\n```\n\nC. **Trigger chaos using API or UI**: \n- Browse to `http/s://{host}/chaos` and trigger some chaos\n- Invoke the API `POST: http/s://{host}/chaos/random`\n\n\n\n\n## API and full documentation\n***1. Get list of available pranks***\n\nMethod: GET\n\nAddress: http://localhost:8081/chaos/pranks-pool\n\nSent body: Empty\n\nReturn:\n`[\n    {\n        \"name\": \"500-error-on-route\",\n        \"file\": \"500-error-on-route\",\n        \"active\": false,\n        \"properties\": {\n            \"urls\": [\n                \"/api/products\",\n                \"/anyurl\"\n            ]\n        },\n        \"schedule\": {\n            \"type\": \"immediate-schedule\",\n            \"fadeOutInMS\": 10000\n        }\n    }\n]\n`\n\n***2. Activate a prank***\n\nMethod: POST\n\nAddress: http://localhost:8081/chaos/pranks-activity\n\nSent body: \n`\n{\n      \"name\": \"500-error-on-route\",\n      \"file\": \"500-error-on-route\",\n      \"active\": false,\n      \"properties\": {\n        \"urls\": [\"/api/products\", \"/anyurl\"]\n      },\n      \"schedule\": {\n        \"type\": \"immediate-schedule\",\n        \"fadeOutInMS\": 10000\n      }\n}\n\n    \n`\nReturn:\n`\n`\n\n***3. Web socket: subscribe to prank***\n\nMethod: WS\n\nAddress: http://localhost:8081\n\nEvent schema:\n\n`\n{name: '500-error-on-route', friendlyName: 'API returned a 500 status error', \n  description: 'Our monkey intercepts HTTP routes and return errors on your behalf', lastHappened: new Date(),\n  expectations: 'Your monitoring system should notify, error should appear in log',\n  reality: 'The process has crashed',\n  success: 'Yes' }\n`\n\nExample:\n`\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js\"\u003e\u003c/script\u003e\n    \u003cScript\u003e\n        var socket = io('http://localhost:8081');\n        var isOkToEmit = true;\n\n        console.log('after')\n        socket.on('new-prank-activity', function (data) {\n            console.log(`A new prank just ran ${data}`);\n        });\n    \u003c/Script\u003e\n    `\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoldbergyoni%2Fnode-chaos-monkey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoldbergyoni%2Fnode-chaos-monkey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoldbergyoni%2Fnode-chaos-monkey/lists"}