Prana

Prana is a powerful Elixir workflow automation platform built around a node-based graph execution model. It orchestrates complex workflows consisting of nodes (triggers, actions, logic, wait, output) connected through explicit ports with conditional routing and expression-based data flow.

Key Features

Quick Start

Installation

Add prana to your mix.exs dependencies:

def deps do
  [
    {:prana, "~> 0.1.0"}
  ]
end

Basic Usage

# 1. Start the integration registry
{:ok, _registry} = Prana.IntegrationRegistry.start_link()

# 2. Register built-in integrations
:ok = Prana.IntegrationRegistry.register_integration(Prana.Integrations.Manual)
:ok = Prana.IntegrationRegistry.register_integration(Prana.Integrations.Logic)

# 3. Create a simple workflow
workflow = %Prana.Workflow{
  id: "hello_world",
  name: "Hello World Workflow",
  version: 1,
  nodes: [
    %Prana.Node{
      key: "start",
      name: "Start Trigger",
      type: "manual.trigger",
      params: %{}
    },
    %Prana.Node{
      key: "process",
      name: "Process Data",
      type: "manual.process_adult",
      params: %{
        "message" => "{{ $input.message }}",
        "user" => "{{ $input.user }}"
      }
    }
  ],
  connections: %{
    "start" => %{
      "main" => [
        %Prana.Connection{
          from: "start",
          from_port: "main",
          to: "process",
          to_port: "main"
        }
      ]
    }
  },
  variables: %{}
}

# 4. Compile and execute
{:ok, execution_graph} = Prana.WorkflowCompiler.compile(workflow, "start")

result = Prana.GraphExecutor.execute_workflow(
  execution_graph,
  %{"message" => "Hello", "user" => "World"},
  %{}
)

{:ok, completed_execution} = result

Core Concepts

Workflow Structure

Workflows are directed graphs composed of:

Template System

Access data anywhere in your workflow:

# Simple field access
"{{ $input.user.email }}"                    # Input data
"{{ $nodes.api_call.response.user_id }}"     # Previous node results  
"{{ $variables.api_url }}"                   # Workflow variables

# Array operations
"{{ $input.users[0].name }}"                 # Index access
"{{ $input.users }}"                         # Full arrays

# Arithmetic and boolean expressions
"{{ $input.age + 10 }}"                      # Math operations
"{{ $input.age >= 18 && $input.verified }}" # Boolean logic

# Filters
"{{ $input.name | upper_case }}"             # Transform data
"{{ $input.price | format_currency('USD') }}" # Formatted output

Node Types

Built-in Integrations

Manual Integration

Simple test actions for development and debugging:

HTTP Integration

HTTP requests and webhooks:

Schedule Integration

Time-based workflow triggers:

Logic Integration

Conditional workflow control:

Data Integration

Data combination and transformation:

Wait Integration

Time-based coordination:

Workflow Integration

Sub-workflow orchestration:

Development

Setup

# Get dependencies
mix deps.get

# Compile project
mix compile

# Run tests
mix test

# Code analysis
mix credo

# Format code
mix format

Testing

# Run all tests
mix test

# Run specific test file
mix test test/prana/node_executor_test.exs

# Detailed test output
mix test --trace

# Watch mode
mix test.watch

Interactive Development

# Start IEx with project loaded
iex -S mix

# Quick test in IEx
iex> {:ok, _} = Prana.IntegrationRegistry.start_link()
iex> Prana.IntegrationRegistry.register_integration(Prana.Integrations.Manual)

Creating Custom Integrations

For detailed guidance on creating custom integrations, see the Writing Integrations Guide. This comprehensive guide covers:

Architecture

Core Components

Execution Flow

  1. Compilation: Workflow → ExecutionGraph (optimized for execution)
  2. Initialization: Create execution context with input data and variables
  3. Node Execution: Sequential execution following dependencies and conditions
  4. Template Processing: Dynamic data access, expressions, and filters
  5. Port Routing: Data flow through explicit connections
  6. Completion: Final execution state with all node results

Design Principles

Documentation

Testing

Prana has comprehensive test coverage:

# Current test status
mix test
# => 353 tests, 0 failures

Implementation Status

Overall Progress: ~98% Complete (Production Ready Platform)

Complete

Future Enhancements

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Run tests: mix test
  4. Add tests for new functionality
  5. Commit changes: git commit -m 'Add amazing feature'
  6. Push to branch: git push origin feature/amazing-feature
  7. Create Pull Request

Development Guidelines

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Ready to build powerful workflows? Check out the Quick Start guide and start orchestrating your processes with Prana!