{"id":19438119,"url":"https://github.com/noflo/noflo-nodejs","last_synced_at":"2025-07-17T03:08:12.372Z","repository":{"id":14254548,"uuid":"16962074","full_name":"noflo/noflo-nodejs","owner":"noflo","description":"Command-line tool for running NoFlo programs on Node.js","archived":false,"fork":false,"pushed_at":"2024-04-08T15:39:17.000Z","size":340,"stargazers_count":92,"open_issues_count":17,"forks_count":37,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-06-30T07:58:35.139Z","etag":null,"topics":["cli-app","fbp-runtime","nodejs","noflo"],"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/noflo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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}},"created_at":"2014-02-18T20:08:18.000Z","updated_at":"2024-12-21T15:48:32.000Z","dependencies_parsed_at":"2024-06-18T16:54:10.632Z","dependency_job_id":"9c7ec863-516e-4b3c-8d43-fadd59919baf","html_url":"https://github.com/noflo/noflo-nodejs","commit_stats":{"total_commits":399,"total_committers":9,"mean_commits":"44.333333333333336","dds":"0.49122807017543857","last_synced_commit":"ea8cc7c7d5d76152aeb9bc394293358d7cdb6f48"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/noflo/noflo-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noflo","download_url":"https://codeload.github.com/noflo/noflo-nodejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-nodejs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265562266,"owners_count":23788497,"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":["cli-app","fbp-runtime","nodejs","noflo"],"created_at":"2024-11-10T15:16:59.937Z","updated_at":"2025-07-17T03:08:12.352Z","avatar_url":"https://github.com/noflo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Command-line tool for running NoFlo programs on Node.js\n=================================\n\nThis tool is designed to be used together with the [NoFlo UI](https://app.noflojs.org/) development environment\nfor running [NoFlo](http://noflojs.org/) networks on [Node.js](http://nodejs.org/). This tool runs your\nNoFlo programs, and provides a [FBP Protocol](https://flowbased.github.io/fbp-protocol/) interface over\neither WebSockets or WebRTC to tools like NoFlo UI and fbp-spec.\n\nThis enables inspection of the state of the running NoFlo program, as well as live editing of the graph\nand components of your project.\n\n## Prepare a project folder\n\nStart by setting up a local NoFlo Node.js project. For example:\n\n```shell\n$ mkdir my-project\n$ cd my-project\n$ npm init\n$ npm install noflo --save\n$ npm install noflo-nodejs --save\n```\n\nContinue by installing whatever [NoFlo component libraries](https://www.npmjs.com/browse/keyword/noflo) you need, for example:\n\n```shell\n$ npm install noflo-core --save\n```\n\nIf you want, this is a great time to push your project to [GitHub](https://github.com/).\n\n## Starting the runtime\n\nOnce you have installed the runtime, it is time to start it:\n\n```shell\n$ npx noflo-nodejs\n```\n\nThis will start a WebSocket-based NoFlo Runtime server. When started, it will output an URL with the connection details needed by NoFlo UI.\n\nCopy paste this URL into the browser. The NoFlo UI IDE will open, and automatically connect to your runtime.\nTo make changes hit 'Edit as Project'. You should be able to see available components and build up your system.\n\n## Starting an existing graph\n\nIf you want to run an existing graph, you can use the `--graph` option.\n\n```shell\nnoflo-nodejs --graph graphs/MyMainGraph.json\n```\n\nIf you want the process to exit when the network stops, you can pass `--batch`.\n\n## Typical project setup\n\nIn most Node.js projects there will be three different setups you might want to have with NoFlo: development, testing, and production. Each of these can be easily expressed via NPM scripts in `package.json`:\n\n```json\n{\n  \"name\": \"my-project\",\n  \"scripts\": {\n    \"dev\": \"noflo-nodejs --host localhost --auto-save --graph ./graphs/MyGraph.json\",\n    \"test\": \"fbp-spec --secret test --address ws://localhost:3333 --command 'noflo-nodejs --port 3333 --capture-output --secret test --open false' spec/\",\n    \"start\": \"noflo-nodejs --protocol webrtc --graph ./graphs/MyGraph.json\"\n  },\n  \"dependencies\": {\n    ...\n  },\n  ...\n}\n```\n\nWith this setup you get the following:\n\n* By running `npm run dev`, noflo-nodejs will start your projects' main graph and open the NoFlo UI IDE in your browser. Any changes you make in NoFlo UI will be persisted on your local hard drive\n* By running `npm test`, [fbp-spec](https://github.com/flowbased/fbp-spec) will start a noflo-nodejs instance, connect to it, and run all of your local fbp-spec tests\n* By running `npm start`, noflo-nodejs starts your program, enabling remote debugging via the WebRTC protocol\n\n## Host address autodetection for WebSockets\n\nBy default `noflo-nodejs` will attempt to autodetect the public hostname/IP of your system.\nIf this fails, you can specify `--host myhostname` manually.\n\n## Securing the WebSocket connection\n\nThe noflo-nodejs runtime can be secured using TLS. Place the key and certificate files somewhere that noflo-nodejs can read, and then start the runtime with the `--tls-key` and --tls-cert` options.\n\nFor example, to use self-signed keys, you could do the following:\n\n```shell\n$ openssl genrsa -out localhost.key 2048\n$ openssl req -new -x509 -key localhost.key -out localhost.cert -days 3650 -subj /CN=localhost\n$ noflo-nodejs --tls-key=localhost.key --tls-cert=localhost.cert\n```\n\nNote: browsers may refuse to connect to a WebSocket with a self-signed certificate by default. You can visit the runtime URL with your browser first to accept the certificate before connecting to it in the IDE.\n\n## Peer-to-peer WebRTC connections\n\nIf you want to use a peer-to-peer WebRTC connection instead of WebSockets, start `noflo-nodejs` with the argument `--protocol webrtc`.\n\nWhile slightly more complex and slower to start, WebRTC has some advantages over WebSockets:\n\n* Peer-to-peer connections can (sometimes) work through firewalls\n* No need for setting up TLS to secure communications between the runtime and the client\n\nBy default noflo-nodejs uses [Flowhub's](https://flowhub.io) signalling server for negotiating the connection details between runtime and clients. You can supply a different [RTC Switchboard](https://github.com/rtc-io/rtc-switchboard) instance with the `--signaller` option.\n\n## Debugging\n\nnoflo-nodejs supports [flowtrace](https://github.com/flowbased/flowtrace) allows to trace \u0026 store the execution of the FBP program,\nso you can debug any issues that would occur. Specify `--trace` to enable tracing.\n\n```shell\n$ noflo-nodejs --graph graphs/MyMainGraph.json --trace\n```\n\nIf you are running in `--batch` mode, the file will be dumped to disk when the program terminates.\nOtherwise you can send the `SIGUSR2` to trigger dumping the file to disk.\n\n```shell\n$ kill -SIGUSR2 $PID_OF_PROCESS\n... Wrote flowtrace to: .flowtrace/1151020-12063-ami5vq.json\n```\n\nYou can now use various flowtrace tools to introspect the data.\nFor instance, you can get a human readable log using `flowtrace-show`\n\n```shell\n$ npx flowtrace-show .flowtrace/1151020-12063-ami5vq.json\n\n-\u003e IN repeat CONN\n-\u003e IN repeat DATA hello world\n-\u003e IN stdout CONN\n-\u003e IN stdout DATA hello world\n-\u003e IN repeat DISC\n-\u003e IN stdout DISC\n```\n\n## Signalling aliveness\n\n`noflo-nodejs` will ping Flowhub registry periodically to signal aliveness to IDE users. To disable this behavior, set `--registry-ping 0`.\n\n## Persistent runtime configuration\n\nSettings can be loaded from a  `flowhub.json` file.\nBy default the configuration will be read from the current working directory,\nbut you can change this by setting the `PROJECT_HOME` environment variable.\n\nThis file will be automatically saved when you run noflo-nodejs, meaning that settings like runtime ID and secret will be persisted between runs.\n\nEnvironment variables and command-line options will override settings specified in config file.\n\nSince the values are often machine and/or user specific, you usually don't want to add this file to version control.\n\n## Embedding runtime in an existing service\n\nIn addition to running noflo-nodejs as a command-line program that starts and runs your NoFlo graphs, you can embed it into an existing Node.js application. Here is a quick example how to do it:\n\n```javascript\nconst runtime = require('noflo-nodejs');\n\n// This function returns a Promise that resolves when the NoFlo runtime has started up\nstartRuntime(graphPath, options = {}) {\n  // Configure noflo-nodejs. Options here map roughly to the standard command-line arguments\n  const settings = {\n    id: '9f1432b1-a259-454a-bb67-e9d91525cc63', // Set an unique UUID for your application instance\n    label: 'My cool app',\n    baseDir: __dirname,\n    host: 'localhost',\n    port: 3569,\n    ...options,\n  };\n  return runtime(graphPath, settings);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoflo%2Fnoflo-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoflo%2Fnoflo-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoflo%2Fnoflo-nodejs/lists"}