Frontend Development 20 min read

How iMove Turns Complex Front‑End Logic into Visual Flowcharts and Ready‑to‑Use Code

This article introduces the open‑source iMove tool, explains why front‑end development faces UI volatility, tangled logic and combined interfaces, and shows how iMove’s visual flow‑chart editor, low‑code node functions, online and local compilation, and automatic npm dependency parsing enable reusable, maintainable, language‑agnostic front‑end solutions.

Taobao Frontend Technology
Taobao Frontend Technology
Taobao Frontend Technology
How iMove Turns Complex Front‑End Logic into Visual Flowcharts and Ready‑to‑Use Code

Why Front‑End Development Is Hard

The author points out three major pain points: constantly changing UI that forces developers to keep up, logic challenges where much backend processing lives in the front‑end, and combined interfaces caused by historical reasons that lead to a lack of a Node BFF layer.

Introducing iMove

iMove is an open‑source project that quickly rose to the top of GitHub’s trending list with over 280 stars, proving its relevance to developers. It aims to solve the above problems by providing a non‑intrusive tool where developers can double‑click a node, write a function, export executable code, and test it with a right‑click, achieving low‑code development.

Core Concepts of iMove

Logic Reusability : Interfaces and UI can be reused at the smallest granularity.

Flow Visualization : Reusable units are arranged as a flowchart, simplifying operations.

Operation Config Convergence : Multiple systems are unified to reduce operational cost.

Gameplay Capability Accumulation : Product features become reusable capabilities.

For developers, iMove lets you write node functions, export the code, and drop it into any project with a single mouse click.

What Is iMove?

It is a non‑intrusive tool.

Double‑click to write a function; the arranged flow can be exported as executable code.

Testing is easy – right‑click to run the node.

It enables low‑code development where functionality is built like operation configuration.

Example: Purchase Button Logic

The article presents a scenario where a detail‑page purchase button must handle various states (already couponed, needs follow‑shop, needs membership, etc.). The following pseudo‑code demonstrates the logic:

<code>// Check login
const checkLogin = () => {
  return requestData('/is/login').then(res => {
    const { isLogin } = res || {};
    return isLogin;
  }).catch(() => false);
};

// Fetch detail data
const fetchDetailData = () => {
  return requestData('/get/detail/data').then(res => {
    const { hasApplied, needFollowShop, needAddVip } = res;
    if (hasApplied) {
      setStatus('hasApplied');
    } else {
      if (needFollowShop) {
        setStatus('needFollowShop');
      } else if (needAddVip) {
        setStatus('needAddVip');
      } else {
        setStatus('exception');
      }
    }
  }).catch(() => setStatus('exception'));
};

checkLogin().then(isLogin => {
  if (isLogin) {
    return fetchDetailData();
  } else {
    goLogin();
  }
});</code>

This example shows how iMove can encapsulate complex business logic into visual nodes, making the code easier to read and maintain.

Readability and Maintainability

iMove’s flow visualization acts as natural code annotation, offering a clearer view than PRD text or raw source code.

Application Scenarios

Front‑end flow (e.g., click events, component lifecycle).

Back‑end flow (Node.js or Serverless).

Combined front‑end + back‑end flow (click event → Ajax request → API).

Advantages of iMove

Logic Reusability : Nodes can be packaged as reusable functions and imported across projects.

Function‑Oriented : Each node exports a plain JavaScript function, requiring only basic JS knowledge.

Flow Visualization : Logic is expressed as a DAG, providing “logic orchestration”.

Logic/UI Decoupling : Business logic and UI are separated, allowing multiple UI versions while keeping a single logic layer.

Simple Testing : Browser‑side node execution lets developers mock inputs without a test framework.

Language/Scene Agnostic : Although iMove is a JavaScript library, it can compile flows for JavaScript, Java, or other languages depending on the target.

iMove Architecture

iMove is built on the X6 engine for drawing DAGs. Nodes represent functions, edges represent data flow, and the entire diagram can be exported as a JSON DSL. The DSL is parsed to generate a set of node files, which are then executed according to the upstream‑downstream relationships.

Building a Drawable Flowchart App

Using X6 (which works with any framework) developers can quickly create a flowchart UI. X6 provides ready‑made interaction components and a simple API for custom nodes.

Compiling Flowcharts to Code

iMove supports two compilation modes:

Online compilation : Generates a ZIP package in the browser using

jszip

and

file‑saver

for download.

Local compilation : Uses a

watch

command that listens for flowchart save events (via

socket.io

or an HTTP server) and recompiles code in real time.

Example of the generated file structure:

<code>{
  "nodeFns": {
    "node1.js": "...",
    "node2.js": "...",
    "index.js": "..."
  },
  "context.js": "...",
  "dsl.json": "...",
  "index.js": "...",
  "logic.js": "..."
}</code>

Running Compiled Code

Two core problems are solved:

Executing nodes in the order defined by the flowchart.

Handling data flow between nodes.

Four data access patterns are provided:

config : read‑only node configuration.

payload : read‑only value passed when invoking logic.

pipe : output of the previous node becomes input of the next.

context : read‑write shared data accessible via

setContext

and

getContext

.

The flow model is a directed acyclic graph (DAG) where each node is a function, ports map to function arguments/returns, and links define data movement. Execution starts from the end node, builds a stack of dependent nodes, and runs them sequentially, caching results when possible.

Online Node Execution

iMove can run node code directly in the browser, handling both ESM and CJS modules, and supports multi‑node execution. It relies on

http‑import

to fetch npm packages on demand.

Automatic npm Dependency Parsing

iMove parses

import

statements with regular expressions, then uses the

npm view

API (or its network equivalent) to resolve the latest package versions automatically, eliminating manual dependency entry.

Conclusion

While design‑to‑code tools like imgcook address UI changes, iMove tackles the logical side, offering a visual, low‑code workflow that improves readability, reusability, and maintainability for front‑end developers. Its slogan—“Move your mouse, generate code from flow chart”—captures its core value, and the project welcomes community contributions.

FrontendJavaScriptworkflowLow-codevisual programmingiMove
Taobao Frontend Technology
Written by

Taobao Frontend Technology

The frontend landscape is constantly evolving, with rapid innovations across familiar languages. Like us, your understanding of the frontend is continually refreshed. Join us on Taobao, a vibrant, all‑encompassing platform, to uncover limitless potential.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.