Skip to content

Web UI — Visual Pipeline Editor ​

The apps/webui/ directory contains a browser-based node editor for building and running foreblocks forecasting pipelines without writing code. Nodes represent pipeline stages; edges connect outputs to inputs. Execution happens on a local FastAPI backend that streams progress back to the browser via WebSocket.

This is a local, self-hosted tool (start it with foreblocks-studio or python server.py against your own Python environment) — it is not the interactive demo published at /studio/ on the docs site. That public playground is a separate, static, client-side-only app built from apps/studio/ (see its README).

Starting the server ​

bash
cd apps/webui
npm install         # first time only
npm run build       # compile the React frontend into dist/
python server.py    # starts on http://localhost:8000
bash
pip install fastapi uvicorn torch matplotlib
text
Browser (React + ReactFlow)
  ↓  POST /execute  (generated Python code + workflow graph)
FastAPI server  →  ThreadPoolExecutor worker
  ↓  WebSocket /ws/{task_id}  (live events)
Browser receives: logs, progress, node results, artifacts
  • sync=false (default): returns immediately with a task_id; poll or subscribe via WebSocket for results
  • sync=true: waits up to timeout_sec and returns inline results if finished in time

Response:

json
{"success": true, "task_id": "uuid4", "results": null}

States: queued → running → success | error

GET /logs/{task_id} ​

Retrieve timestamped execution logs.

json
{"task_id": "...", "logs": ["[10:42:01] ⏳ Starting execution", ...]}

set_result(node_id, result_type, data) — node_id should match the node's ID in the workflow graph. result_type is one of the type strings from the table above.

Auto-detection fallback ​

If user code does not call report.set_result(), the backend attempts automatic result extraction by looking for these variables in the execution namespace:

VariableAction
trainer, X_val, Y_valCalls trainer.metrics(X_val, Y_val) and trainer.plot_prediction(...)
metricsAttaches as metrics result on the output node
time_series, train_sizePassed to plot_prediction as full_series / offset

Environment injected into user code ​

NameValue
torchimport torch
reportReportBridge instance for the current task
__name__"__main__"

numpy, matplotlib.pyplot, and matplotlib (Agg backend) are imported inside the worker before exec() but are not injected into the namespace by default — import them explicitly in your code if needed.

MIT License