Skip to content

Latest commit

 

History

History

README.md

Warning

Motia is deprecated. Active development has moved to iii.dev. Read the announcement · Migrating from Motia.js

Motia Banner

Motia Vercel OSS Program

Build production-grade backends with a single primitive

APIs, background jobs, workflows, AI agents, streaming, state management, and observability — unified in one framework. TypeScript, JavaScript, and Python.

npm version Apache 2.0 License GitHub stars Twitter Follow Discord

💡 Motia Manifesto🚀 Quick Start📋 Defining Steps📚 Docs


🚀 Create your first Motia App

Install the CLI:

brew tap MotiaDev/tap
brew install motia-cli

Or via shell script:

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

Then create a project:

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.

TypeScript
// 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 } };
};
// 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);
};
JavaScript
// 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 };
// 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 };
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}}
# 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)

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

Learn more about Steps →

Motia combines APIs, background queues, and AI agents into one system

🚀 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

brew tap MotiaDev/tap
brew install motia-cli

Or via shell script:

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

2. Bootstrap a New Motia Project

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. motia-terminal

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:

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)

iii Console Dashboard

📖 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

Type When it runs Use Case
http HTTP Request REST endpoints
queue Queue subscription Background processing
cron Schedule Recurring jobs
state State change State management
stream Stream subscription Real-time streaming

📖 Learn more about Steps →


🎯 Examples

🏆 ChessArena.ai - Full-Featured Production App

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

Live Website → | Source Code →

ChessArena.ai in action (raw GIF)

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 →

Example Description
AI Research Agent Web research with iterative analysis
Streaming Chatbot Real-time AI responses
Gmail Automation Smart email processing
GitHub PR Manager Automated PR workflows
Finance Agent Real-time market analysis

Features demonstrated: Multi-language workflows • Real-time streaming • AI integration • Production deployment


🌐 Language Support

Language Status
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.

Feature Status Link Description
Streams: RBAC ✅ Shipped #495 Add support for RBAC
Streams: iii Console UI ✅ Shipped #497 Stream visualization in iii Console
Queue Strategies ✅ Shipped #476 Add support for Queue Strategies
Reactive Steps ✅ Shipped #477 Add support for Reactive Steps
Point in time triggers 📅 Planned #480 Add support for Point in time triggers
Workbench plugins ⏹️ Sunset #481 Replaced by iii Console
Rewrite core in Rust ✅ Shipped #482 Rewrite our Core in Rust
Decrease deployment time ✅ Shipped #483 Decrease deployment time
Built-in database support 📅 Planned #484 Add support for built-in database

🤝 Contributing

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


🚀 Get Started📖 Docs💬 Discord

Star History Chart

Star us if you find Motia useful!