FBPX Runtime
FBPX Runtime
The runtime package, @fbpx/runtime, executes FBPX flows and exposes them over the FBP protocol — the wire protocol used by FlowHub and other FBP tooling. It ships the fbpx-server binary, supports fbp-protocol, and stays compatible with noflo-nodejs.
There are two ways to run a flow:
- In process —
fbpx runexecutes a.fbpfile directly. This is the everyday path for running a graph from the CLI. - As a server —
fbpx-serverstarts a runtime process that connects to a UI over websockets and accepts FBP protocol commands to load, start, and stop graphs.
Running a flow programmatically
The same runtime is a library. You create a flow from a definition, load its nodes through a provider, and run it:
const {Flow} = require('@fbpx/flow')
const {FSLoader} = require('@fbpx/loader-fs')
const loader = new FSLoader({cache: false})
await loader.load(flowDefinition)
const flow = await Flow.create('my-flow', flowDefinition, loader)
await flow.run()
The loader pre-resolves the node definitions so Flow.create can wire them; for local files the provider line in the .fbp file tells the loader where to look. The API section covers the runtime structures in detail.
The server
fbpx-server exposes one or more graphs over the FBP protocol. Installation and tests:
npm install
npm test
Usage:
Usage: fbpx-server [options] <file ...>
Options:
-h, --help output usage information
-V, --version output the version number
-t, --type [name] Runtime type fbpx, noflo-nodejs (default: fbpx-nodejs)
-c, --cache cache components
-x, --compat stay compatible with noflo format
-p, --proxy expose /proxy to proxy requests to e.g. a browser
-r, --proxy-server [url] proxy nodejs runtime
-s, --secure secure wss or ws
-S, --secret secret to be send with each request to the runtime
-n, --start start graph immediately (now)
-u, --uppercase force ports uppercase
-h, --host [name] hostname
-p, --port [name] port
-I, --no-ids do not use uuids
-b, --bail bail on errors
-i, --interface [name] choose a webserver interface
-l, --loader [loader] loader `remote` or `npm` (default: npm)
-L, --loglevel [level] Log level
-f, --flowhub ping flowhub
-v, --verbose verbose output
-C, --create-cert Create SSL certificate for websocket host.
The same runtime executes a graph in a browser or a server, and the FBP protocol is how a UI drives it. For how flows themselves are written — nodes, links, streams, and control — see the language section.