Architecture Overview
BoCoFlow is built with a modular, microservices-inspired architecture that separates concerns and enables independent development of components.
System Architecture
┌─────────────────────────────────────────────┐
│ Electron Desktop App │
│ ┌─────────────────────────────────────┐ │
│ │ React Web UI │ │
│ │ (bocoflow-web) │ │
│ └─────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────────┐ │
│ │ Electron Main Process │ │
│ │ (bocoflow-electron) │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
│
│ HTTP/REST
│
┌────────────────────────────────┐
│ FastAPI Server │
│ (bocoflow-server) │
└────────────────────────────────┘
│
┌────────────────────────────────┐
│ Workflow Engine │
│ (bocoflow-core) │
└────────────────────────────────┘
│
┌────────────────────────────────┐
│ Python Environments (UV) │
│ - Node execution │
│ - Dependency isolation │
└────────────────────────────────┘
Component Overview
bocoflow-core
Purpose: Core workflow engine and node system
Key Features:
- Workflow execution engine
- Node base classes and interfaces
- Parameter system for node configuration
- Caching and dependency tracking
- Status management
Technologies: Python 3.8+, NetworkX
bocoflow-server
Purpose: REST API server for workflow operations
Key Features:
- RESTful API endpoints
- Workflow execution management
- File operations and data handling
- WebSocket support for real-time updates
- Database integration
Technologies: FastAPI, Uvicorn, SQLAlchemy
bocoflow-web
Purpose: React-based web user interface
Key Features:
- Visual workflow editor (React Flow)
- Node configuration panels
- Real-time execution monitoring
- File management interface
- Responsive design
Technologies: React 18, TypeScript, React Flow, Material-UI
bocoflow-electron
Purpose: Desktop application wrapper
Key Features:
- Native desktop integration
- UV package manager integration
- Backend server lifecycle management
- Auto-updater support
- Cross-platform packaging
Technologies: Electron, TypeScript, electron-builder
bocoflow-docs
Purpose: Documentation website
Key Features:
- User guides and tutorials
- API documentation
- Architecture documentation
- Contributing guidelines
Technologies: Docusaurus, React, MDX
Data Flow
Workflow Execution
- User Action: User designs workflow in the UI
- API Request: UI sends workflow to server via REST API
- Validation: Server validates workflow structure
- Execution: Core engine executes nodes in dependency order
- Results: Results streamed back to UI via WebSocket
- Storage: Results cached for future use
Node Execution
- Preparation: Node parameters validated
- Environment: Python environment activated if specified
- Execution: Node's
execute()
method called - Output: Results serialized and returned
- Caching: Results stored in cache database
Environment Management
BoCoFlow uses UV (Astral's package manager) for Python environment management:
Benefits of UV
- Fast: 10-100x faster than pip
- Reliable: Built-in dependency resolution
- Isolated: Each environment is completely isolated
- Cross-platform: Works on Windows, macOS, and Linux
Environment Structure
bocoflow-server-env/
├── bin/ # Executables (Unix)
├── Scripts/ # Executables (Windows)
├── lib/ # Python packages
└── pyvenv.cfg # Environment configuration
Communication Protocols
REST API
Primary endpoints:
POST /workflow/execute
- Execute workflowGET /workflow/status
- Get execution statusPOST /node/configure
- Configure node parametersGET /files/list
- List workspace filesPOST /files/upload
- Upload data files
WebSocket
Real-time communication for:
- Execution progress updates
- Log streaming
- Error notifications
- Status changes
Security Considerations
Process Isolation
- Each node runs in a separate process
- Environment variables are isolated
- File system access is sandboxed to workspace
Authentication
- Desktop app: Local-only by default
- Server deployment: JWT token authentication
- API keys for remote execution
Extensibility
Custom Nodes
Developers can create custom nodes by:
- Extending the
Node
base class - Defining input/output ports
- Implementing the
execute()
method - Placing in the nodes directory
Plugin System (Planned)
Future support for:
- Node packages
- UI extensions
- Custom executors
- Workflow templates
Performance Optimization
Caching Strategy
- Result Caching: Node outputs cached by input hash
- Dependency Tracking: Only re-execute changed nodes
- Lazy Loading: Load data only when needed
- Parallel Execution: Independent nodes run in parallel
Resource Management
- Memory Limits: Configurable per-node memory limits
- Timeout Control: Execution timeouts prevent hanging
- Queue Management: Job queue for resource allocation
- Cleanup: Automatic cleanup of temporary files
Deployment Options
Desktop (Primary)
- Self-contained Electron application
- Includes embedded Python environment
- No external dependencies required
Server
- Docker containerization
- Kubernetes deployment support
- Horizontal scaling capability
- Load balancing for multiple workers
Cloud
- AWS/Azure/GCP deployment guides
- Serverless function support (planned)
- Cloud storage integration
Future Architecture Plans
Planned Enhancements
- Distributed Execution: Run nodes across multiple machines
- Workflow Marketplace: Share and discover workflows
- Version Control: Git-like workflow versioning
- Real-time Collaboration: Multiple users editing workflows
- GPU Support: CUDA/ROCm acceleration for compatible nodes
Modular Package System
Future architecture will support:
- Separate Python packages per node type
- Dynamic environment creation
- Dependency conflict resolution
- Package versioning and updates
Development Workflow
Repository Structure
bocoflow/ # Parent repository
├── bocoflow-core/ # Git submodule
├── bocoflow-server/ # Git submodule
├── bocoflow-web/ # Git submodule
├── bocoflow-electron/ # Git submodule
├── bocoflow-docs/ # Git submodule
└── dev-notes/ # Development documentation
Development Scripts
Universal development script handles:
- Environment setup
- Dependency installation
- Service orchestration
- Hot reloading
- Log aggregation
Contributing
See our Contributing Guide for details on:
- Development setup
- Code style guidelines
- Testing requirements
- Pull request process