Skip to content

Latest commit

 

History

History
124 lines (85 loc) · 1.93 KB

File metadata and controls

124 lines (85 loc) · 1.93 KB

User Manual

What Stockflow does

Stockflow executes business workflows written in YAML.

You define workflow logic once in YAML, and the runtime executes it through API endpoints.

Project background

  • Inspired by Kestra and Supabase.
  • Built to support a safer, more controlled backend workflow model for security-sensitive use cases.

End-to-end usage

1. Create your database tables

Design and create your PostgreSQL tables first.

2. Generate DB artifacts

From stockflow/ run:

npm run db:generate

This generates/updates Drizzle artifacts used by the project.

3. Create YAML workflow files

Add files under:

  • stockflow/data/functions/

Basic YAML shape:

name: myFunction
version: 1
temporal: true

params:
  id:
    type: string
    required: true

steps:
  - name: result
    type: query
    with:
      collection: customers
      filter:
        eq:
          - id
          - "{{params.id}}"

return:
  data: "{{steps.result}}"

Temporal flags:

  • Set top-level temporal: true to run all steps with temporal routing.
  • Set temporal on a specific step to override the top-level value for only that step.
  • TEMPORAL_STEP_EXECUTOR_URL controls where temporal-routed steps are sent.
  • If TEMPORAL_STEP_EXECUTOR_URL is not set, flagged steps execute locally.

4. Execute YAML via API

Endpoint:

  • POST /api/rpc

Request body:

{
  "operation": "myFunction",
  "params": {
    "id": "123"
  }
}

YAML step types

Supported step types:

  • call
  • map
  • editField
  • reference
  • query
  • persist
  • condition
  • loop

Running Stockflow

Local

cd stockflow
npm install
npm run dev

Docker

docker compose up

Required environment variables

  • DATABASE_URL
  • JWT_SECRET

Notes

  • Keep YAML names consistent with API operation values.
  • Use db:generate whenever schema changes.
  • Do not commit real credentials to source control.