{"id":20337942,"url":"https://github.com/runsidekick/sidekick-client-node","last_synced_at":"2026-05-14T05:34:46.641Z","repository":{"id":65371589,"uuid":"516368344","full_name":"runsidekick/sidekick-client-node","owner":"runsidekick","description":"Sidekick Node.js Client","archived":false,"fork":false,"pushed_at":"2022-12-27T13:09:16.000Z","size":237,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-15T01:48:44.739Z","etag":null,"topics":[],"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/runsidekick.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-07-21T12:46:27.000Z","updated_at":"2022-12-27T13:09:57.000Z","dependencies_parsed_at":"2023-01-31T03:30:53.860Z","dependency_job_id":null,"html_url":"https://github.com/runsidekick/sidekick-client-node","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runsidekick%2Fsidekick-client-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runsidekick%2Fsidekick-client-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runsidekick%2Fsidekick-client-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/runsidekick%2Fsidekick-client-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/runsidekick","download_url":"https://codeload.github.com/runsidekick/sidekick-client-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241863033,"owners_count":20032925,"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":[],"created_at":"2024-11-14T21:10:58.187Z","updated_at":"2025-12-03T08:06:29.239Z","avatar_url":"https://github.com/runsidekick.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\n\n\u003c!-- PROJECT SHIELDS --\u003e\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"30%\" height=\"30%\" src=\"https://4750167.fs1.hubspotusercontent-na1.net/hubfs/4750167/Sidekick%20OS%20repo/logo-1.png\"\u003e\n\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.runsidekick.com/discord-invitation?utm_source=sidekick-readme\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/discord/958745045308174416?style=for-the-badge\u0026logo=discord\u0026label=DISCORD\" alt=\"Sidekick Discord Channel\" /\u003e\u003c/a\u003e\u0026nbsp;\n    \u003ca href=\"https://www.runforesight.com?utm_source=sidekick-readme\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/Monitored%20by-Foresight-%239900F0?style=for-the-badge\" alt=\"Foresight monitoring\" /\u003e\u003c/a\u003e\u0026nbsp;\n    \u003ca href=\"https://app.runsidekick.com/sandbox?utm_source=sidekick-readme\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/try%20in-sandbox-brightgreen?style=for-the-badge\" alt=\"Sidekick Sandbox\" /\u003e\u003c/a\u003e\u0026nbsp;\n    \n\u003c/p\u003e\n\n  \u003ch3 align=\"center\"\u003eSidekick Node.js client\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    Node.js client for Sidekick. Send your Sidekick logs and traces to any target in seconds!\n    \u003cbr /\u003e\n    \u003ca href=\"https://docs.runsidekick.com/\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://www.runsidekick.com\"\u003eSidekick Home\u003c/a\u003e\n    ·\n    \u003ca href=\"https://www.runsidekick.com/contact-us\"\u003eReport Bug \u0026 Request Feature\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-recipe\"\u003eAbout\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#example-usage\"\u003eExample Usage\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About Sidekick\n\nSidekick is a production debugging and on-demand logging tool where you can debug your running applications while they keep on running. Sidekick provides the ability to add logs and put non-breaking breakpoints in your application code which captures the snapshot of the application state, the call stack, variables, etc.\n\nSidekick Actions:\n* A tracepoint is basically a non-breaking remote breakpoint. In short, it takes a snapshot of the variables when the code hits that line.\n* Logpoints open the way for dynamic logging to Sidekick users. Replacing traditional logging with dynamic logging has the potential to lower stage sizes, costs, and time for log searching while adding the ability to add new logpoints without editing the source code, redeploying or restarting the application\n## Client Features\n\n* Sidekick Node Client opens up a new \u0026 headless way to use Sidekick. It allows you to both use custom ingest functions for the tracepoint/logpoint events and put/edit/delete your tracepoints/logpoints easily using code.\n\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n### Built With\n\n* [ws](https://github.com/websockets/ws)\n* [axios](https://github.com/axios/axios)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n### Prerequisites\n\nTested with node v16.14.2\n* npm\n  ```sh\n  npm install npm@latest -g\n  ```\n\n\n\u003c!-- GETTING STARTED --\u003e\n# Getting Started\n\n\n## Installation\n\n1. Install sidekick-client\n   ```sh \n   $ npm i @runsidekick/sidekick-client\n   ```\n\n## Example usage\n\n\n###  Put tracepoint on a line\n  1. Import `SidekickApi`  \n      ```js\n        const { SidekickApi} = require('@runsidekick/sidekick-client')\n      ```\n\n  2. Create an instance from Sidekick Api\n      ```js\n        const apiClient = new SidekickApi({apiKey:\u003cYour Api Key\u003e, apiToken:\u003cYour Account Token\u003e});\n\n      ```\n  3. Create a parameter that contains your file information to put tracepoint.\n      ```js  \n        const params= {\n            applicationFilters: [\n                {\n                  name: \"Demo application\",\n                  version: \"v1.0\",\n                  stage: \"prod\"\n                }\n              ],\n            fileName: \"gitlab.com/repos/...\",\n            lineNo: 23,\n            expireSecs: -1,\n            expireCount: -1,\n            enableTracing: true,\n            persist: true\n      }\n\n      ```\n  4. Call `putTracepoint` function\n      ```js\n        apiClient.putTracepoint(params);\n      ```\n\n  Then your tracepoint will be added to `line 23` in the given file. Also, you can use `SidekickApi` for any other operations such as removing tracepoint or putting log point.\n\n\u003cbr\u003e\n\n\n\n\n### Use custom ingest function for the tracepoint/logpoint events\n\n\n1. Create a `config.json` according to your needs\n   ```js\n    \"SIDEKICK_TRACEPOINT_INDEX\": \"sidekick_tracepoint\",\n    \"SIDEKICK_LOGPOINT_INDEX\": \"sidekick_logpoint\",\n    \"SIDEKICK_EMAIL\": \"\u003cEmail of your sidekick account\u003e\",\n    \"SIDEKICK_PASSWORD\": \"\u003cPassword of your sidekick account\u003e\",\n   ```\n\n\n2. Import `onTrigger` from `@runsidekick/sidekick-client`\n    \n    ```js\n        const { onTrigger } = require('@runsidekick/sidekick-client')\n    ```\n3. Create an `ingest` function that will send collected data to desired target:\n    ```js\n        function ingestFunc (index) {\n            return async function (data) {\n                console.log(JSON.stringify({index,data}));\n            }\n        }\n    ```\n\n4. Initialize Sidekick client info with proper parameters.\n    \n    ```js\n        const clientInfo = {\n            sidekickEmail : config['SIDEKICK_EMAIL'], \n            sidekickPassword : config['SIDEKICK_PASSWORD'], \n            tracepointFunction : ingestFunc(config['SIDEKICK_TRACEPOINT_INDEX']),\n            logpointFunction : ingestFunc(config['SIDEKICK_LOGPOINT_INDEX']),\n            errorSnapshotFunction : ingestFunc(config['SIDEKICK_ERRORSTACK_INDEX'])\n        }\n\n        onTrigger(clientInfo);\n     ```\n\nThen your tracepoint events will be logged. You can customize the `ingest` function as you want.\n\n\n\u003cbr\u003e\n\n  If you have an on-premise setup add the fields below to client object (Optional):\n\n   ```js\n    \"sidekickHost\": \"ws://127.0.0.1\",\n    \"sidekickPort\": \"7777\"\n   ```\n\n  If have your user token you can use it instead of email \u0026 password (Optional):\n\n   ```js\n    \"sidekickToken\": \"\u003c\u003e\"\n   ```\n\n\n \n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- ROADMAP --\u003e\n## Roadmap\n\n- [x] Add websocket support\n- [x] Custom ingest function\n- [x] Add support for programattically putting logpoints \u0026 tracepoints using REST API\n\n\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\u003c!-- CONTACT --\u003e\n## Contact\n\nBarış Kaya - [@boroskoyo](https://twitter.com/boroskoyo)\n\nSidekick: [website](https://www.runsidekick.com)\n\n## Special Thanks\nEmin Bilgiç - [linkedin](https://www.linkedin.com/in/eminbilgic/)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunsidekick%2Fsidekick-client-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunsidekick%2Fsidekick-client-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunsidekick%2Fsidekick-client-node/lists"}