š” The Problem: The Import / Glue Code Headache
A while ago, I was practicing importing modules across different projects. I wanted to use Python for its rich data science libraries and Node.js for its async web performance.
Normally, if you want Python to pass a simple calculated array or dictionary to JavaScript, you have to:
- Spin up a local FastAPI / Flask server or write to a temporary JSON file.
- Setup
fetch()in Node.js, handle ports, serialization, and CORS. - Write 50+ lines of glue code just to share a single variable.
Coming from a visual block-coding mindset (where you snap blocks together and data flows naturally), I thought:
"Why can't I just write
<py>and<js>in the exact same file, and let the variables flow automatically?"
So I built Block Engine.
ā” How Block Works
In Block, you write native language blocks separated by tags (<py>, <js>, <lua>, <php>, <server>).
The underlying orchestrator (built with high-performance C# / .NET) automatically serializes and injects variables across runtime boundaries via an in-memory State Pipeline:
<py>
# Python stage: Prepare initial dataset
user = "O-O1112"
dataset = [10, 20, 30, 40, 50]
print(f"[Python] Loaded {len(dataset)} items for {user}")
</py>
<js>
// Node.js stage: High-performance aggregation
const avg = dataset.reduce((a, b) => a + b, 0) / dataset.length;
console.log(`[Node.js] Computed average: ${avg}`);
var bonus = 50;
</js>
<lua>
-- Lua stage: Lightning-fast validation
final_score = avg + bonus
print("[Lua] Final Computed Score: " .. tostring(final_score))
</lua>
šÆ Running it:
block demo.blkp
Output:
[Python] Loaded 5 items for O-O1112
[Node.js] Computed average: 30
[Lua] Final Computed Score: 80.0
ā State Pipeline synchronized across 3 runtimes in 320ms.
š Key Features
- Zero-Glue State Pipeline: Variables declared in Python are instantly accessible in JS and Lua without manual JSON parsing.
-
Native Ecosystem Compatibility: Direct access to your existing host
pip,npm, andluarockslibraries. -
Zero-Install NPX Execution: You can run any
.blkpfile directly in terminal without manual installer setup:
npx block-engine-runner demo.blkp
-
Modular Imports: Supports
<import src="modules/data.blk" />and custom runtime definitions with<define lang="sim" cmd="node" />. - Open Source: Released under the MIT license.
š Links & Resources
- GitHub Repository: https://github.com/O-O1112/Block_io
-
NPM Package:
block-engine-runner/block-installer-ui - Official Discord Community: https://discord.gg/VeB44CD5y3
I would love to hear feedback and thoughts from the DEV community on this state-pipeline approach! What languages would you like to see chained next?
Top comments (1)
The multi-language single-file idea is interesting because it attacks setup friction directly. The risk is making execution rules feel implicit. I would want very visible boundaries around runtime, dependencies, and file access so a convenient block does not become surprising behavior.