How premchandkpc/flowrulz works
FlowRulZ is a distributed workflow and messaging runtime: clients publish, request, execute rules, or subscribe; the server compiles and distributes plans, then workers execute them through the Rust VM and route service calls and replies. The graph preserves the DSL stages, plan lifecycle, runtime, service integration, and key cluster capabilities documented in the README. Source excerpts show the DSL-to-plan path and engine compilation; several server and runtime subsystem links are documented rather than visible in sampled implementation, so those links are dashed.
Main entry points: mod.rs Plan Compiler · prod.go Execution Node · engine.go Plan Engine · compile.go FFI Bridge
Components 27
Client Access
- Client SDKs
sdk/flow/client.go - Node API
server/internal/node/handlers.go - Admin API
server/internal/admin/api.go
Rule Compilation
- DSL Lexer
runtime/src/dsl/lexer/mod.rs - DSL Parser
runtime/src/dsl/parser/mod.rs - DSL Optimizer
runtime/src/dsl/optimizer/mod.rs - Plan Compiler
runtime/src/dsl/compiler/mod.rs
Execution Runtime
- Execution Plan
runtime/src/bytecode/plan.rs - FFI Bridge
server/bridge/compile.go - Plan Engine
server/internal/engine/engine.go - Bytecode VM
runtime/src/executor/vm.rs - Execution Runtime
runtime/src/executor/runtime.rs - Schema Types
runtime/src/bytecode/resolved_type.rs - Arena Memory
runtime/src/memory/arena.rs - Rule Persistence
server/internal/engine/persistence.go
Cluster Operations
- Lane Scheduler
server/internal/scheduler/worker.go - Execution Node
server/internal/node/prod.go - Partition Manager
server/internal/partition/manager.go - Membership
server/internal/membership/membership.go - Plan Distribution
server/internal/plandist/distributor.go - Cluster Bus
server/internal/cluster/transport.go
Service Integrations
- Event Transport
server/internal/transport/producer.go - Service Registry
server/internal/registry/registry.go - Service Caller
server/internal/node/service_caller.go - Reply Router
server/internal/replyrouter/router.go - Reliability Controls
server/internal/reliability/circuitbreaker.go
Other components
- Application
Connections 34
- Application → Client SDKs: uses
- Client SDKs → Node API: sends operations
- Application → Admin API: manages rules
- Admin API → Plan Engine: manages plans
- Node API → Plan Engine: executes rules
- Plan Engine → FFI Bridge: compiles DSL
server/internal/engine/engine.go - FFI Bridge → Plan Compiler: calls compile
- Plan Compiler → DSL Lexer: uses tokens
runtime/src/dsl/compiler/mod.rs - Plan Compiler → DSL Parser: reads AST
runtime/src/dsl/compiler/mod.rs - Plan Compiler → DSL Optimizer: uses optimized pipeline
runtime/src/dsl/compiler/mod.rs - DSL Lexer → DSL Parser: produces tokens
runtime/src/dsl/parser/mod.rs - DSL Parser → DSL Optimizer: produces AST
runtime/src/dsl/optimizer/mod.rs - DSL Optimizer → Plan Compiler: supplies pipeline
runtime/src/dsl/compiler/mod.rs - Plan Compiler → Execution Plan: emits bytecode
runtime/src/dsl/compiler/mod.rs - Plan Compiler → Schema Types: validates schema
runtime/src/dsl/compiler/mod.rs - Execution Plan → Bytecode VM: executes bytecode
- Execution Node → Plan Engine: loads active plans
- Plan Engine → Rule Persistence: persists rules
- Plan Engine → Lane Scheduler: routes by lane
- Lane Scheduler → Execution Node: dispatches work
- Execution Node → FFI Bridge: invokes VM
- FFI Bridge → Execution Runtime: executes steps
- Bytecode VM → Execution Runtime: uses runtime
- Execution Runtime → Arena Memory: allocates buffers
- Membership → Partition Manager: informs rebalance
- Partition Manager → Plan Distribution: assigns shards
- Plan Distribution → Cluster Bus: distributes plans
- Cluster Bus → Execution Node: coordinates nodes
- Execution Node → Event Transport: produces events
- Execution Node → Service Caller: calls services
- Service Caller → Service Registry: resolves instances
server/internal/node/service_caller.go - Service Caller → Reliability Controls: uses circuit breaker
server/internal/node/service_caller.go - Execution Node → Reply Router: routes replies
- Event Transport → Application: delivers events