Complete Guide: Creating Custom Modules (UDF) in Flowork OS

Published on

Complete Guide: Creating Custom Modules (UDF) in Flowork OS

Welcome to the official documentation and advanced technical guide for Flowork Neural Builder. This article is designed as a comprehensive reference (masterclass) for developers, automators, and system architects looking to maximize the potential of Flowork OS by creating Custom Modules or *User-Defined Functions* (UDF).

In this extensive guide, we will dissect in depth what Flowork OS is, how Edge and Client-Side computing architectures work, and provide a step-by-step process for assembling your own custom JavaScript modules from scratch into ready-to-use drag-and-drop nodes.

CHAPTER 1: Understanding the Flowork OS Ecosystem

Before we dive into writing code, it is crucial to understand the philosophy and underlying architecture of the platform you are using.

1.1 What is Flowork OS?

Flowork OS is not just a traditional visual workflow builder. Generally, automation platforms like Zapier, Make (Integromat), or n8n rely heavily on heavy backend servers (Node.js/Python) to execute every node or logic module. This results in latency (time lag), ballooning server costs, and data privacy concerns because your payload must traverse third-party servers.

Flowork OS breaks these boundaries by introducing an Edge-Native and Client-Side Execution architecture. Built on a Vue.js foundation and hosted via Cloudflare Pages' infrastructure—spread across hundreds of data centers worldwide—Flowork OS shifts the computational load directly to the user's browser (your local RAM and CPU) or to the Edge network closest to your location.

Advantages of This Architecture:

1. Zero-Latency Execution: Module execution (such as data transformation, mathematical calculations, or text formatting) happens in milliseconds because it is executed directly by the JavaScript Engine (V8) in your browser. 2. Privacy by Design: Your sensitive data is never stored or processed on our servers. All logic execution happens locally. 3. Decentralized Resources: There is no server downtime due to high traffic loads, as every user's browser acts as its own execution "server."

1.2 The Concept of Dynamic Edge Modules (User-Defined Functions)

By default, Flowork Neural Builder provides various built-in (system) modules such as HTTP Request, Telegram Trigger, Webhook, and more. However, the needs of every business or developer are unique and specific. It is impossible for Flowork's core developers to provide millions of modules for every possible API or business logic in the world.

Therefore, we created the Custom Module feature. This feature allows you—without needing deployment processes, GitHub pushes, or server builds—to write your own backend logic directly within the browser.

How does it work technically?

Flowork utilizes an On-The-Fly Compiler technique. When you write raw JavaScript code (as text/string) in the module builder interface, the *FlowRunner* engine (the brain of Flowork) uses JavaScript's built-in `new AsyncFunction()` constructor. This technique dynamically injects, compiles, and transforms your code text into a native asynchronous function that runs in memory (RAM) instantly. This makes Flowork more than just a standard web app; it is a *Platform as a Service (PaaS)* running purely in a client environment.

---

CHAPTER 2: Anatomy and Creation of Custom Modules

Now that you understand the power behind the scenes, let's start building your first custom module.

2.1 Accessing the "Build Module" Interface

The module creation process does not require additional app installations or third-party IDEs (Integrated Development Environments). Everything is integrated within the Flowork Workspace.

1. Open the Flow Designer dashboard in your web application. 2. Look at the main navigation menu (Header) at the top of the screen. Among the action buttons (such as Import, Export, Share), you will find an exclusive button labeled "🛠 Build Module". 3. Click that button. A *Custom Module Creator* pop-up (Modal) will appear. This is your creative canvas.

This interface is divided into several key sections that define your module's identity and logic behavior.

2.2 Module Visual Identity (Metadata)

The top part of the form is dedicated to visual identity. This is vital so your module is easy to find in the left sidebar and looks professional if you share this workflow with other users.

* Module Name (Display): This is the primary name of your module. Keep it concise yet representative. Avoid overly long names that might break the UI layout. * *Good example:* `Tax Calculator`, `WA Number Formatter`, `JSON Extractor`. * *Bad example:* `Module For Calculating Eleven Percent Value Added Tax`.

* Module Icon (Emoji): Flowork takes a modern approach by using standard Unicode Emoji characters as module icons. This ensures lightning-fast rendering without needing to load external SVG or PNG image files. Choose an icon that fits the function. * *Examples:* 🧮 for math, 📝 for text, 🤖 for AI, 🌐 for networking.

* Description: Provide a short description (maximum 2 sentences) of what this module does. This description will appear under the module name in the sidebar list and helps others understand the node's function without looking at the code.

2.3 Parameter Schema (UI Input Engine)

This is one of the most advanced features of Flowork Custom Modules. Instead of making you create your own HTML/CSS UI for your module, Flowork uses the concept of JSON Schema Driven UI.

You simply write the definitions of what inputs your module needs in a pure JSON Array format. The Flowork UI engine automatically (via Vue.js reactivity) translates that JSON into an elegant HTML form (text inputs, dropdowns, or other options) in the Properties panel (right sidebar) when the node is clicked.

JSON Schema Writing Rules:

1. Must start with an open square bracket `[` and end with a closed one `]`. 2. Contains JSON objects `{ ... }` separated by commas `,`. 3. Use double quotes `"` strictly for both keys and values (as per strict JSON standards, not just standard JavaScript objects).

Mandatory Properties in Each Parameter Object:

* "name": This is the *unique ID* of the parameter. This name must not contain spaces, should not start with a capital letter (camelCase or snake_case is recommended), and must not contain special characters other than underscores. This variable is what you will call inside your JavaScript logic code. * "displayName": This is the text label (human-readable) that users will see above the input box. You are free to use spaces and capital letters here. * "type": Determines the form input type. * Use `"string"` for a standard text input (like `input type="text"`). * Use `"options"` for a dropdown menu (like a `