{"id":21016093,"url":"https://github.com/protontype/proton-cluster","last_synced_at":"2026-05-18T14:33:52.420Z","repository":{"id":65476057,"uuid":"131076912","full_name":"protontype/proton-cluster","owner":"protontype","description":"A clustered starter for Node.js applications","archived":false,"fork":false,"pushed_at":"2018-05-16T12:58:25.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T10:03:24.019Z","etag":null,"topics":["cluster","nodejs","protontype"],"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/protontype.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}},"created_at":"2018-04-26T00:04:44.000Z","updated_at":"2019-06-13T00:26:18.000Z","dependencies_parsed_at":"2023-01-25T06:15:21.200Z","dependency_job_id":null,"html_url":"https://github.com/protontype/proton-cluster","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fproton-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fproton-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fproton-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/protontype%2Fproton-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/protontype","download_url":"https://codeload.github.com/protontype/proton-cluster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243447400,"owners_count":20292448,"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":["cluster","nodejs","protontype"],"created_at":"2024-11-19T10:12:10.909Z","updated_at":"2026-05-18T14:33:47.400Z","avatar_url":"https://github.com/protontype.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/proton-cluster.svg)](https://badge.fury.io/js/proton-cluster)\n\n# A clustered starter for Node.js applications\n\n## Starting workers by CPUs\n```typescript\nProtonCluster.startByCPUS(() =\u003e {\n   console.log(\"Process\");\n});\n```\n\n## Starting workers by specified number\n```typescript\nProtonCluster.start(8, () =\u003e {\n   console.log(\"Process\");\n});\n```\n\n## Starting Protontype application\n```typescript\nProtonCluster.startByCPUS(() =\u003e {\n   new ProtonApplication()\n   .addRouter(new TasksRouter())\n   .start();\n});\n```\n\n## Setup events behaviors\n\nEvents behaviors should be configured before start clusters.\n\n```typescript\nProtonCluster.onOnline(worker =\u003e {\n    console.log(`I am Online Event`);\n});\n\nProtonCluster.onExit(worker =\u003e {\n    console.log(`I am Exit Event`);\n});\n\nProtonCluster.onDisconnect(worker =\u003e {\n    console.log(`I am Disconnect Event`);\n});\n\nProtonCluster.onMessage(worker =\u003e {\n    console.log(`I am Message Event`);\n});\n\nProtonCluster.startByCPUS(() =\u003e {\n    console.log(\"Test\");\n});\n```\n\n## Cluster instance\nYou can access native Node.js cluster instance\n\n```typescript\nlet cluster = ProtonCluster.cluster;\n\ncluster.on(\"online\", worker =\u003e {\n    console.log(`Cluster ${worker.process.pid} online`);\n});\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotontype%2Fproton-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotontype%2Fproton-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotontype%2Fproton-cluster/lists"}