Getting Started
Requirements
- Python 3.10 or later
- Node.js 18 or later (for the visual editor)
1. Install the backend
2. Start the backend server
You should see:
Confirm it is healthy:
3. Open the editor
Download and open mflow-editor from the releases page.
Or run it from source:
The toolbar shows a green dot when the editor has successfully connected to your backend.
4. Build your first program
Let's print the numbers 1 to 5.
- In the sidebar, expand Variables and drag a Declare Variable block onto the canvas. Set
name = i,type = int,value = 1. - Expand Control and drag a While Loop block. Set
left = @i,op = <=,right = 5. - Expand I/O and drag a Print block. Set
value = @i. Connect it as the loop body. - Expand Variables and drag a Modify Variable block. Set
name = @i,op = +,operand = 1. Connect it after Print inside the loop body. - Press Run.
The output panel shows:
Compile a flow to Python
After building a program in the editor, export it from File > Export and compile it from the terminal:
moldo myprogram.json # print generated Python to stdout
moldo -c myprogram.json -o myprogram.py # write to a file
python myprogram.py # run it standalone
See the CLI Reference for all options.
Development mode
Run the backend with auto-reload (restarts on file changes):
Run the editor with the Node.js inspector:
Troubleshooting
Editor shows red dot / "backend offline"
: The backend is not running or not reachable at http://127.0.0.1:8000. Check that moldo serve is running and that no firewall is blocking localhost.
ModuleNotFoundError: No module named 'moldo'
: Run pip install -e . inside the moldo directory (with your virtualenv active).
Port 8000 already in use
: uvicorn moldo.api.server:app --port 8001 and update const BACKEND in index.html to match.