{"id":19361985,"url":"https://github.com/numaproj/numaflow-js","last_synced_at":"2026-03-19T09:28:00.198Z","repository":{"id":233876429,"uuid":"741840763","full_name":"numaproj/numaflow-js","owner":"numaproj","description":"Numaflow Node.js SDK","archived":false,"fork":false,"pushed_at":"2024-01-11T08:14:13.000Z","size":4,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-06T19:50:08.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/numaproj.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-11T08:14:12.000Z","updated_at":"2024-12-11T00:19:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"362d31d4-b2c3-422c-af78-7458bae3240a","html_url":"https://github.com/numaproj/numaflow-js","commit_stats":null,"previous_names":["numaproj/numaflow-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numaproj%2Fnumaflow-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numaproj%2Fnumaflow-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numaproj%2Fnumaflow-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numaproj%2Fnumaflow-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numaproj","download_url":"https://codeload.github.com/numaproj/numaflow-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240482166,"owners_count":19808629,"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-10T07:26:09.117Z","updated_at":"2026-03-19T09:28:00.190Z","avatar_url":"https://github.com/numaproj.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Numaflow-JS\n\nNumaflow-JS is an SDK for [Numaflow](https://numaflow.numaproj.io/) that provides the interfaces in JavaScript/TypeScript to implement different types of data processing tasks that Numaflow supports.\n\nCurrently, these include:\n\n- [Map UDF](https://numaflow.numaproj.io/user-guide/user-defined-functions/map/map/)\n    - [Streaming mode](https://numaflow.numaproj.io/user-guide/user-defined-functions/map/map/#streaming-mode)\n    - [BatchMap mode](https://numaflow.numaproj.io/user-guide/user-defined-functions/map/map/#batch-map-mode)\n- [Reduce UDF](https://numaflow.numaproj.io/user-guide/user-defined-functions/reduce/reduce/)\n    - [Accumulator](https://numaflow.numaproj.io/user-guide/user-defined-functions/reduce/windowing/accumulator/)\n    - [Session](https://numaflow.numaproj.io/user-guide/user-defined-functions/reduce/windowing/session/)\n    - [Fixed](https://numaflow.numaproj.io/user-guide/user-defined-functions/reduce/windowing/fixed/)\n    - [Sliding](https://numaflow.numaproj.io/user-guide/user-defined-functions/reduce/windowing/sliding/)\n- [UD Sink](https://numaflow.numaproj.io/user-guide/sinks/user-defined-sinks/)\n- [UD Source](https://numaflow.numaproj.io/user-guide/sources/user-defined-sources/)\n- [Source Transform](https://numaflow.numaproj.io/user-guide/sources/transformer/overview/)\n- [Side Input](https://numaflow.numaproj.io/user-guide/reference/side-inputs/)\n\nThis SDK is powered by [Numaflow Rust SDK](https://github.com/numaproj/numaflow-rs) through [napi.rs](https://napi.rs/) to interact with Numaflow.\n\n## Installation\n\nReplace `npm` with your favourite package manager (`pnpm`, `yarn`, etc.) in the following command to install the SDK.\n\n```bash\nnpm install @numaproj/numaflow-js\n```\n\n## Examples\n\nThe examples are available in the [examples](https://github.com/numaproj/numaflow-js/tree/main/examples) directory.\nThe examples presented provide a basic overview of how to implement different types of data processing tasks using\nNumaflow-JS.\nEach example focuses implementing and building one specific component of Numaflow.\n\nMost of the examples follow a similar structure:\n\n- `Dockerfile`: Contains the instructions to build the Docker image for the example.\n- `Makefile`: Contains helper commands to build the Docker image\n- `README.md`: Provides details on implementing the concerned type of component and instructions to run the specific example.\n- `\u003cexample-name\u003e.ts`: Contains the TypeScript implementation of the example.\n- `\u003cexample-pipeline\u003e.yaml`: Contains the pipeline configuration which uses the image built from the specific example.\n\nIn the implementation part of all the examples presented, i.e. in `\u003cexample-name\u003e.ts`, the pattern is mostly similar.\nWe need to instantiate and start an async server for the respective component being implemented.\n\n## Implementation details with examples\n\nEg: Implementing UD sink component:\n\n- To implement a UD sink need to use `sink.AsyncServer`.\n- To instantiate the server, we need to provide a function `sinkFn` with a signature satisfying `AsyncServer` constructor.\n- Start the server using `start` method of `AsyncServer`.\n- Stop the server using `stop` method of `AsyncServer`.\n\nCurrently, `source` and `session-reduce` components require implementing all methods of an interface and passing an instance\nof the same to their respective async server constructors. Rest of the components only require implementing a function with a signature\nsatisfying the constructor of the async server.\n\nFollowing are the different ways to implement a function with a signature satisfying the constructor of the async server:\n\n1. Using an arrow function \u003cbr\u003e\n   If the function is small and simple, we can use an arrow function.\n\n```typescript\nconst sinkFn = (message: Message) =\u003e {\n    console.log(message)\n}\n\nconst server = new sink.AsyncServer(sinkFn)\n```\n\nStill works if defined as part of a class.\n\n```typescript\nclass Sink {\n    counter = 0\n    sinkFn = (message: Message) =\u003e {\n        this.counter++\n        console.log(this.counter, message)\n    }\n}\n\nlet sinker = new Sink()\nconst server = new sink.AsyncServer(sinker.sinkFn)\n```\n\n2. Using a named function \u003cbr\u003e\n\nSimple named functions work the same way.\n\n```typescript\nfunction sinkFn(message: Message) {\n    console.log(message)\n}\n\nconst server = new sink.AsyncServer(sinkFn)\n```\n\nNamed functions defined as part of a class may need to be bound to the instance of the class.\n\n```typescript\nclass Sink {\n    counter = 0\n    sinkFn(message: Message) {\n        this.counter++\n        console.log(this.counter, message)\n    }\n}\n\nlet sinker = new Sink()\nconst server = new sink.AsyncServer(sinker.sinkFn.bind(sinker))\n```\n\nIf any of the examples are failing to build or if they need further clarification, please create an [issue](https://github.com/numaproj/numaflow-js/issues/new/choose) to fix the same.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumaproj%2Fnumaflow-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumaproj%2Fnumaflow-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumaproj%2Fnumaflow-js/lists"}