Monorepo Structure
The project is organized into four main workspaces:Backend
Node.js/Express server with Playwright-based execution engine
Frontend
React + ReactFlow visual workflow editor
Shared
TypeScript types and utilities shared across workspaces
MCP Server
Model Context Protocol server for AI/IDE integration
Backend Architecture
The backend is the core execution engine responsible for running workflows and managing browser automation.Key Components
Execution Engine
Execution Engine
Located in
backend/src/engine/, this is the heart of AutoMFlows:- Executor (
executor/core.ts): Main execution orchestrator that manages workflow lifecycle - WorkflowParser (
parser.ts): Parses workflow JSON and builds dependency graphs - ContextManager (
context.ts): Manages execution state, variables, and browser contexts - PlaywrightManager (
utils/playwright.ts): Handles browser lifecycle and page management
Node Handlers
Node Handlers
Located in
backend/src/nodes/, each node type has a dedicated handler:- Browser Nodes (
browser.ts): OpenBrowser, Navigation, Context manipulation - Interaction Nodes (
handlers/action.ts,handlers/type.ts): Click, type, form inputs - Data Nodes (
handlers/elementQuery.ts,handlers/dataExtractor.ts): Extract text, attributes, structured data - Logic Nodes (
logic.ts): JavaScript code execution, loops - API Nodes (
api.ts): HTTP requests, cURL commands - Database Nodes (
database.ts): Database connections and queries - Verification Nodes (
handlers/verify.ts): Assertions for browser, API, and database
Utilities
Utilities
- VariableInterpolator (
utils/variableInterpolator.ts): Resolves${data.key}expressions - RetryHelper (
utils/retryHelper.ts): Handles retry logic with exponential backoff - WaitHelper (
utils/waitHelper.ts): Advanced waiting strategies (selector, URL, condition) - LocatorHelper (
utils/locatorHelper.ts): Creates Playwright locators with modifiers - ReportGenerator (
utils/reportGenerator/): Generates execution reports (HTML, Allure, JSON, JUnit, CSV, Markdown)
Server API
The backend exposes a RESTful API and WebSocket interface:Frontend Architecture
The frontend provides an interactive visual workflow builder using React and ReactFlow.Technology Stack
Key Features
- Visual Editor: Drag nodes from sidebar, connect with edges, configure properties
- Real-time Execution Tracking: Live node highlighting via WebSocket
- Builder Mode: Record browser actions and auto-generate nodes
- Selector Finder: Visual element picker that generates optimal selectors
- Report Viewer: Display execution results, screenshots, and accessibility snapshots
Shared Package
Theshared workspace contains TypeScript definitions used by both backend and frontend:
- Types
- Node Data
- Selector System
MCP Server
The Model Context Protocol server enables AI assistants and IDEs to interact with AutoMFlows:The MCP server exposes workflow management operations as structured tools that AI models can invoke, enabling natural language workflow creation and modification.
Data Flow
Here’s how data flows through the system during workflow execution:Plugin System
AutoMFlows supports custom node types through a plugin architecture:Built-in Plugins
Built-in Plugins
- Reusable Node: Define and execute reusable sub-workflows
- Switch Node: Conditional branching based on UI state, API response, or JavaScript
- Set Config Node: Set runtime configuration from workflow
- Comment Box: Add annotations to canvas
- Shortcut: Custom keyboard shortcuts in editor
Dependencies
Backend
- Playwright: Browser automation engine (Chromium, Firefox, WebKit)
- Express: HTTP server and REST API
- Socket.io: Real-time WebSocket communication
- Various DB clients: PostgreSQL, MySQL, MongoDB, SQLite, Oracle, SQL Server, Redis
Frontend
- ReactFlow: Visual node editor library
- Socket.io-client: Real-time execution updates
- Monaco Editor: Code editing for JavaScript nodes
- Material-UI: UI component framework
Shared
- TypeScript: Type definitions shared across workspaces
Performance Considerations
Parallel Execution
Property input connections enable parallel node execution when dependencies allow
Context Isolation
Multiple browser contexts for concurrent workflow execution
Resource Management
Automatic browser cleanup and connection pooling for databases
Report Retention
Configurable report retention to manage disk usage (default: 10 reports)
