A production-quality workflow orchestration and execution engine written in C++23.
FlowForge takes DAG-based workflow definitions, resolves task dependencies, schedules tasks, executes them through workers, handles failures/retries, and persists execution state.
v0.1 — Architecture scaffolding complete. No implementation code yet. See the architecture document below for the full design.
- C++23 compatible compiler (GCC 13+, Clang 17+, MSVC 19.35+)
- CMake 3.28+
- Ninja (recommended generator)
# Configure (development)
cmake --preset dev -G Ninja
cmake --build build/dev
# Configure (release)
cmake --preset release -G Ninja
cmake --build build/release
# Run tests
ctest --test-dir build/dev
# Run benchmarks
./build/release/benchmarks/flowforge_benchmarksFlowForge/
├── CMakeLists.txt # Top-level build definition
├── CMakePresets.json # Build presets (dev, release, relwithdebinfo)
├── LICENSE # MIT License
├── README.md # This file
├── .gitignore # Git ignore rules
├── .clang-format # C++ code formatting (Google-based, 100 col)
├── .clang-tidy # Static analysis checks
├── .editorconfig # Editor consistency settings
│
├── include/flowforge/ # PUBLIC API HEADERS (installed with the library)
│ ├── core/ # Fundamental types, errors, concepts
│ ├── dag/ # DAG representation
│ ├── task/ # Task abstraction
│ ├── scheduler/ # Scheduling logic
│ ├── executor/ # Task execution
│ ├── worker/ # Worker pool
│ ├── runtime/ # Main runtime orchestrator
│ ├── storage/ # Persistence (PostgreSQL, future backends)
│ ├── cache/ # Content-based caching (BLAKE3)
│ ├── docker/ # Docker-based task isolation
│ ├── distributed/ # Distributed workers (future)
│ ├── logging/ # Structured logging
│ ├── metrics/ # Observability / metrics
│ └── cli/ # CLI application
│
├── src/
│ ├── flowforge/ # LIBRARY IMPLEMENTATION (mirrors include/)
│ │ ├── core/
│ │ ├── dag/
│ │ ├── task/
│ │ ├── scheduler/
│ │ ├── executor/
│ │ ├── worker/
│ │ ├── runtime/
│ │ ├── storage/
│ │ ├── cache/
│ │ ├── docker/
│ │ ├── distributed/
│ │ ├── logging/
│ │ ├── metrics/
│ │ └── cli/
│ └── tools/ # EXECUTABLES
│ └── flowforge.cpp # CLI entry point
│
├── tests/ # FIRST-CLASS TESTING
│ ├── CMakeLists.txt
│ ├── test_main.cpp
│ ├── unit/ # Unit tests (per module)
│ ├── integration/ # Cross-module integration tests
│ └── fixtures/ # Shared test data / helpers
│
├── benchmarks/ # FIRST-CLASS BENCHMARKING
│ ├── CMakeLists.txt
│ ├── bench_main.cpp
│ ├── bench_dag.cpp
│ ├── bench_scheduler.cpp
│ ├── bench_executor.cpp
│ └── bench_worker_pool.cpp
│
├── examples/ # Runnable examples
│ ├── simple_workflow.cpp
│ └── parallel_workflow.cpp
│
├── docs/ # DOCUMENTATION
│ ├── index.md
│ ├── getting-started.md
│ ├── architecture.md # This document
│ ├── api.md # Generated API reference
│ ├── design/ # Design decision records (DDRs)
│ │ ├── dag-design.md
│ │ ├── scheduler-design.md
│ │ └── persistence-design.md
│ ├── examples/ # Documentation code samples
│ └── api/ # Doxygen-generated HTML
│
├── scripts/ # AUTOMATION & CI
│ ├── ci/
│ │ ├── github/ # GitHub Actions workflows
│ │ └── docker/ # Container build scripts
│ ├── setup/ # Developer environment setup
│ └── dev/ # Developer convenience scripts
│
├── cmake/ # CMAKE INFRASTRUCTURE
│ ├── CompilerSettings.cmake # C++23 standard, warnings, sanitizers
│ ├── Dependencies.cmake # External dependency discovery
│ ├── Testing.cmake # Test framework setup (Catch2)
│ ├── Benchmarking.cmake # Benchmark setup (Google Benchmark)
│ └── FlowForgeConfig.cmake.in # Package config for find_package
│
└── third_party/ # VENDORED DEPENDENCIES (if any)
└── README.md # Vendoring policy
┌─────────────┐
│ CLI │
└──────┬──────┘
│
┌──────▼──────┐
│ Runtime │
└──────┬──────┘
│
┌───────────────┼───────────────┐
│ │ │
┌──────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐
│ Scheduler │ │ Executor │ │ Worker │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
└───────┬───────┘ │
│ │
┌──────▼──────┐ │
│ DAG │ │
└──────┬──────┘ │
│ │
┌──────▼──────┐ │
│ Task │◄───────────────┘
└──────┬──────┘
│
┌──────▼──────┐
│ Core │
└─────────────┘
Future modules (do NOT create circular dependencies):
Storage ──────► Task, DAG, Core
Cache ─────────► Task, Core
Docker ────────► Executor, Task, Core
Distributed ───► Worker, Executor, Task, Core
Logging ───────► Core (cross-cutting, injected everywhere)
Metrics ───────► Core (cross-cutting, injected everywhere)
Rule: Modules may only depend on modules "below" them. No upward or circular dependencies. This is enforced by CMake target link relationships.
These modules have full implementation in v0.1:
| Module | Purpose |
|---|---|
| core | Fundamental types (TaskId, WorkflowId), std::expected wrappers, error codes, C++23 concepts |
| task | Task class, TaskConfig (timeout, retries), TaskResult, TaskStatus enum |
| dag | DAG, Node, Edge, topological sort, cycle detection |
| scheduler | Scheduler interface + TopologicalScheduler implementation |
| executor | IExecutor interface, SyncExecutor (synchronous, in-process) |
| worker | WorkerPool, Worker, TaskQueue (bounded MPMC queue) |
| runtime | Runtime orchestrator: loads DAG, schedules, executes via workers |
| cli | CLI application using CLI11: run, status subcommands |
| logging | Minimal ILogger interface + ConsoleLogger for v0.1 observability |
These directories exist so the architecture is complete, but implementations are deferred:
| Module | Planned For | Why Deferred |
|---|---|---|
| storage | v0.3+ | PostgreSQL persistence requires schema design and libpqxx integration |
| cache | v0.4+ | Content-based caching with BLAKE3 requires stable task output contracts |
| docker | v0.5+ | Docker isolation requires Docker SDK / subprocess orchestration |
| distributed | v0.6+ | Distributed workers require network protocol and message queue |
| metrics | v0.2+ | Prometheus/metrics exposition can be added once runtime is stable |
For v0.1, these directories contain only a placeholder CMakeLists.txt and an empty umbrella header if needed. They are not added to the build.
- What belongs here: Every header that external consumers of FlowForge may include. This is the stable interface boundary.
- What must NOT go here: Internal implementation headers, pimpl details, private helpers,
.cppfiles. - Architectural role: This is the only directory installed by
make install. Changes here are API changes and follow semver.
- What belongs here: All
.cppfiles, internal headers (pimpl, helpers), module-private details. - What must NOT go here: Public headers (those belong in
include/). - Architectural role: This is not installed. It contains the compiled translation units. The directory structure mirrors
include/so implementation is easy to locate for any header.
- What belongs here:
main()functions and thin CLI wiring. - What must NOT go here: Library code, reusable components.
- Architectural role: Keeps the library (
src/flowforge/) separate from delivered binaries. Multiple tools (CLI, future daemons) can coexist here.
- What belongs here: All test code.
tests/unit/<module>/— Unit tests for the correspondingsrc/flowforge/<module>/.tests/integration/— Tests that span multiple modules (e.g., Runtime + DAG + Executor).tests/fixtures/— Shared test data, sample workflows, helper utilities.
- What must NOT go here: Production code, benchmarks (those belong in
benchmarks/). - Architectural role: First-class testing ensures every public API has a corresponding test. Mirroring the
src/structure makes it obvious which tests cover which code.
- What belongs here: Google Benchmark microbenchmarks for performance-critical modules.
- What must NOT go here: Unit tests, production code.
- Architectural role: Benchmarks are opt-in (disabled in dev by default, enabled in dedicated CI jobs). They catch performance regressions.
- What belongs here: Standalone C++ programs that demonstrate FlowForge usage.
- What must NOT go here: Library internals, test code.
- Architectural role: Examples serve as both documentation and integration smoke tests.
- What belongs here:
index.md,getting-started.md— User-facing docs.architecture.md— This document.design/— Design Decision Records (DDRs) for major architectural choices.api/— Doxygen-generated API reference (gitignored, generated in CI).examples/— Documentation code samples (not runnable, used in markdown).
- What must NOT go here: Implementation code, internal notes.
- What belongs here:
ci/— GitHub Actions workflows, Docker build scripts.setup/— Developer environment bootstrap.dev/— Convenience scripts (format.sh,lint.sh,run_tests.sh).
- What must NOT go here: C++ source code.
- What belongs here: Reusable CMake logic: compiler flags, dependency discovery, test/benchmark setup, package config templates.
- What must NOT go here: Target definitions, source file lists (those belong in the respective
CMakeLists.txt).
- What belongs here: Only if a dependency cannot be obtained via system package manager or CMake FetchContent. Each vendored library gets its own subdirectory.
- What must NOT go here: Random utility scripts.
- Policy: See
third_party/README.md. Vendoring is discouraged; prefer CMake FetchContent with pinned revisions.
-
Dependency Direction: Modules may only depend on modules "below" them in the dependency graph. No circular or upward dependencies. Enforced by CMake
target_link_libraries. -
Public API Only in
include/: All external-facing headers live ininclude/flowforge/. Internal headers live insrc/flowforge/only. Never include asrc/header from outside the library. -
Include What You Use: Every header includes its own dependencies. Do not rely on transitive includes from other FlowForge headers. This prevents fragile include-order bugs.
-
No Exceptions Across Module Boundaries: Use
std::expected<T, E>(C++23) orflowforge::Expected<T, E>for recoverable errors. Exceptions are documented as undefined behavior unless explicitly markednoexcept(false). -
No Global State: Avoid singletons. Pass dependencies (logger, storage backend, cache backend) via constructor injection.
-
One Public Header Per Module: Each module has a primary header (e.g.,
include/flowforge/runtime/runtime.hpp) that includes sub-headers. External code includes only the primary header. -
CMake Targets Match Modules: Each module directory builds into a dedicated CMake target (
flowforge::core,flowforge::dag, etc.). This makes dependency boundaries explicit and compile times faster. -
No Pimpl in v0.1: Concrete classes with stable layout. Pimpl indirection can be introduced later if binary compatibility becomes a requirement.
-
Test Coverage Rule: Every public API function and class must have at least one corresponding unit test. Integration tests cover cross-module workflows.
-
Benchmarking Rule: Any module with a hot path (DAG traversal, scheduling, worker queue) must have a corresponding benchmark. Benchmarks live in
benchmarks/and are run in CI on every PR. -
Documentation Rule: Every public class and function has a Doxygen comment. Design decisions are recorded as DDRs in
docs/design/. -
No External Dependency Leakage: If FlowForge uses a third-party library (e.g., nlohmann/json, BLAKE3), the types are wrapped in FlowForge-specific types. External consumers never see the third-party headers unless explicitly intended.
-
Incremental Enablement: Future modules exist as empty directories with a stub
CMakeLists.txtso the architecture is complete, but they are not added to the build in v0.1. This prevents "works on my machine" surprises when the module is finally implemented. -
Concurrency Safety: Every public class documents its thread-safety guarantees:
@threadsafe,@not_threadsafe, or@threadsafe_after_init.
concepts.hpp— C++23 concepts:TaskConcept,ExecutorConcept,SchedulerConcept.error.hpp—Errortype, error categories,make_error().expected.hpp— Thin wrapper aroundstd::expectedwith FlowForge-specific utilities.id.hpp— Strongly-typed IDs:TaskId,WorkflowId,ExecutionId(strong typedefs preventing mix-ups).status.hpp— Common status enums:TaskStatus,ExecutionPhase.
task.hpp—Taskclass: name, command/function, config, metadata.task_config.hpp—TaskConfig: timeout, retries, environment variables, resource limits.task_result.hpp—TaskResult: exit code, stdout, stderr, duration, artifact paths.
dag.hpp—DAGclass: owns nodes and edges, provides topological order.node.hpp—Node: wraps aTaskId, adds node-level metadata.edge.hpp—Edge: sourceTaskId, targetTaskId.topological_sort.hpp— Kahn's algorithm / DFS-based sort.cycle_detection.hpp— DFS-based cycle detection with path reporting.
scheduler.hpp—ISchedulerinterface:schedule()returns next batch of runnable tasks.topological_scheduler.hpp— Default implementation: priority-aware topological scheduling.
executor.hpp—IExecutorinterface:execute(task, context).execution_context.hpp—ExecutionContext: runtime state, working directory, env.sync_executor.hpp—SyncExecutor: runs task synchronously in-process (v0.1).
worker.hpp—Worker: owns a thread, pulls tasks from queue, executes viaIExecutor.worker_pool.hpp—WorkerPool: manages N workers, bounded task queue, shutdown semantics.task_queue.hpp— Bounded MPMC queue (lock-free or mutex-based).
runtime.hpp—Runtime: main user-facing orchestrator. Loads DAG, coordinates scheduler, executor, workers.workflow_runner.hpp—WorkflowRunner: executes a single workflow instance, emits events.execution_state.hpp—ExecutionState: tracks which tasks are pending/running/completed/failed.events.hpp— Event system:TaskStartedEvent,TaskCompletedEvent,TaskFailedEvent.
storage_backend.hpp—IStorageBackendinterface.postgresql_storage.hpp— PostgreSQL implementation using libpqxx.repositories/— Typed repositories:WorkflowRepository,TaskRepository,ExecutionRepository.
cache_backend.hpp—ICacheBackendinterface.content_hash_cache.hpp— BLAKE3-based content-addressable cache for task outputs.
docker_executor.hpp—DockerExecutor: executes tasks inside Docker containers.
distributed_worker_pool.hpp—DistributedWorkerPool: workers connect over network.task_queue.hpp— Network-transparent task queue (future protocol).
logger.hpp—ILoggerinterface:log(Level, message).console_logger.hpp—ConsoleLogger: human-readable console output (v0.1).
metrics_collector.hpp—IMetricsCollectorinterface.prometheus_exporter.hpp— Prometheus text format exposition.
cli_app.hpp—CLIclass: parses args, dispatches to commands.commands/—RunCommand,StatusCommand, etc.
- v0.x: Public API may change between minor versions. No ABI stability guarantee.
- v1.0+: Public API is stable. ABI stability is guaranteed within the same major version.
See CONTRIBUTING.md (to be added). Key points:
- Format with
clang-formatbefore committing. - All tests and benchmarks must pass in CI.
- Design changes require a DDR in
docs/design/.
- Build configuration: Release
- Compiler: MSVC 19.50.35725
- Benchmark framework: Google Benchmark v1.9.1
- Logical CPUs reported: 16
- Repetitions: 5
| Benchmark | Tasks | Mean Time | CV |
|---|---|---|---|
| DAG Insert | 100 | 44.27 µs | 6.82% |
| DAG Insert | 1,000 | 551.30 µs | 23.10% |
| DAG Insert | 10,000 | 6.52 ms | 3.36% |
| DAG Validate — Independent | 100 | 106.42 µs | 4.92% |
| DAG Validate — Independent | 1,000 | 1.18 ms | 6.71% |
| DAG Validate — Independent | 10,000 | 18.20 ms | 16.07% |
| DAG Validate — Chain | 100 | 103.19 µs | 5.38% |
| DAG Validate — Chain | 1,000 | 1.33 ms | 4.13% |
| DAG Validate — Chain | 10,000 | 22.13 ms | 11.82% |
- Results are preliminary and were collected using five repetitions.
- DAG insertion measurements include task-name construction and container operations.
- DAG validation measurements cover missing-dependency checking, cycle detection, and topological sorting.
- Independent graphs contain no dependency edges; chain graphs contain N − 1 edges.
- Results may vary with system load and hardware conditions.
- No performance optimization has been applied against this baseline yet.