{"id":21519578,"url":"https://github.com/thedanielmoli/koa-power","last_synced_at":"2026-04-14T23:32:35.073Z","repository":{"id":102176400,"uuid":"172133159","full_name":"TheDanielMoli/koa-power","owner":"TheDanielMoli","description":"Koa with superpowers! Effortless clustering, logging, response time \u0026 colors with Koa.","archived":false,"fork":false,"pushed_at":"2019-06-13T16:20:54.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-07T00:36:36.724Z","etag":null,"topics":["clustering","colors","koa","logging","nodejs","response-time"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheDanielMoli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-22T20:53:52.000Z","updated_at":"2019-06-13T16:20:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"22bbbbce-9689-4e97-aa24-8b1004a7f7cb","html_url":"https://github.com/TheDanielMoli/koa-power","commit_stats":null,"previous_names":["sadkit/koa-power"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/TheDanielMoli/koa-power","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDanielMoli%2Fkoa-power","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDanielMoli%2Fkoa-power/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDanielMoli%2Fkoa-power/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDanielMoli%2Fkoa-power/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheDanielMoli","download_url":"https://codeload.github.com/TheDanielMoli/koa-power/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDanielMoli%2Fkoa-power/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268644482,"owners_count":24283334,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["clustering","colors","koa","logging","nodejs","response-time"],"created_at":"2024-11-24T00:58:02.264Z","updated_at":"2026-04-14T23:32:35.029Z","avatar_url":"https://github.com/TheDanielMoli.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-power [![npm][npm-image]][npm-url]\n\n[npm-image]: https://img.shields.io/npm/v/koa-power.svg\n[npm-url]: https://www.npmjs.com/package/koa-power\n\nKoa with superpowers! Effortless clustering, CLI logging, response time \u0026 colors with Koa.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://www.sadkit.com/assets/img/koa-power-minimal.png\" alt=\"Koa Power\" width=\"539px\" height=\"217px\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\nInstall Koa Power with npm:\n\n```\nnpm install --save koa-power\n```\n\n## Usage \u0026 Examples\n\nMinimal example - examples/minimal.js\n\n```javascript\nconst Power = require('koa-power');\nconst {log} = Power;\n\nconst main = app =\u003e {\n    app.listen(80, () =\u003e log(`App listening on port ${'80'.green}.`));\n};\n\nPower.load(main);\n```\n\nExtended Example - examples/extended.js\n\n```javascript\nconst Power = require('koa-power');\nconst {log} = Power;\n\nlet options = {\n    appName: 'Lorem Ipsum Dolor Sit Amet',\n    appNameColor: 'rainbow',\n    mid: [], // Koa middleware array - e.g. [ compress(), bodyParser() ]\n    numWorkers: 3,\n    enableLog: true\n};\n\nconst main = app =\u003e {\n    app.use(ctx =\u003e {\n        ctx.status = 200;\n        ctx.body = 'Hello, world!';\n    });\n\n    app.listen(80, () =\u003e log(`App listening on port ${'80'.green}.`));\n};\n\nPower.load(main, options);\n```\n\nIn production, usage of [pm2](https://www.npmjs.com/package/pm2) to run your Koa Power app is *strongly recommended*.\n\n## Options\n\nPower options you can use in `Power.load(main, options);`\n\n| Option | Default Value | What it does |\n| --- | --- | --- |\n| appName | 'Koa Power App' | Sets the app name\n| appNameColor | 'italy' | Sets the app name color\n| mid | [] | Array of koa middleware\n| numWorkers | 2 | Number of workers\n| locale | 'en' | moment locale\n| enableLog | false | Enable logging to file\n| logFileName | appDirectory + '/power.log' | Log filename\n| afterFork | () =\u003e {} | Callback after fork or re-fork\n\n## Full Reference\n\nRequire Koa Power this way:\n\n```ecmascript 6\nconst Power = require('koa-power');\n```\n\nNow, the exported elements are:\n\n```ecmascript 6\nconst {load, log, italy, space, name} = Power;\n```\n\nLet's see them in detail:\n\n| Element | What it does | Proto |\n| --- | --- | --- |\n| load | Powers Koa | load(worker, options)\n| log | Power logs to console | log(text)\n| italy | Colors text as Italian flag | italy(text) / text.italy\n| space | Spaces text in a row | space(text, width)\n| name | Changes the worker name | name(text)\n\nPower options you can use in `load(main, options);`\n\n| Option | Default Value | What it does |\n| --- | --- | --- |\n| appName | 'Koa Power App' | Sets the app name\n| appNameColor | 'italy' | Sets the app name color\n| mid | [] | Array of koa middleware\n| numWorkers | 2 | Number of workers\n| locale | 'en' | moment locale\n| enableLog | false | Enable logging to file\n| logFileName | appDirectory + '/power.log' | Log filename\n| afterFork | () =\u003e {} | Callback after fork or re-fork\n\n*Notice: this package uses [Colors](https://www.npmjs.com/package/colors) internally, which extends the String prototype.*\n\n## Contributing\n\nFeel free to open an Issue or send me a direct message.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Sadkit/koa-power/tags). \n\n## Authors\n\n* **Daniele Molinari** - [Sadkit](https://github.com/Sadkit)\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE.md](LICENSE.md) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedanielmoli%2Fkoa-power","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedanielmoli%2Fkoa-power","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedanielmoli%2Fkoa-power/lists"}