{"id":26049580,"url":"https://github.com/mahsumurebe/jrpc-server","last_synced_at":"2025-10-05T01:58:59.018Z","repository":{"id":55413058,"uuid":"244019983","full_name":"mahsumurebe/jrpc-server","owner":"mahsumurebe","description":"JSONRPC 2.0 NodeJS Server written in TypeScript","archived":false,"fork":false,"pushed_at":"2022-11-23T08:43:56.000Z","size":225,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-31T13:44:06.666Z","etag":null,"topics":["http-server","jsonrpc","jsonrpc-lib","jsonrpc-server","jsonrpc2","websocket"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@mahsumurebe/jrpc-server","language":"TypeScript","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/mahsumurebe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-29T18:24:29.000Z","updated_at":"2025-05-29T20:37:14.000Z","dependencies_parsed_at":"2023-01-23T13:00:38.442Z","dependency_job_id":null,"html_url":"https://github.com/mahsumurebe/jrpc-server","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mahsumurebe/jrpc-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fjrpc-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fjrpc-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fjrpc-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fjrpc-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahsumurebe","download_url":"https://codeload.github.com/mahsumurebe/jrpc-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fjrpc-server/sbom","scorecard":{"id":612518,"data":{"date":"2025-08-11","repo":{"name":"github.com/mahsumurebe/jrpc-server","commit":"13143421196943f57f92048bbf99807139063c96"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/mahsumurebe/jrpc-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mahsumurebe/jrpc-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/mahsumurebe/jrpc-server/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/mahsumurebe/jrpc-server/npm-publish.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/npm-publish.yml:18","Warn: npmCommand not pinned by hash: .github/workflows/npm-publish.yml:35","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T02:58:55.938Z","repository_id":55413058,"created_at":"2025-08-21T02:58:55.938Z","updated_at":"2025-08-21T02:58:55.938Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278063083,"owners_count":25923590,"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-10-02T02:00:08.890Z","response_time":67,"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":["http-server","jsonrpc","jsonrpc-lib","jsonrpc-server","jsonrpc2","websocket"],"created_at":"2025-03-08T01:44:39.084Z","updated_at":"2025-10-05T01:58:58.963Z","avatar_url":"https://github.com/mahsumurebe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONRPC Server\n\nJSONRPC 2.0 NodeJS Server written in TypeScript\n\nFully tested to comply with the official [JSON-RPC 2.0 specification](https://www.jsonrpc.org/specification)\n\n![GitHub package.json version](https://img.shields.io/github/package-json/v/mahsumurebe/jrpc-server?style=for-the-badge)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/mahsumurebe/jrpc-server?style=for-the-badge)\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/mahsumurebe/jrpc-server?style=for-the-badge)\n![npm](https://img.shields.io/npm/dt/@mahsumurebe/jrpc-server?style=for-the-badge)\n\n![Libraries.io SourceRank, scoped npm package](https://img.shields.io/librariesio/sourcerank/npm/@mahsumurebe/jrpc-server?style=for-the-badge)\n![minzipped-size](https://img.shields.io/bundlephobia/minzip/@mahsumurebe/jrpc-server/latest?style=for-the-badge)\n![minfied-size](https://img.shields.io/bundlephobia/min/@mahsumurebe/jrpc-server/latest?style=for-the-badge)\n\n![issues-open](https://img.shields.io/github/issues/mahsumurebe/jrpc-server?style=for-the-badge)\n![issues-closed](https://img.shields.io/github/issues-closed/mahsumurebe/jrpc-server?style=for-the-badge)\n![license](https://img.shields.io/github/license/mahsumurebe/jrpc-server?style=for-the-badge)\n\n## Quick Overview\n\nIt is used to quickly create JSONRPC Server. Method definition is very simple. With the event structure, events can be\neasily followed.\n\n## Install\n\n```\nnpm install @mahsumurebe/jrpc-server\n```\n\n## Usage\n\nIt should not create a JRPCServer instance.\n\n```typescript\nimport {JRPCServer, HttpAdapter} from '@mahsumurebe/jrpc-server';\n\n// Create JSONRPC Server with HTTP Adapter\nconst instance = await new JRPCServer(\n    new HttpAdapter({\n        hostname: \"localhost\",\n        port: 3000,\n    }),\n    {\n        paramType: 'array'\n    }\n);\n// Start server\nawait instance.start();\n```\n\n### JRPCServer Options\n\n| KEY            | DEFAULT   | DESCRIPTION                                                                                                                                      |\n|----------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| paramType      | \"array\"   | Parameter type. Specifies the type of params item in the body of the JSONRPC request.                                                            |\n| methodManager  | undefined | Manager that stores methods and calls them.                                                                                                      |\n| routerManager  | undefined | The manager that processes the requests forwarded by the adapter, calls the relevant method(s) via the method manager and creates response data. |\n| validator      | undefined | The method called to validate each JSONRPC request. Returns InvalidParamException if an invalid JSONRPC body was sent.                           |\n\n### Method Definition\n\nMethod definitions are after JRPCServer instance is created.\n\n```typescript\ninstance.methods.add('help', () =\u003e {\n    return 'DONE';\n});\n\ninstance.methods.add('sum', (a: number, b: number) =\u003e {\n    return a + b;\n});\n```\n\n## For Testing\n\nYou can use the code below to send and test the cURL request.\n\n```shell script\ncurl -H \"Content-Type: application/json\" -d '{\"id\":2, \"jsonrpc\":\"2.0\",\"method\":\"sum\",\"params\":[1,2]}' http://127.0.0.1:3000\n```\n\n***Response:***\n\n```json\n{\n  \"id\": 2,\n  \"jsonrpc\": \"2.0\",\n  \"result\": 3\n}\n```\n\n## Adapters\n\nThere are HTTP and Websocket adapters available.\n\n### HTTP\n\nHTTP Adapter is used to create to JRPC Server served over HTTP Protocol.\n\n```typescript\n// Adapter Instance\nimport {JRPCServer, HttpAdapter} from '@mahsumurebe/jrpc-server';\n\nconst adapter = new HttpAdapter({\n    port: 3000\n})\n\n// Create Instance\nconst instance = new JRPCServer(adapter);\n```\n\n#### Configuration List\n\nConfigurations are defined in the object in the first parameter of the construction method when creating the\nHttpAdapter.\n\n| KEY                   | DEFAULT   | DESCRIPTION                                                                                                        | Type    |\n|-----------------------|-----------|--------------------------------------------------------------------------------------------------------------------|---------|\n| hostname              | 127.0.0.1 | Server listening address                                                                                           | string  |\n| port                  | undefined | Server listening port                                                                                              | number  |\n| pathname              | \"/\"       | Server listening path                                                                                              | string  |\n| keepAlive             | false     | Activates the keep-alive function on the socket immediately after a new incoming connection is received            | boolean |\n| keepAliveInitialDelay | 0         | If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. | number  |\n| ssl                   | undefined | SSL Config                                                                                                         | object  |\n| ssl.cert              | undefined | Cert chains in PEM format                                                                                          | string  |\n| ssl.privateKey        | undefined | Private keys in PEM format. PEM allows the option of private keys being encrypted.                                 | string  |\n\n### Websocket\n\nWebsocket Adapter is used to create to JRPC Server served over Websocket Protocol.\n\n```typescript\nimport {JRPCServer, WebsocketAdapter} from '@mahsumurebe/jrpc-server';\n\n// Adapter Instance\nconst adapter = new WebsocketAdapter({port: 3000})\n\n// Create Instance\nconst instance = new JRPCServer(adapter);\n```\n\n#### Configuration List\n\nConfigurations are defined in the object in the first parameter of the construction method when creating the\nWebsocketAdapter.\n\n#### Configuration List\n\nConfigurations are defined in the object in the first parameter of the construction method when creating the\nHttpAdapter.\n\n| KEY                   | DEFAULT   | DESCRIPTION                                                                                                        | Type    |\n|-----------------------|-----------|--------------------------------------------------------------------------------------------------------------------|---------|\n| hostname              | 127.0.0.1 | Server listening address                                                                                           | string  |\n| port                  | undefined | Server listening port                                                                                              | number  |\n| pathname              | \"/\"       | Server listening path                                                                                              | string  |\n| keepAlive             | false     | Activates the keep-alive function on the socket immediately after a new incoming connection is received            | boolean |\n| keepAliveInitialDelay | 0         | If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. | number  |\n| ssl                   | undefined | SSL Config                                                                                                         | object  |\n| ssl.cert              | undefined | Cert chains in PEM format                                                                                          | string  |\n| ssl.privateKey        | undefined | Private keys in PEM format. PEM allows the option of private keys being encrypted.                                 | string  |\n\n#### Custom Adapters\n\nFor custom adapters, you need to extend the adapter class with the `AdapterAbstract` abstract class.\nYou have to create the abstract functions request, connect and destroy inside the class.\n\n**listen**: A piece of code should be added to this method that enables the creation of a protocol server.\n\n**shutdown**: A piece of code should be added to this method that enables the protocol server shutdown.\n\n**isListening**: Checks protocol server is listening.\n\n### How to Use Both HTTP Adapter and Web Socket Adapter\n\nIf you want the server you created to respond to request both over the HTTP protocol\nand over the Websocket protocol, it will be sufficient to place an HttpAdapter class\ninside the WebsocketAdapter class constructor.\n\n```typescript\nimport {HttpAdapter, WebsocketAdapter, JRPCServer} from '@mahsumurebe/jrpc-server';\n\n// Create HTTP Adapter\nconst httpAdapter = new HttpAdapter({\n    hostname: \"localhost\",\n    port: 3000,\n});\n// Create Websocket Adapter with HTTP Adapter\nconst websocketAdapter = new WebsocketAdapter(httpAdapter);\n\n// Create instance\nconst instance = new JRPCServer(websocketAdapter);\n```\n\n## Resources\n\n- [Changelog](./CHANGELOG.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahsumurebe%2Fjrpc-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahsumurebe%2Fjrpc-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahsumurebe%2Fjrpc-server/lists"}