Prerequisites
Before you begin, ensure you have:- Node.js 18+ for TypeScript/JavaScript Steps
- Python 3.10+ (optional) for Python Steps
- curl or Homebrew for CLI installation
Step 1: Install the Motia CLI
- Homebrew
- Shell Script
The Motia CLI will automatically install the iii engine when you create your first project.
Verify Installation
Step 2: Create Your First Project
Create a new Motia project using the CLI:- Choose a language (TypeScript, JavaScript, or Python)
- Select a template (basic, todo app, or custom)
- Auto-install the iii engine if not already present
The CLI generates an
iii-config.yaml file that configures the runtime environment.Step 3: Navigate to Your Project
Step 4: Start the iii Engine
Start the iii engine to power your Motia app:- ✅ HTTP server running on port 3111
- ✅ WebSocket server on port 49134
- ✅ Stream API on port 3112
- ✅ Metrics available on port 9464
iii Console Dashboard
Access the iii Console at
http://localhost:3112 to view your Steps, monitor requests, and inspect logs in real-time.Step 5: Test Your First Step
Let’s examine the generatedhello-api.step.ts (or .js/.py depending on your choice):
Make a Request
Test your endpoint with curl:Success!
You’ve just created and tested your first Motia Step! The HTTP trigger automatically mapped your handler to
/hello.What You Have Now
With this simple setup, you already have:REST APIs
HTTP endpoints with automatic validation
Type Safety
Zod schema validation and TypeScript support
Logging
Structured logging out of the box
Zero Config
Auto-discovery means no manual wiring
Add a Background Job
Let’s extend this with a queue-based background job. Create a new file:Next Steps
You’ve now built an API endpoint with background job processing! Here’s what to explore next:Learn Step Anatomy
Understand the config and handler pattern in depthGo to Your First Step →
Explore Triggers
Add cron jobs, state listeners, and stream subscriptionsView Trigger Types →
Add State Management
Store and react to state changesLearn about State →
Build Real-time Features
Use streams for real-time data synchronizationExplore Streams →
Troubleshooting
iii engine not starting
iii engine not starting
Ensure Redis is running if you’re using queue or stream features:Or disable them in
iii-config.yaml if not needed.Steps not being discovered
Steps not being discovered
Steps must:
- Be in the
steps/directory - Have
.step.ts,.step.js, or_step.pysuffix - Export both
configandhandler
Port already in use
Port already in use
Change ports in
iii-config.yaml:Resources
Examples
20+ production examples
Discord
Get help from the community
API Reference
Complete API documentation