Netty Python Node Engine: Project README This platform is a high-performance, real-time remote code execution engine that allows users to build logic visually and execute it instantly in a secure Python sandbox.

Overview: The system provides a seamless bridge between visual node-based programming and raw code execution. Users drag and drop nodes to define logic, which is then compiled into Python and streamed to a high-concurrency Java backend that manages isolated Docker environments.

Architecture: The system is built as a polyglot monorepo comprising four main pillars:

  1. Visual Frontend (React & React Flow) Node Editor: Powered by @xyflow/react, providing a modern drag-and-drop canvas for logical orchestration.

Integrated Code Editor: A high-performance editor built with CodeMirror that supports Python syntax highlighting and real-time code injection from the visual graph.

Streaming Console: A terminal-style output window that renders stdout and stderr streams directly from the remote execution context.

  1. Graph-to-Code Compiler (TypeScript) Topological Mapping: Traces connections between nodes to determine execution order.

AST Generation: Translates visual nodes into a valid Python script, injecting global state and utility functions on the fly.

Safety Layer: Implements optional chaining and null checks to ensure that disconnected or incomplete graphs do not crash the compilation process.

  1. Execution Engine (Java Netty) Non-Blocking I/O: Leverages the Netty framework to handle hundreds of simultaneous WebSocket connections with minimal overhead.

Protocol Upgrade: Dynamically upgrades standard HTTP requests to WebSockets for raw TCP-level streaming between the browser and the server.

Raw Process Piping: Uses RawDockerExecHandler to pipe WebSocket frames directly into the standard input/output of a running Docker process, achieving near-zero latency.

  1. Isolated Sandbox (Docker & Python) Dynamic Orchestration: DockerOrchestrator manages the lifecycle of "warm" worker containers to ensure instant execution without boot-time delays.

Environment Isolation: Each execution occurs in a strictly controlled container, preventing untrusted code from accessing the host server.

Pre-configured Workers: A custom Python environment tailored for rapid execution of generated scripts.

Tech Stack: Frontend: React, TypeScript, Tailwind CSS, Shadcn UI, React Flow, CodeMirror.

Compute Engine: Java 23, Netty 4.1, Docker SDK.

Orchestration: Docker Compose.

Backend Services: Node.js (Express), MongoDB.

Key Technical Achievements: Streaming Execution: Unlike standard platforms that wait for a script to finish, this engine streams output line-by-line as it happens.

Warm Sandbox Model: Reduces execution latency by maintaining a pre-warmed pool of sandbox containers.

Stateless Compiler: The frontend compiler generates self-contained scripts, making the entire pipeline highly scalable.

Drafted for the Netty Python Node Engine project.

Built With

  • codemirror.-compute-engine:-java-23
  • docker
  • netty-4.1
  • react-flow
  • shadcn-ui
  • tailwind-css
  • typescript
Share this project:

Updates