Skip to content

shakirmengrani/workflow-automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Workflow automation

Workflow automation is a comprehensive YAML-first backend runtime platform that combines workflow orchestration, API execution, and business process management. It provides a secure, controlled environment for executing business logic defined in YAML files.

πŸš€ Features

  • YAML-First Execution: Define business workflows in YAML and execute them through REST APIs
  • Multi-Service Architecture: Integrated Temporal workflows, N8N automation, and PostgreSQL database
  • Authentication & Authorization: OAuth2 proxy integration with role-based access control
  • Database Management: Drizzle ORM with PostgreSQL and Row Level Security (RLS)
  • API Gateway: Traefik reverse proxy for service routing
  • MCP Integration: Model Context Protocol support for AI tool exposure
  • Admin Interface: PgAdmin for database administration

πŸ—οΈ Architecture

The platform consists of several interconnected services:

  • Stockflow API: Main execution engine for YAML workflows
  • Temporal: Distributed workflow orchestration
  • N8N: Node-based workflow automation
  • PostgreSQL: Primary database with RLS
  • Traefik: API gateway and load balancer
  • OAuth2 Proxy: Authentication middleware
  • PgAdmin: Database administration interface

πŸ“‹ Prerequisites

  • Docker and Docker Compose
  • Node.js 18+ (for local development)
  • PostgreSQL client (optional, for direct DB access)

πŸƒβ€β™‚οΈ Quick Start

Using Docker Compose

  1. Clone the repository

    git clone <repository-url>
    cd autobizt/supabase
  2. Configure environment

    cp .env.example .env
    # Edit .env with your configuration
  3. Start all services

    docker compose up -d
  4. Access the services

Local Development

  1. Setup Stockflow

    cd stockflow
    npm install
    npm run db:generate
    npm run dev
  2. Setup Temporal (optional)

    cd temporal
    npm install
    npm run worker

πŸ“– Usage

1. Database Setup

Create your PostgreSQL tables first, then generate Drizzle artifacts:

cd stockflow
npm run db:generate
npm run db:migrate

2. Create YAML Functions

Add workflow files in stockflow/data/functions/:

name: createCustomer
version: 1
skill: true
title: "Create new customer"

params:
  email:
    type: string
    required: true
  name:
    type: string
    required: true
  phone:
    type: string
    required: true

steps:
  - name: persistCustomer
    type: persist
    actions:
      - mode: insert
        collection: customers
        document:
          name: "{{params.name}}"
          email: "{{params.email}}"
          phone: "{{params.phone}}"

return: "{{steps.persistCustomer}}"

3. Execute Workflows

Call the runtime API:

curl -X POST http://localhost:8080/api/rpc \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "createCustomer",
    "params": {
      "name": "John Doe",
      "email": "john@example.com",
      "phone": "+1234567890"
    }
  }'

πŸ”§ Configuration

Environment Variables

See .env.example for all available configuration options. Key variables:

  • DATABASE_URL: PostgreSQL connection string
  • JWT_SECRET: Secret key for JWT tokens
  • OAUTH2_PROXY_*: OAuth2 proxy configuration
  • TEMPORAL_HOST: Temporal server address
  • OPENAI_API_KEY: OpenAI API key for AI workflows

Database Schema

The system includes comprehensive business entities:

  • Users & Roles: Authentication and authorization
  • Customers & Suppliers: Business partners
  • Products & Inventory: Product management with batches
  • Quotations & Invoices: Sales process
  • Purchase Orders: Procurement
  • Journal Entries: Accounting
  • Delivery Challans: Shipping documents

πŸ“š API Reference

Stockflow API

  • GET /api - Health check
  • POST /api/rpc - Execute YAML function
  • POST /api/query - Run database queries
  • POST /mcp - MCP tool execution

YAML Step Types

  • call - Execute system functions
  • map - Transform data
  • editField - Modify object properties
  • reference - Call other YAML functions
  • query - Database queries
  • persist - Database operations (insert/update/delete)
  • condition - Conditional logic
  • loop - Iterate over arrays

πŸ”’ Security

  • Row Level Security (RLS): Database-level access control
  • OAuth2 Authentication: External identity provider integration
  • JWT Tokens: Stateless authentication
  • Role-Based Access: Admin, Staff, Viewer roles

πŸ§ͺ Development

Running Tests

cd stockflow
npm test

Building

cd stockflow
npm run build

Database Operations

# Generate schema
npm run db:generate

# Push migrations
npm run db:migrate

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and validation
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.

πŸ™‹ Support

For questions and support:

  • Check the documentation in DOCS.md
  • Review USER_MANUAL.md for usage examples
  • Check AGENT.md for development guidelines

πŸ”„ Migration Notes

  • The project evolved from individual services to an integrated platform
  • Legacy bpm_engine/ and standalone temporal/ are preserved but not actively maintained
  • Focus is on the unified stockflow/ runtime with multi-service orchestration

About

Workflow automation is a comprehensive YAML-first backend runtime platform that combines workflow orchestration, API execution, and business process management. It provides a secure, controlled environment for executing business logic defined in YAML files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors