Skip to content

Creating Your First Flow

This guide walks you through creating your first automation flow in TinySystems. You'll build a simple HTTP webhook that processes incoming requests and returns a response.

Prerequisites

Before starting, ensure you have:

  • A TinySystems account
  • Access to a workspace
  • At least one connected cluster (or use the demo cluster)

Step 1: Create a New Project

  1. Navigate to your workspace dashboard
  2. Click New Project
  3. Enter a name (e.g., "My First Project")
  4. Select the target cluster
  5. Click Create

Step 2: Create a New Flow

  1. Inside your project, click New Flow
  2. Enter a name: "Hello World API"
  3. Click Create

The flow editor opens with an empty canvas.

Step 3: Add an HTTP Server Node

The HTTP Server component receives incoming HTTP requests.

  1. Open the node palette (left sidebar)
  2. Find HTTP Module > Server
  3. Drag it onto the canvas
  4. Click the node to select it

Configure the Server

In the properties panel (right sidebar):

  1. Click the Settings port (top of node)
  2. Configure:
    • Listen Address: :8080
    • Read Timeout: 30s
    • Write Timeout: 30s

Step 4: Add a Response

The HTTP Server has multiple output ports. We'll connect to the request port to handle incoming requests.

  1. Find the request output port (right side of Server node)
  2. This port emits data when requests arrive

For this example, we'll send a static response. The Server's request port data flows to whatever we connect to it.

Add a Modify Node

  1. From the palette, drag Common Module > Modify onto the canvas
  2. Position it to the right of the HTTP Server

Connect the Nodes

  1. Click the request port on the HTTP Server
  2. Drag to the input port on the Modify node
  3. Release to create an edge

Configure the Edge

Click on the edge (connection line) to configure data mapping:

yaml
# Map the incoming request to our response format
body: '{"message": "Hello, World!", "timestamp": "{{now()}}"}'
contentType: "application/json"
statusCode: 200

Step 5: Complete the Response

  1. Connect the Modify node's output port
  2. Drag to the HTTP Server's response port

This creates a loop: request comes in, gets modified, and goes back as a response.

Step 6: Deploy the Flow

  1. Click Deploy in the top toolbar
  2. Wait for deployment to complete (green status indicator)

Step 7: Test Your Flow

Get the Endpoint URL

  1. Click the HTTP Server node
  2. In the properties panel, find the Endpoint URL
  3. Copy the URL

Send a Test Request

Using curl:

bash
curl https://your-endpoint-url.tinysystems.io/

Expected response:

json
{
  "message": "Hello, World!",
  "timestamp": "2024-01-15T10:30:00Z"
}

Understanding What Happened

HTTP Request


┌──────────────┐
│  HTTP Server │ ─── Receives request on port 8080
└──────────────┘
    │ request port

┌──────────────┐
│   Modify     │ ─── Transforms data into response format
└──────────────┘
    │ output port

┌──────────────┐
│  HTTP Server │ ─── Sends response back to client
│  (response)  │
└──────────────┘
  1. HTTP Server listens for incoming requests
  2. When a request arrives, it emits data from the request port
  3. Modify transforms the data according to the edge configuration
  4. The response flows back to the Server's response port
  5. HTTP Server sends the response to the client

Adding Dynamic Content

Let's enhance the flow to include request information:

Update the Edge Configuration

Click the edge between Modify and HTTP Server response:

yaml
body: |
  {
    "message": "Hello from TinySystems!",
    "method": "{{$.method}}",
    "path": "{{$.path}}",
    "clientIP": "{{$.realIP}}",
    "timestamp": "{{now()}}"
  }
contentType: "application/json"
statusCode: 200

Now the response includes details from the incoming request.

Adding Error Handling

Create an Error Response

  1. Add another Modify node for error cases
  2. Configure it for error responses:
yaml
body: '{"error": "Something went wrong"}'
contentType: "application/json"
statusCode: 500

Use a Router for Conditional Logic

  1. Add a Router node between the Server and Modify
  2. Configure routes:
    • Route 1: {{$.path == "/health"}} → Health check response
    • Default: Regular response

Next Steps

Quick Tips

  1. Save Often: Flows auto-save, but you can manually save with Ctrl+S
  2. Use Debug Nodes: Add Debug components to inspect data at any point
  3. Check Logs: View execution logs in the bottom panel
  4. Zoom: Use scroll wheel to zoom, drag to pan the canvas

Build flow-based applications on Kubernetes