Skip to main content

Quickstart Guide

This guide walks you through creating your first iii function and exposing it via HTTP. You’ll have a working API endpoint in under 5 minutes.

Prerequisites

  • iii engine installed (installation guide)
  • Node.js, Python, or Rust development environment
  • Terminal/command line access

Step 1: Start the Engine

First, start the iii engine on your local machine:
You should see output indicating the engine has started:
The engine runs on two main ports:
  • 49134: WebSocket for worker connections
  • 3111: HTTP API for triggering functions

Step 2: Install the SDK

Choose your preferred language and install the corresponding SDK:

Step 3: Create Your First Function

Now create a simple greeting function that responds via HTTP.

Step 4: Run Your Worker

Execute your worker application:
You should see confirmation that your function is registered and ready.

Step 5: Test Your Function

Now test your function by calling the HTTP endpoint:
Expected response:
The function is automatically discovered and routed by the iii engine. No configuration files or manual registration required!

Understanding What Happened

Let’s break down what you just built:
1

Engine Started

The iii engine started and began listening for worker connections on port 49134 and HTTP requests on port 3111.
2

Worker Connected

Your worker application connected to the engine via WebSocket at ws://localhost:49134.
3

Function Registered

The greet.hello function was registered with the engine using the registerFunction SDK method.
4

Trigger Created

An HTTP trigger was created that maps POST /greet to the greet.hello function.
5

Request Routed

When you called the endpoint, the engine:
  1. Received the HTTP POST request
  2. Routed it to the registered worker
  3. Invoked the greet.hello function with the JSON payload
  4. Returned the function’s response as the HTTP response

Next: Add More Functionality

Now that you have a working function, let’s add more capabilities.

Add a Queue Trigger

Process messages asynchronously from a queue:
Queue triggers require Redis. Make sure Redis is running at redis://localhost:6379 or configure a different URL in your config.

Add a Cron Trigger

Schedule a function to run periodically:

Common Patterns

Invoke Functions from Other Functions

Functions can call each other:

Use Path Parameters

Extract values from URL paths:

Handle Multiple HTTP Methods

Register different triggers for the same function:

Troubleshooting

  • Ensure the engine is running (iii command)
  • Verify the WebSocket URL is correct: ws://localhost:49134
  • Check firewall settings aren’t blocking port 49134
  • Confirm the trigger was registered successfully
  • Check the api_path matches your request URL
  • Verify the worker is still connected (check engine logs)
  • These modules require Redis running at redis://localhost:6379
  • Start Redis: docker run -p 6379:6379 redis:7-alpine
  • Or configure a different Redis URL in config.yaml
  • Check worker console for error messages
  • Enable debug logging: RUST_LOG=debug iii
  • Functions should return errors in the format: { error: { code: 'ERR_CODE', message: 'Description' } }

What’s Next?

Core Concepts

Learn about Functions, Triggers, and Discovery in depth

Explore Modules

Discover all available modules: HTTP, Queue, Cron, Stream, State

SDK Reference

Dive into SDK documentation for your language

Deploy to Production

Learn best practices for production deployments
Pro tip: Use environment variables in your config for different environments. See the Configuration guide for details.