Design and Implementation of a Plugin System for Dada Mall and Crowdsourcing Tasks
The article describes how Dada Mall and its crowdsourcing task platform adopted a flexible plugin architecture to modularize product-specific logic, simplify maintenance, enable dynamic configuration, and support rapid business expansion without extensive refactoring.
Author: SiYuan Weng, HKUST graduate, former startup employee in Singapore, gemstone seller, entrepreneur, now responsible for the crowdsourcing task project after developing Dada Mall.
Origin and Idea
Dada Mall offers various product types, each with distinct display, pricing, shipping, inventory, and refund logic. After six months of development, the code became tangled and hard to maintain, prompting a refactor in November 2016 with the following ideas:
Product purchase flow remains constant; each node’s trigger method is clearly defined.
Business logic at each node is highly variable; inspired by React componentization, we isolate it using plugins, configuring different plugins per product.
Products can bind, modify, and adjust plugin parameters through the backend.
Structure Diagram
Products, Nodes and Plugins
Each product can bind multiple plugins, and plugins can be added or removed dynamically.
When a user purchases any product, they pass through the nodes shown in the diagram below. Upon node activation, the system detects which plugins are bound to the product and executes the plugin code for that node in order.
Flexibility and Readability of Plugins
Plugin parameters can be configured in real time, allowing adjustments to meet specific product requirements.
The logic executed by a plugin at each node is visible directly in the backend, making it easy to understand the purchase flow details without additional documentation.
Writing a Plugin
When a new requirement arrives, you only need to write a plugin file. The system uses reflection to automatically discover new plugins in the designated path, displays them in the backend, and activates them after configuration.
Plugin Basic Attributes
Attribute
Description
plugin_id
Plugin identifier
plugin_name
Display name of the plugin
category
Plugin category
priority
Execution order of the plugin
desc
Logic description of the plugin at different nodes
Plugin Configuration Props
Plugins inherit a Props class that defines attributes, default values, etc. Props can be configured in the backend and take effect in real time.
Node Methods
Business code resides in node methods. When a node is triggered, the bound plugins’ node methods execute sequentially according to their priority. Each method receives the plugin’s Props, API‑provided Form parameters, and shared Data. After execution, a standard Output class is returned to handle exceptions.
Current Usage
Dada Mall has been running the plugin system for a year with stable performance; new business features are added as plugins without requiring major refactoring.
The crowdsourcing task settlement system also uses the plugin framework to handle complex settlement logic for different projects, with integration completed in half a day.
Future Development
Automated Testing
Automated tests for plugins are more business‑centric than unit tests and finer‑grained than integration tests. The plugin system’s clear separation of logic and explicit input/output definitions simplify test case generation; the backend can automatically retrieve required inputs and expected outputs to create test scenarios.
Development Process Optimization
Product managers can view plugin flows in the UI, gaining insight into the exact business logic. During requirement discussions, product and engineering can agree on a plugin design, the backend generates a template for developers, and testers can start writing test cases based on that template.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Dada Group Technology
Sharing insights and experiences from Dada Group's R&D department on product refinement and technology advancement, connecting with fellow geeks to exchange ideas and grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
