Skip to main content
Flowise is built as a monorepo containing multiple packages that work together to provide a complete AI workflow builder platform.

Monorepo Structure

Flowise uses a monorepo structure managed by PNPM workspaces and Turbo for build orchestration.
Flowise/
├── packages/
│   ├── server/          # Node.js backend
│   ├── ui/              # React frontend
│   ├── components/      # Node components
│   └── api-documentation/ # Swagger API docs
├── package.json         # Root workspace config
├── turbo.json          # Turbo build config
└── pnpm-workspace.yaml # PNPM workspace config

Core Modules

Server (packages/server)

The backend API server built with Node.js and Express. Key Responsibilities:
  • RESTful API endpoints
  • Chatflow execution engine
  • Database management (SQLite, MySQL, PostgreSQL)
  • Authentication and authorization
  • File storage and uploads
  • WebSocket connections for streaming
  • Credential management
Tech Stack:
  • Framework: Express.js
  • ORM: TypeORM
  • Language: TypeScript
  • Database: SQLite (default), MySQL, PostgreSQL
Key Directories:
packages/server/
├── src/
│   ├── controllers/    # API route handlers
│   ├── services/       # Business logic
│   ├── database/       # Database entities & migrations
│   ├── utils/          # Helper functions
│   └── Interface.ts    # TypeScript interfaces
├── bin/               # Executable scripts
└── public/            # Static assets (icons, etc.)

UI (packages/ui)

The React-based frontend application. Key Responsibilities:
  • Visual chatflow builder (drag-and-drop canvas)
  • Node configuration forms
  • Chatflow management (create, edit, delete)
  • Chat interface for testing
  • Settings and configuration UI
  • Marketplace for community nodes
Tech Stack:
  • Framework: React 18
  • Build Tool: Vite
  • UI Library: Material-UI (MUI)
  • State Management: Redux Toolkit
  • Canvas: React Flow
  • Language: TypeScript
Key Directories:
packages/ui/
├── src/
│   ├── ui-component/   # Reusable UI components
│   ├── views/          # Page components
│   ├── store/          # Redux store & slices
│   ├── api/            # API client functions
│   └── layout/         # Layout components
└── public/            # Static assets

Components (packages/concepts/nodes-and-edges)

The node library containing all integrations and tools. Key Responsibilities:
  • LangChain component wrappers
  • Custom tools and utilities
  • Third-party API integrations
  • Node definitions and metadata
  • Credential schemas
Tech Stack:
  • Language: TypeScript
  • Core Library: LangChain
  • Additional: Various third-party SDKs
Key Directories:
packages/concepts/nodes-and-edges/
├── nodes/
│   ├── chatmodels/        # LLM integrations
│   ├── tools/             # Agent tools
│   ├── embeddings/        # Embedding models
│   ├── vectorstores/      # Vector databases
│   ├── documentloaders/   # Document loaders
│   ├── chains/            # LangChain chains
│   ├── agents/            # Agent implementations
│   ├── memory/            # Memory types
│   └── utilities/         # Helper nodes
├── credentials/          # Credential definitions
└── src/
    ├── Interface.ts      # Node interfaces
    └── utils.ts          # Utility functions

API Documentation (packages/api-documentation)

Auto-generated Swagger documentation. Key Responsibilities:
  • API documentation generation
  • Interactive API explorer
  • OpenAPI specification

Data Flow

Chatflow Creation

1

User designs chatflow

User drags nodes onto the canvas in the UI and connects them
2

UI sends to server

When saved, the UI sends the chatflow JSON to the server API
3

Server stores chatflow

Server validates and stores the chatflow in the database

Chatflow Execution

1

User sends message

User sends a message through the chat interface
2

Server loads chatflow

Server retrieves the chatflow definition from the database
3

Node initialization

Server initializes each node using the components package
4

Execution

Server executes the chatflow by traversing the node graph
5

Response streaming

Results are streamed back to the UI via WebSocket

Node System Architecture

Node Lifecycle

1

Definition

Node is defined in packages/concepts/nodes-and-edges/nodes/
2

Registration

Server discovers and registers the node on startup
3

Display

UI loads node metadata and displays it in the sidebar
4

Configuration

User configures node parameters in the UI
5

Initialization

Server calls the node’s init() method when executing
6

Execution

Node performs its function and returns results

Node Structure

Every node implements the INode interface:
interface INode {
    // Metadata
    label: string           // Display name
    name: string           // Unique identifier
    version: number        // Version number
    description: string    // Description
    type: string          // Type identifier
    icon: string          // Icon filename
    category: string      // Category for grouping
    baseClasses: string[] // Supported base classes

    // Configuration
    inputs?: INodeParams[]        // Input parameters
    outputs?: INodeOutputsValue[] // Output definitions
    credential?: INodeParams      // Credential requirements

    // Methods
    init(nodeData: INodeData, input: string, options: ICommonObject): Promise<any>
    loadMethods?: { [key: string]: () => Promise<INodeOptionsValue[]> }
}

Database Schema

Flowise uses TypeORM with support for multiple databases:

Key Entities

ChatFlow
  • Stores chatflow definitions
  • Contains node configurations and connections
  • Links to API keys and settings
ChatMessage
  • Stores conversation history
  • Links to chatflows
  • Contains user messages and AI responses
Credential
  • Stores encrypted API keys and credentials
  • Used by nodes requiring authentication
Tool
  • Custom tools created by users
  • Can be reused across chatflows
Assistant
  • OpenAI Assistant configurations
  • Links to chatflows

Build System

Turbo Configuration

Flowise uses Turbo for fast, cached builds:
turbo.json
{
  "pipeline": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**"]
    },
    "dev": {
      "cache": false,
      "persistent": true
    }
  }
}

Build Order

1

Components

Build packages/concepts/nodes-and-edges first (dependency of server)
2

Server & UI

Build packages/server and packages/ui in parallel
3

API Documentation

Build packages/api-documentation last

Package Management

Flowise uses PNPM for efficient package management:

Workspace Structure

pnpm-workspace.yaml
packages:
  - 'packages/*'
  - 'flowise'
  - 'ui'
  - 'components'
  - 'api-documentation'

Key Scripts

pnpm install
# Installs all dependencies for all packages

Technology Stack Summary

Backend

  • Runtime: Node.js >= 18.15.0
  • Framework: Express.js
  • ORM: TypeORM
  • Database: SQLite, MySQL, PostgreSQL
  • WebSocket: Socket.io
  • Language: TypeScript

Frontend

  • Framework: React 18
  • Build Tool: Vite
  • UI Library: Material-UI (MUI)
  • Canvas: React Flow
  • State: Redux Toolkit
  • Language: TypeScript

AI/ML

  • Core: LangChain
  • Integrations: OpenAI, Anthropic, Google, and 100+ providers
  • Vector Stores: Pinecone, Weaviate, Qdrant, and more

DevOps

  • Package Manager: PNPM v10
  • Build System: Turbo
  • Linting: ESLint
  • Formatting: Prettier
  • Git Hooks: Husky

API Architecture

RESTful Endpoints

The server exposes RESTful API endpoints:
  • GET /api/v1/chatflows - List all chatflows
  • POST /api/v1/chatflows - Create new chatflow
  • GET /api/v1/chatflows/:id - Get chatflow details
  • PUT /api/v1/chatflows/:id - Update chatflow
  • DELETE /api/v1/chatflows/:id - Delete chatflow
  • POST /api/v1/prediction/:id - Execute chatflow

WebSocket Events

For real-time streaming:
  • start - Begin streaming
  • token - Stream token
  • end - End streaming
  • error - Error occurred

Security

Credential Encryption

All credentials are encrypted using AES-256:
  1. Secret key is generated on first run
  2. Stored in SECRETKEY_PATH
  3. Can be overridden with FLOWISE_SECRETKEY_OVERWRITE

Environment Isolation

Custom tools run in isolated contexts:
  • TOOL_FUNCTION_BUILTIN_DEP - Allowed built-in modules
  • TOOL_FUNCTION_EXTERNAL_DEP - Allowed external modules
  • ALLOW_BUILTIN_DEP - Allow project dependencies

Performance Considerations

Caching

  • Turbo caches build outputs
  • LangChain supports cache backends
  • Server caches node metadata

Optimization

  • Use streaming for large responses
  • Lazy load components in UI
  • Database connection pooling
  • Static asset caching

Extending Flowise

Flowise can be extended in several ways:
  1. Custom Nodes - Add new components in packages/concepts/nodes-and-edges/nodes/
  2. Custom Credentials - Define new credential types
  3. Custom Tools - Create reusable tools in the UI
  4. API Integration - Use Flowise API in external applications
  5. Embedding - Embed chat widgets in websites

Next Steps

Build docs developers (and LLMs) love