{"id":28206305,"url":"https://github.com/hodonsky/node-service","last_synced_at":"2026-02-16T12:31:14.210Z","repository":{"id":276846159,"uuid":"281239792","full_name":"hodonsky/node-service","owner":"hodonsky","description":"Service lambda handler side of SOA based on AMQP 0-9-1","archived":false,"fork":false,"pushed_at":"2025-02-25T03:05:25.000Z","size":1736,"stargazers_count":1,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T15:54:05.843Z","etag":null,"topics":["amqp","node-service","nodejs","soa"],"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/hodonsky.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-07-20T22:38:12.000Z","updated_at":"2025-03-22T22:43:13.000Z","dependencies_parsed_at":"2025-06-11T21:41:47.881Z","dependency_job_id":"5f67568c-e9f6-4650-ae32-501eaefd0bbb","html_url":"https://github.com/hodonsky/node-service","commit_stats":null,"previous_names":["hodonsky/node-service"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hodonsky/node-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodonsky%2Fnode-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodonsky%2Fnode-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodonsky%2Fnode-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodonsky%2Fnode-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hodonsky","download_url":"https://codeload.github.com/hodonsky/node-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodonsky%2Fnode-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29507902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["amqp","node-service","nodejs","soa"],"created_at":"2025-05-17T10:09:37.102Z","updated_at":"2026-02-16T12:31:14.193Z","avatar_url":"https://github.com/hodonsky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node-Service\n\nThis is the service handler side of the SOA\n\n### Prequisites ( standard AMQP 0-9-1 )\n- AMQP Server/Cluster accepting connections with credentials. ( see  [`Local`](#Local) setup )\n- Gateway Service(s)/Cluster(s) listening on responseTopic with CorrelationID. ([@donsky/node-gateway](https://www.npmjs.com/package/@donsky/node-gateway) )\n\n### Impliments:\n- NodeJS\n- AVRO Message Standards \u0026 Schema ( dependancy: avsc )\n- AMQP 0-9-1 Communication Standard ( dependancy: amqplib )\n- Babel 7 \u0026 ESNext plugins ( dependancy: babel-* )\n\n\n## Initialize Your Service\n\n```javascript\n// -- CommonJS --\nconst Service = require( \"@donsky/node-service\" ).default\n\n// -- ESNext --\nimport Service from \"@donsky/node-service\"\n\nnew Service(/*\n  { ...responders },\n  { ...actions },\n  // this[name] = [new@instantiate] require(lib)\n  [\n    { lib: \"uuid\" },\n    { lib: \"sha256\", name: \"encrypt\"  }\n    { lib: \"./localDep\", name: \"dep1\", instantiate: true }\n  ]\n*/)\n```\n## Configure\nAll of the following configurations must be handled in the env vars, or in config in the code. Examples below:\n\n### ENV VARS\n\nAdd the following to your bashrc, or bash profile depending on environment.\nI use docker-compose so I just attach them to the container environment.\nThese will be picked up automatically by the default config file.\n\n```bash\nexport HOSTNAME=consumerService\nexport MQ_PROTOCOL=amqp\nexport MQ_HOSTNAME=rabbitmq\nexport MQ_PORT=5672\nexport MQ_USERNAME=admin\nexport MQ_PASSWORD=Abcd1234\nexport MQ_QUEUE=consumerTopic\n```\n###### The hostname can be a URI or a local hostname, in this example, _'rabbitmq'_ is my docker container hostname. During deploy this would change and be environment specific.\n\n### Code\n```javascript\nService.configure({\n  mq:{\n    username: \"admin\",\n    password: \"Abcd1234\"\n    hostname: \"rabbitmq\"\n    port    : 5672,\n    queue   : \"consumerTopic\"\n  }\n})\n```\n\n\n## Action Object Options:\n\n```javascript\n// action.js\n/** \n * Required Attributes\n */\nexport const consumerActionName = {\n  requestAVRO : [\n    { name: \"firstName\", type: \"string\" }\n  ],\n  responseAVRO: [\n    { name: \"response\", type: \"string\" }\n  ],\n  errorAVRO:[\n    { name: \"error\", type: \"string\" }\n  ]\n}\n```\n\n## Responder Function:\n```javascript\nconsumer.js\n/**\n * Consumer Action\n */\nexport async function consumerActionName( { firstName } ) {\n  const lastName = \"alwaysLast\"\n  return { response: lastName }\n}\n```\n\n#### Example:\n\n```javascript\n\"use strict\"\n\nimport Service from \"@donsky/node-service\"\n\nimport * as actions from \"./action\"\nimport * as responders from \"./consumer\"\n\nService.configure( { mq: { queue: \"consumerTopic\" } } )\nnew Service( responders, actions, [ { lib: \"uuid\" } ] )\n```\n\n\u003cbr/\u003e\n\n\u003e Notes:\n\u003e - Without any __actions__ and __responders__ the server should start, but it won't do much\n\u003e - This works well with PM2 (Process Manager 2)\n\n\u003cbr/\u003e\n\n## Local:\n\nMay I recommend spinning up a docker environment for those prerequisites, and getting all the services talking:\n\n```Dockerfile\n# Note: I use a docker container\nversion: \"3.8\"\nservices:\n  rabbitmq:\n    image: rabbitmq:management\n    ports:\n     - \"5672:5672\"\n     - \"15672:15672\"\n    environment:\n      # ${ENV_VAR} work here for values as well\n      RABBITMQ_DEFAULT_USER: defaultAdmin\n      RABBITMQ_DEFAULT_PASS: SomePassword\n    restart: on-failure   \n\n  service-auth:\n    build:\n      context: ./\n    environment:\n      - MQ_PROTOCOL=amqp\n      - MQ_HOSTNAME=rabbitmq\n      - MQ_PORT=5672\n      - MQ_USERNAME=defaultAdmin\n      - MQ_PASSWORD=SomePassword\n      - MQ_QUEUE=consumerTopic\n    depends_on:\n      - rabbitmq\n    restart: on-failure\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodonsky%2Fnode-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhodonsky%2Fnode-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodonsky%2Fnode-service/lists"}