Back to Iii

README

frameworks/motia/README.md

0.13.014.0 KB
Original Source

[!IMPORTANT] πŸš€ Motia 1.0-RC is here β€” now powered by the iii engine, a Rust-based runtime that manages queues, state, streams, cron, and observability through a single iii-config.yaml.

πŸ“– Migration Guide (v0.17 β†’ v1.0) Β· πŸš€ Quick Start

<a href="https://motia.dev"> </a> <p align="center"> <a href="https://trendshift.io/repositories/14032" style="margin-right:8px;"> </a> <a href="https://vercel.com/blog/summer-2025-oss-program#motia" target="_blank" style="margin-left:8px;"> </a> </p> <p align="center"> <strong>Build production-grade backends with a single primitive</strong> </p> <p align="center"> <em>APIs, background jobs, workflows, AI agents, streaming, state management, and observability β€” unified in one framework. TypeScript, JavaScript, and Python.</em> </p> <p align="center"> <a href="https://www.npmjs.com/package/motia"> </a> <a href="https://github.com/MotiaDev/motia/blob/main/LICENSE"> </a> <a href="https://github.com/MotiaDev/motia"> </a> <a href="https://twitter.com/motiadev" target="_blank"> </a> <a href="https://discord.gg/motia" target="_blank"> </a> </p> <p align="center"> <a href="https://www.motia.dev/manifesto">πŸ’‘ Motia Manifesto</a> β€’ <a href="https://www.motia.dev/docs/getting-started/quick-start">πŸš€ Quick Start</a> β€’ <a href="https://www.motia.dev/docs/concepts/steps">πŸ“‹ Defining Steps</a> β€’ <a href="https://www.motia.dev/docs">πŸ“š Docs</a> </p>

πŸš€ Create your first Motia App

Install the CLI:

bash
brew tap MotiaDev/tap
brew install motia-cli

Or via shell script:

bash
curl -fsSL https://raw.githubusercontent.com/MotiaDev/motia-cli/main/install.sh | sh

Then create a project:

bash
motia-cli create my-app

πŸ“– Full quickstart guide β†’


🎯 What is Motia?

Backend development today is fragmented.

APIs live in one framework, background jobs in another, queues and schedulers elsewhere, and now AI agents and streaming systems have their own runtimes. Add observability and state management on top, and you're stitching together half a dozen tools before writing your first feature.

Motia unifies all of these concerns around one core primitive: the Step.

Just as React made frontend development simple by introducing components, Motia redefines backend development with Steps - a single primitive that handles everything.

Every backend pattern, API endpoints, background jobs, queues, workflows, AI agents, streaming, observability, and state, is expressed with the same primitive.

To read more about this, check out our manifesto.


The Core Primitive: the Step

A Step is just a file with a config and a handler. Motia auto-discovers these files and connects them automatically.

Here's a simple example of two Steps working together: an HTTP Step that enqueues a message, and a Queue Step that processes it.

<details open> <summary><b>TypeScript</b></summary>
ts
// steps/send-message.step.ts
export const config = {
  name: 'SendMessage',
  triggers: [
    {
      type: 'http',
      method: 'POST',
      path: '/messages',
    }
  ],
  enqueues: ['message.sent']
};

export const handler = async (req, { enqueue }) => {
  await enqueue({
    topic: 'message.sent',
    data: { text: req.body.text }
  });
  return { status: 200, body: { ok: true } };
};
ts
// steps/process-message.step.ts
export const config = {
  name: 'ProcessMessage',
  triggers: [
    {
      type: 'queue',
      topic: 'message.sent',
    }
  ],
};

export const handler = async (input, { logger }) => {
  logger.info('Processing message', input);
};
</details> <details> <summary><b>JavaScript</b></summary>
js
// steps/send-message.step.js
const config = {
  name: 'SendMessage',
  triggers: [
    {
      type: 'http',
      method: 'POST',
      path: '/messages',
    }
  ],
  enqueues: ['message.sent']
};

const handler = async (req, { enqueue }) => {
  await enqueue({
    topic: 'message.sent',
    data: { text: req.body.text }
  });
  return { status: 200, body: { ok: true } };
};

module.exports = { config, handler };
js
// steps/process-message.step.js
const config = {
  name: 'ProcessMessage',
  triggers: [
    {
      type: 'queue',
      topic: 'message.sent',
    }
  ],
};

const handler = async (input, { logger }) => {
  logger.info('Processing message', input);
};

module.exports = { config, handler };
</details> <details> <summary><b>Python</b></summary>
python
# steps/send_message_step.py
config = {
    "name": "SendMessage",
    "triggers": [
        {
            "type": "http",
            "method": "POST",
            "path": "/messages",
        }
    ],
    "enqueues": ["message.sent"],
}


async def handler(req, ctx):
    await ctx.enqueue({
        "topic": "message.sent",
        "data": {"text": req.body.get("text")},
    })
    return {"status": 200, "body": {"ok": True}}
python
# steps/process_message_step.py
config = {
    "name": "ProcessMessage",
    "triggers": [
        {
            "type": "queue",
            "topic": "message.sent",
        }
    ],
}


async def handler(input, ctx):
    ctx.logger.info("Processing message", input)
</details>

πŸ‘‰ With just two files, you've built an API endpoint, a queue, and a worker. No extra frameworks required.

Learn more about Steps β†’

πŸš€ Quickstart

Get Motia project up and running in under 60 seconds:

0. Prerequisites

  • Node.js 18+ β€” for TypeScript/JavaScript Steps
  • Python 3 β€” optional, for Python Steps

1. Install the Motia CLI

bash
brew tap MotiaDev/tap
brew install motia-cli

Or via shell script:

bash
curl -fsSL https://raw.githubusercontent.com/MotiaDev/motia-cli/main/install.sh | sh

2. Bootstrap a New Motia Project

bash
motia-cli create my-app

The CLI auto-detects and installs the iii engine if it's not already on your system.

Follow the prompts to pick a language and template.

3. Start the iii Engine

Inside your new project folder (the iii-config.yaml was generated by the create command above), start the iii engine:

bash
iii -c iii-config.yaml

That's it! You have:

  • βœ… REST APIs with validation
  • βœ… Multi-language support
  • βœ… Event-driven architecture
  • βœ… Zero configuration
  • βœ… AI development guides included (Cursor, OpenCode, Codex, and more)

πŸ“– Full tutorial in our docs β†’

πŸ€– AI-Assisted Development

Every Motia project includes detailed AI development guides that work with any AI coding tool:

The guides include patterns for API endpoints, background tasks, state management, real-time streaming, and complete architecture blueprints.

πŸ€– Learn more about AI development support β†’

🎯 Triggers

TypeWhen it runsUse Case
httpHTTP RequestREST endpoints
queueQueue subscriptionBackground processing
cronScheduleRecurring jobs
stateState changeState management
streamStream subscriptionReal-time streaming

πŸ“– Learn more about Steps β†’


🎯 Examples

A complete chess platform benchmarking LLM performance with real-time evaluation.

Live Website β†’ | Source Code β†’

Built from scratch to production deployment, featuring:

  • πŸ” Authentication & user management
  • πŸ€– Multi-agent LLM evaluation (OpenAI, Claude, Gemini, Grok)
  • 🐍 Python engine integration (Stockfish chess evaluation)
  • πŸ“Š Real-time streaming with live move updates and scoring
  • 🎨 Modern React UI with interactive chess boards
  • πŸ”„ Event-driven workflows connecting TypeScript APIs to Python processors
  • πŸ“ˆ Live leaderboards with move-by-move quality scoring
  • πŸš€ Production deployment on Motia Cloud

πŸ“š More Examples

View all 20+ examples β†’

ExampleDescription
AI Research AgentWeb research with iterative analysis
Streaming ChatbotReal-time AI responses
Gmail AutomationSmart email processing
GitHub PR ManagerAutomated PR workflows
Finance AgentReal-time market analysis

Features demonstrated: Multi-language workflows β€’ Real-time streaming β€’ AI integration β€’ Production deployment


🌐 Language Support

LanguageStatus
JavaScriptβœ… Stable
TypeScriptβœ… Stable
Pythonβœ… Stable
Ruby🚧 Beta
GoπŸ”„ Soon

πŸ“š Resources

🚧 Roadmap

We have a public roadmap for Motia, you can view it here.

Feel free to add comments to the issues, or create a new issue if you have a feature request.

FeatureStatusLinkDescription
Streams: RBACβœ… Shipped#495Add support for RBAC
Streams: iii Console UIβœ… Shipped#497Stream visualization in iii Console
Queue Strategiesβœ… Shipped#476Add support for Queue Strategies
Reactive Stepsβœ… Shipped#477Add support for Reactive Steps
Point in time triggersπŸ“… Planned#480Add support for Point in time triggers
Workbench plugins⏹️ Sunset#481Replaced by iii Console
Rewrite core in Rustβœ… Shipped#482Rewrite our Core in Rust
Decrease deployment timeβœ… Shipped#483Decrease deployment time
Built-in database supportπŸ“… Planned#484Add support for built-in database

🀝 Contributing

We welcome contributions! Check our Contributing Guide to get started.


<div align="center">

πŸš€ Get Started β€’ πŸ“– Docs β€’ πŸ’¬ Discord

<a href="https://git-history.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://git-history.com/api/embed/stars?repos=MotiaDev/motia&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://git-history.com/api/embed/stars?repos=MotiaDev/motia&theme=light" /> </picture> </a>

<sub>⭐ Star us if you find Motia useful!</sub>

</div>