Skip to content

MotiaDev/motia

Repository files navigation

Motia

Motia Logo

πŸ”₯ A Modern Unified Backend Framework for APIs, Events and Agents πŸ”₯

npm version license GitHub stars Twitter Follow Discord

πŸ’‘ Motia Manifesto β€’ πŸš€ Quick Start β€’ πŸ“‹ Defining Steps β€’ πŸ“š Docs


🎯 What is Motia?

Motia is a modern backend framework that unifies APIs, background jobs, events, and AI agents into a single cohesive system. Eliminate runtime complexity and build unified backends where JavaScript, TypeScript, Python, etc, work together in event-driven workflows, with built-in state management, observability, and one-click deployments.

Motia brings cohesion to the fragmented backend world with our core primitive: the Step. Think of Steps like React Components, but for backends.

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

🧱 The Step Philosophy

  • 🎯 Single Purpose: Each Step performs one task
  • 🌍 Language agnostic: Each Step can be in a different language while being part of the same workflow
  • ⚑ Versatile: Steps can trigger APIs, background jobs, and AI Agents
  • πŸ‘οΈ Observable: Everything is observable by default
  • 🌊 Workflows: Collections of connected steps that form complete processes
  • πŸͺ State Management: Shared state across all steps with full traceability

🚧 The Problem

Backend teams juggle fragmented runtimes across APIs, background queues, and AI agents. This creates deployment complexity, debugging gaps, and cognitive overhead from context-switching between frameworks.

This fragmentation demands a unified system.


βœ… The Unified System

Motia unifies your entire backend into a unified state. APIs, background jobs, and AI agents become interconnected Steps with shared state and integrated observability.

Before After (Motia)
Multiple deployment targets Single unified deployment
Fragmented observability End-to-end tracing
Language dependent JavaScript, TypeScript, Python, etc
Context-switching overhead Single intuitive model
Complex error handling Automatic retries & fault tolerance

πŸ”§ Supported Step Types

Type Trigger Use Case
api HTTP Request Expose REST endpoints
event Emitted Topics React to internal or external events
cron Scheduled Time (cron) Automate recurring jobs
noop None Placeholder for manual/external tasks

πŸš€ Quickstart

Get up and running in under 60 seconds:

1. Create Your Project

npx motia@latest create -i
  • Enter project details like template, project name, etc

2. Write Your First Step

Open 01-api.step.ts and create a simple API endpoint:

exports.config = {
  type: 'api',           // Step type: "api", "event", "cron", or "noop"
  path: '/hello-world',  // API endpoint path
  method: 'GET',         // HTTP method
  name: 'HelloWorld',    // Step identifier
  emits: ['test-state'], // Events this step emits
  flows: ['default'],    // Flow this step belongs to
}

exports.handler = async () => {
  return {
    status: 200,
    body: { message: 'Hello World from Motia!' },
  }
}

3. Launch the Workbench

Start the visual development environment:

npm run dev
# Opens at http://localhost:3000

πŸŽ‰ That's it! You now have a fully functional Motia app with:

  • βœ… API endpoint at /hello-world
  • βœ… Visual debugger and flow inspector
  • βœ… Built-in observability
  • βœ… Hot reload for instant feedback

4. Explore the Workbench

From the Workbench, navigate to:

  • πŸ“Š Logs: Structured logs for each step execution with inputs, outputs, and errors
  • πŸͺ States: View internal state and data passed between steps using traceID
  • πŸ”Œ Endpoints: Test all your API endpoints directly from the UI
  • 🌊 Flows: Visually inspect how your steps connect and what each step does

πŸ—‚ Examples

Finance Agent GitHub Agent Gmail Manager
Finance
Financial insights
GitHub
PR automation
Gmail
Email automation
Trello Automation RAG Agent AI Image Gen
Trello
Task automation
RAG
Knowledge retrieval
AI Image
Generate images

🌐 Language Support

Write steps in your preferred language:

Language Status Example
JavaScript βœ… Stable handler.step.js
TypeScript βœ… Stable handler.step.ts
Python βœ… Stable handler.step.py
Ruby πŸ”„ Coming Soon handler.step.rb
Go πŸ”„ Coming Soon handler.step.go
Rust πŸ”„ Coming Soon handler.step.rs

πŸ’¬ Get Help

🀝 Contributing

πŸš€ Roadmap

We're building Motia in the open, and we'd love for you to be a part of the journey.

Check out our public roadmap to see what’s planned, what’s in progress, and what’s recently shipped:

πŸ‘‰ View our public Roadmap

We welcome contributions! Whether it's:

  • πŸ› Bug fixes and improvements
  • ✨ New features and step types
  • πŸ“š Documentation and examples
  • 🌍 Language support additions
  • 🎨 Workbench UI enhancements

Check out our Contributing Guide to get started.


🌟 Ready to unify your backend?

πŸš€ Get Started Now β€’ πŸ“– Read the Docs β€’ πŸ’¬ Join Discord


Built with ❀️ by the Motia team β€’ Star us on GitHub if you find Motia useful! ⭐