Monorepo Structure
Flowise uses a monorepo structure managed by PNPM workspaces and Turbo for build orchestration.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
- Framework: Express.js
- ORM: TypeORM
- Language: TypeScript
- Database: SQLite (default), MySQL, PostgreSQL
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
- Framework: React 18
- Build Tool: Vite
- UI Library: Material-UI (MUI)
- State Management: Redux Toolkit
- Canvas: React Flow
- Language: TypeScript
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
- Language: TypeScript
- Core Library: LangChain
- Additional: Various third-party SDKs
API Documentation (packages/api-documentation)
Auto-generated Swagger documentation.
Key Responsibilities:
- API documentation generation
- Interactive API explorer
- OpenAPI specification
Data Flow
Chatflow Creation
Chatflow Execution
Node System Architecture
Node Lifecycle
Node Structure
Every node implements theINode interface:
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
- Stores conversation history
- Links to chatflows
- Contains user messages and AI responses
- Stores encrypted API keys and credentials
- Used by nodes requiring authentication
- Custom tools created by users
- Can be reused across chatflows
- OpenAI Assistant configurations
- Links to chatflows
Build System
Turbo Configuration
Flowise uses Turbo for fast, cached builds:turbo.json
Build Order
Package Management
Flowise uses PNPM for efficient package management:Workspace Structure
pnpm-workspace.yaml
Key Scripts
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 chatflowsPOST /api/v1/chatflows- Create new chatflowGET /api/v1/chatflows/:id- Get chatflow detailsPUT /api/v1/chatflows/:id- Update chatflowDELETE /api/v1/chatflows/:id- Delete chatflowPOST /api/v1/prediction/:id- Execute chatflow
WebSocket Events
For real-time streaming:start- Begin streamingtoken- Stream tokenend- End streamingerror- Error occurred
Security
Credential Encryption
All credentials are encrypted using AES-256:- Secret key is generated on first run
- Stored in
SECRETKEY_PATH - Can be overridden with
FLOWISE_SECRETKEY_OVERWRITE
Environment Isolation
Custom tools run in isolated contexts:TOOL_FUNCTION_BUILTIN_DEP- Allowed built-in modulesTOOL_FUNCTION_EXTERNAL_DEP- Allowed external modulesALLOW_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:- Custom Nodes - Add new components in
packages/concepts/nodes-and-edges/nodes/ - Custom Credentials - Define new credential types
- Custom Tools - Create reusable tools in the UI
- API Integration - Use Flowise API in external applications
- Embedding - Embed chat widgets in websites
Next Steps
- Set up local development
- Learn to create custom nodes
- Review contributing guidelines
