Skip to content
/ FFlow Public
forked from thiagomvas/FFlow

FFlow is a lightweight, extensible workflow automation library for .NET with fluent, code-first syntax. Built for CI/CD, DevOps, and backend orchestration, it supports dependency injection, branching logic, and step decorators—no XML or DSL required.

License

Notifications You must be signed in to change notification settings

alokbya/FFlow

 
 

Repository files navigation

FFlow - Code first automations built fluently

FFlow is a fluent, code-first workflow automation library for .NET. It enables developers to orchestrate automation logic, business rules, and CI/CD pipelines in a fully testable and extensible way.

Table of Contents

Installation

You can install FFlow via the Nuget Package Manager or by using the .NET CLI

dotnet add package FFlow

Quickstart

Getting started with FFlow is easy. Here's an example of how to create a custom step that says 'Hello, FFlow!'. This example includes building a workflow with the builder, configuring it and executing it with an input.

 public class HelloStep : FlowStep
 {
     protected override Task ExecuteAsync(IFlowContext context, CancellationToken cancellationToken = default)
     {
         var input = context.GetInput<string>();
         Console.WriteLine($"Hello, {input}!");
         return Task.CompletedTask;
     }
 }

var workflow = new FFlowBuilder()
    .StartWith<HelloStep>()
    .Build();

await workflow.RunAsync("FFlow");

Features at a glance

  • Fluent syntax for flow control: StartWith(), Then(), Finally(), If(), Fork(), and more
  • Dependency Injection support: Inject services into steps via constructor injection
  • Validation utilities: Write step context validation attributes or steps with the help of FFlow.Validation
  • Branching and parallelism: Run parts of the workflow concurrently with different dispatch strategies
  • Context-aware: Pass and retrieve dynamic data throughout the workflow
  • Reusable definitions: Encapsulate workflows into a IWorkflowDefinition for factory-like behaviours
  • Lifecycle hooks: Plug into events like step start, step failure or workflow completion.

Why it exists

Writing and testing CI/CD pipelines has always been frustrating. It usually went from "waiting to compile" to "waiting for CI/CD", just to realize you missed something, fix it, and rerun the whole thing again. And again.

The feedback loop was too long. Small mistakes led to wasted time, and workflows often lived outside the codebase in YAML files or GUI editors that were hard to test, debug, or reuse.

FFlow was born out of this frustration. It came from the idea that automation should feel like regular code. Something you can write fluently, test locally, and plug into your existing services just like anything else in your app.

Tools like Cake or Nuke solve part of the problem, but I wanted something more structured and flexible. Less about running scripts. More about building flows.

Using with Dependency Injection

FFlow integrates cleanly with Microsoft.Extensions.DependencyInjection. To enable DI:

var services = new ServiceCollection();
services.AddFlow(); // Registers IFlowSteps and IWorkflowDefinitions
services.AddSingleton<IMyService, MyService>();

var provider = services.BuildServiceProvider();

var workflow = new FFlowBuilder(provider)
    .StartWith<StepThatUsesIMyService>()
    .Build();

Steps can receive services through construction injection:

public class StepThatUsesIMyService : FlowStep
{
    private readonly IMyService _service;

    public StepThatUsesIMyService(IMyService service)
    {
        _service = service;
    }

    protected override Task ExecuteAsync(IFlowContext context, CancellationToken ct)
    {
        var result = _service.DoSomething();
        return Task.CompletedTask;
    }
}

Testing

FFlow includes unit tests covering key features such as step execution, context flow, branching, validation, and DI integration. All you need to do is run

dotnet test

Contributing

Contributions to FFlow are welcome and appreciated. Whether it’s fixing a bug, suggesting an improvement, writing documentation, or proposing a new feature.

If you’ve worked with automation, DevOps, or pipeline tools and thought “this could be easier in code”, you’re in the right place. FFlow is still growing, and there’s a lot of room to help shape what it becomes.

You don’t need to understand the entire codebase to contribute. Most improvements are isolated and straightforward. It's designs allow you to add new steps, small helpers, validation logic, or workflow patterns without knowing everything about the project.

If you have an idea or just want to help, feel free to open an issue, start a discussion, or jump into the code.

License

FFlow is free software and always will be, released under the MIT License.
See the LICENSE file for more details.

About

FFlow is a lightweight, extensible workflow automation library for .NET with fluent, code-first syntax. Built for CI/CD, DevOps, and backend orchestration, it supports dependency injection, branching logic, and step decorators—no XML or DSL required.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%