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: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:Step 5: Test Your Function
Now test your function by calling the HTTP endpoint: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:
- Received the HTTP POST request
- Routed it to the registered worker
- Invoked the
greet.hellofunction with the JSON payload - 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: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
Worker won't connect to engine
Worker won't connect to engine
- Ensure the engine is running (
iiicommand) - Verify the WebSocket URL is correct:
ws://localhost:49134 - Check firewall settings aren’t blocking port 49134
HTTP requests return 404
HTTP requests return 404
- Confirm the trigger was registered successfully
- Check the
api_pathmatches your request URL - Verify the worker is still connected (check engine logs)
Queue or Cron triggers don't work
Queue or Cron triggers don't work
- 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
Function errors aren't showing
Function errors aren't showing
- 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