API Reference
The Moldo backend exposes a REST API on http://127.0.0.1:8000 by default.
All request and response bodies are JSON unless stated otherwise.
GET /health
Health check. Used by the editor to show the connection status indicator.
Response
POST /run
Compile and execute a JSON program tree.
Request body
| Field | Type | Description |
|---|---|---|
version |
string | Protocol version - always "1.0" |
molds |
string[] | List of mold names used in this program |
program |
object | Root node of the program tree - see Protocol |
Success response
Error response
highlights contains the IDs of nodes that were reached before the error occurred. The editor uses these to animate execution.
GET /molds
List all installed molds - built-ins and community molds alike.
Response - array of manifest objects
[
{
"name": "variables",
"displayName": "Variables",
"version": "1.0.0",
"isCore": true,
"blocks": [ ... ]
},
{
"name": "webscraper",
"displayName": "Web Scraper",
"version": "1.2.0",
"isCore": false,
"blocks": [ ... ]
}
]
POST /molds/install
Upload and install a .zip.mold package.
Request - multipart/form-data
| Field | Type | Description |
|---|---|---|
file |
file | The .zip.mold file |
Success response
{
"ok": true,
"manifest": {
"name": "webscraper",
"displayName": "Web Scraper",
"version": "1.2.0",
"blocks": [ ... ]
}
}
Error response
What happens during install
- The zip is extracted to
moldo/installed/<name>/ moldo.jsonis validated (must be present and parseable)pip install -r requirements.txtis run (ifrequirements.txtexists)- The manifest is registered in the in-memory mold registry
- The manifest is returned so the frontend can register the blocks immediately
DELETE /molds/{name}
Uninstall a community mold.
Path parameter - name: the mold's machine identifier (e.g. webscraper)
Success response
Error responses
{ "ok": false, "error": "Mold 'webscraper' not found" }
{ "ok": false, "error": "Cannot uninstall core mold 'variables'" }
Core molds (built-ins) cannot be uninstalled.
Running on a different port
Update const BACKEND in mflow-editor/index.html to match.
CORS
The server allows all origins (*) so the editor (which loads as a file:// URL in Electron) can reach it without CORS errors.
Do not expose to the network
The /run endpoint executes arbitrary Python code. Keep the backend bound to 127.0.0.1. Do not expose it on 0.0.0.0 or forward port 8000 through a firewall.