Skip to content

useflowkit/flowkit-core

Repository files navigation

flowkit

A minimal, developer-oriented workflow executor written in TypeScript.

flowkit

Why flowkit?

Most workflow automation tools focus on usability and accessibility — which makes them great for simple, visual automations. But once you need control, flexibility, or scale, you often run into limitations.

flowkit takes a different approach.

flowkit is a lightweight implementation that lets you define workflows as JSON/YAML and execute them directly in your code. It gives you the core execution logic.

Use it to:

  • Describe workflows declaratively
  • Run them programmatically
  • Extend with custom nodes as needed

It’s workflow automation as code — nothing more, and nothing less.

Get Started

npm install flowkit-core
import { WorkflowExecutor } from 'flowkit-core';

await executor.execute(
  'Webhook',
  {
    items: [
      {
        context: {},
        json: {
          hello: 'world',
        },
        metadata: {},
        outputIndex: 0,
      },
    ],
  },
  true,
);

Example Workflow

---
connections:
  Webhook:
    main:
      - - node: Fetch 1
          type: main
  Fetch 1:
    main:
      - - node: Unwind 1
          type: main
  Unwind 1:
    main:
      - - node: Switch 1
          type: main
  Switch 1:
    main:
      - - node: Echo 1
          type: main
      - - node: Echo 2
          type: main
          
nodes:
  - name: Webhook
    parameters:
      operation: default
    type: webhook

  - name: Fetch 1
    parameters:
      headers:
        Content-Type: application/json
      operation: GET
      url: https://fakerapi.it/api/v2/addresses?_quantity=1
    type: fetch

  - name: Unwind 1
    parameters:
      operation: default
      value: '=$json.body.json.data'
    type: unwind

  - name: Switch 1
    type: switch
    parameters:
      operation: default
      rules:
        - conditions:
            conditions:
              - expression: =$json.country_code === "DE"
            combinator: and
          name: Germany
        - conditions:
            conditions:
              - expression: =$json.country_code !== "DE"
            combinator: and
          name: Others

  - name: Echo 1
    parameters:
      operation: default
      message: Germany
    type: echo

  - name: Echo 2
    parameters:
      operation: default
      message: Others
    type: echo
Click to see the JSON version
{
  "connections": {
    "Webhook": { "main": [[{ "node": "Fetch 1", "type": "main" }]] },
    "Fetch 1": { "main": [[{ "node": "Unwind 1", "type": "main" }]] },
    "Unwind 1": { "main": [[{ "node": "Switch 1", "type": "main" }]] },
    "Switch 1": {
      "main": [
        [{ "node": "Echo 1", "type": "main" }],
        [{ "node": "Echo 2", "type": "main" }]
      ]
    }
  },
  "nodes": [
    {
      "name": "Webhook",
      "parameters": { "operation": "default" },
      "type": "webhook"
    },
    {
      "name": "Fetch 1",
      "parameters": {
        "headers": { "Content-Type": "application/json" },
        "operation": "GET",
        "url": "https://fakerapi.it/api/v2/addresses?_quantity=1"
      },
      "type": "fetch"
    },
    {
      "name": "Unwind 1",
      "parameters": {
        "operation": "default",
        "value": "=$json.body.json.data"
      },
      "type": "unwind"
    },
    {
      "name": "Switch 1",
      "type": "switch",
      "parameters": {
        "operation": "default",
        "rules": [
          {
            "conditions": {
              "conditions": [
                { "expression": "=$json.country_code === \"DE\"" }
              ],
              "combinator": "and"
            },
            "name": "South Africa"
          },
          {
            "conditions": {
              "conditions": [
                { "expression": "=$json.country_code !== \"DE\"" }
              ],
              "combinator": "and"
            },
            "name": "Others"
          }
        ]
      }
    },
    {
      "name": "Echo 1",
      "parameters": { "operation": "default", "message": "Germany" },
      "type": "echo"
    },
    {
      "name": "Echo 2",
      "parameters": { "operation": "default", "message": "Others" },
      "type": "echo"
    }
  ]
}

Philosophy

flowkit doesn’t aim to replace existing automation platforms. It exists for when those platforms fall short — when you want to own the logic, run it anywhere, and extend it freely. It’s the foundation for workflows that need to be versioned, tested, and understood by developers.

If you’ve ever had to fight a platform to do what should be simple — flowkit is for you.

License

MIT

About

A minimal, developer-oriented workflow executor written in TypeScript.

Topics

Resources

License

Stars

Watchers

Forks