Thanks to visit codestin.com
Credit goes to github.com

Skip to content
forked from MotiaDev/motia

Modern Backend Framework that unifies APIs, background jobs, workflows, and AI agents into a single cohesive system with built-in observability and state management.

License

Notifications You must be signed in to change notification settings

cloudhuang/motia

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Motia Banner

Motia Vercel OSS Program

πŸ”₯ The Unified Backend Framework That Eliminates Runtime Fragmentation πŸ”₯

APIs, background jobs, workflows, and AI agents in one system. JavaScript, TypeScript, Python, and more in one codebase.

npm version license GitHub stars Twitter Follow Discord

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


🎯 What is Motia?

Motia solves backend fragmentation.

Modern software engineering is splintered – APIs live in one framework, background jobs in another, queues have their own tooling, and AI agents are springing up in yet more isolated runtimes. This fragmentation demands a unified system.

Motia unifies APIs, background jobs, workflows, and AI agents into a single coherent system with shared observability and developer experience. Similar to how React simplified frontend development where everything is a component, Motia simplifies backend development where everything is a Step.

Write JavaScript, TypeScript, Python, and more in the same workflow. What used to take 5 frameworks to build now comes out of the box with Motia.

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

πŸš€ Quickstart

Get Motia project up and running in under 60 seconds:

1. Bootstrap a New Motia Project

npx motia@latest create -i   # runs the interactive terminal

Follow the prompts to pick a template, project name, and language.

2. Start the Workbench

Inside your new project folder, launch the dev server:

npx motia dev # ➜ http://localhost:3000

This spins up the Motia Workbench – a local UI for building, testing & observing your backend in real-time.

motia-terminal

3. Hit Your First Endpoint

Open a new terminal tab and run:

curl http://localhost:3000/default

You should see the JSON response:

{ "message": "Hello World from Motia!" }

4. Explore the Workbench UI

new-workbench The Workbench is your command centre:

  • 🌊 Flows – Visualise how your Steps connect.
  • πŸ”Œ Endpoints – Test APIs with one click and stream results live.
  • πŸ‘οΈ Traces – Inspect end-to-end traces of every execution.
  • πŸ“Š Logs – View structured logs grouped by trace.
  • πŸͺ State – Inspect the key-value store across Steps.

πŸŽ‰ That's it! You now have a production-ready backend with everything you need:

  • βœ… REST API endpoints with automatic validation and error handling
  • βœ… Visual debugger with real-time flow inspection and tracing
  • βœ… Built-in observability - logs, traces, and state visualization
  • βœ… Hot-reload for instant feedback during development
  • βœ… Event-driven architecture ready for complex workflows
  • βœ… Multi-language support - add Python, Javascript, or other languages anytime
  • βœ… Zero configuration - no infrastructure setup required

πŸ’‘ Want a more detailed walkthrough?
Check out the Quick Start guide in our docs for step-by-step instructions and more examples.

🧱 The Step Philosophy

Everything is a Step – similar to how React made everything a component, Motia makes every backend pattern a Step:

  • 🎯 Steps Represent Distinct Entry Points: APIs, background jobs, scheduled tasks, and AI agents – all unified under a single primitive
  • 🌍 Any Language, One Workflow: Write JavaScript, TypeScript, Python, and more in the same project. Use Python for AI agents, TypeScript for APIs, JavaScript for workflows – all sharing state effortlessly
  • ⚑ Enterprise-Grade, Out of the Box: Get event-driven architecture, fault tolerance, observability, and real-time streaming without complex infrastructure setup
  • πŸ‘οΈ Automatic Observability: Complete end-to-end tracing, structured logging, and state visualization. No setup required – works in both local development and production
  • 🌊 Composable Workflows: Connect Steps by emitting and subscribing to events. Build complex, multi-stage processes with simple, declarative code
  • πŸͺ Unified State Management: All Steps share a traced key-value store. Every get, set, and delete is automatically tracked across your entire workflow
  • πŸ”„ Built-in Fault Tolerance: Retry mechanisms, error handling, and queue infrastructure abstracted away – focus on business logic, not infrastructure

🚧 The Fragmentation Problem

Today, backend engineers face several recurring challenges:

  • 🧩 Fragmented Systems: APIs in Express, background jobs in Celery/BullMQ, AI agents in LangChain – each with different deployment, debugging, and scaling patterns
  • 🌐 Multi-Language Barriers: AI tools in Python, business logic in TypeScript – forcing teams to choose between cutting-edge tech and their existing skillset
  • πŸ” Observability Gaps: Tracing requests across multiple frameworks and runtimes is complex and often incomplete
  • βš–οΈ Scalability vs. Velocity: Choose between fast development (monolith) or proper scaling (microservices complexity)
  • πŸš€ Deployment Complexity: Multiple runtimes mean multiple deploy targets, configs, and failure points

The rapid advancement of AI has made this worse – many cutting-edge AI tools are only available in specific languages, forcing companies to abandon their existing tech stack or miss out on breakthrough technologies.


βœ… The Motia Solution

Motia removes this limitation by unifying your entire backend into a single runtime where everything is a Step:

🎯 Unified vs. Fragmented

  • Before: APIs in Express, jobs in BullMQ, AI agents in LangChain
  • After: All backend patterns as composable Steps with shared state and observability

🌐 True Multi-Language Support

  • Before: Choose between Python AI tools OR your existing TypeScript stack
  • After: Each Step can be written in any language while sharing common state – use Python for AI, TypeScript for APIs, JavaScript for workflows

πŸ” Built-in Observability

  • Before: Complex tracing setups across multiple frameworks
  • After: Complete observability toolkit available in both cloud and local environments out of the box

βš–οΈ Scalability Without Complexity

  • Before: Choose between monolith simplicity or microservice complexity
  • After: Each Step scales independently, avoiding bottlenecks while maintaining development velocity

πŸš€ One-Click Everything

  • Before: Multiple deployment pipelines, configs, and failure points
  • After: Single deployable with atomic blue/green deployments and instant rollbacks
Traditional Stack Motia
Multiple deployment targets Single unified deployment
Fragmented observability End-to-end tracing
Language silos JavaScript, TypeScript, Python, etc
Context-switching overhead Single intuitive model
Manual error handling Automatic retries & fault tolerance
Complex infrastructure Zero-config queue & streaming

πŸ”§ 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

πŸ€” How it Works

One framework. All backend patterns. Motia replaces your entire backend stack with a single, event-driven system:

πŸš€ Replace Multiple Frameworks:

  • Instead of: Express/Nest.js + BullMQ + Temporal + LangChain + custom observability
  • Use: Motia Steps with automatic observability, queuing, and multi-language support

⚑ Simple but Powerful:

  • Need a REST API? Create an api step β†’ instant HTTP endpoint with validation, tracing, and error handling
  • Need background processing? Emit an event β†’ event steps pick it up asynchronously with built-in retries and fault tolerance
  • Need scheduled jobs? Use a cron step β†’ automatic scheduling with full observability
  • Need AI agents? Write Python steps with access to the entire ecosystem (PyTorch, transformers, etc.) while sharing state with TypeScript APIs

πŸ”„ Event-Driven by Design: Each Step can emit events that trigger other Steps, creating powerful workflows that automatically handle:

  • Parallel processing across multiple languages
  • Fault tolerance with automatic retries
  • Real-time updates streamed to clients
  • Complete traceability of every operation

The result? What used to require 5+ frameworks, complex deployment pipelines, and weeks of infrastructure setup now works out of the box with Motia.

⚑ Core Concepts

The Step is Motia's core primitive. The following concepts are deeply integrated with Steps to help you build powerful, complex, and scalable backends:

πŸ”‘ Steps & Step Types

Understand the three ways Steps are triggered:

  • HTTP (api) – Build REST/GraphQL endpoints with zero boilerplate.
  • Events (event) – React to internal or external events emitted by other steps.
  • Cron (cron) – Schedule recurring jobs with a familiar cron syntax.

πŸ“£ Emit & Subscribe (Event-Driven Workflows)

Steps talk to each other by emitting and subscribing to topics. This decouples producers from consumers and lets you compose complex workflows with simple, declarative code.

πŸͺ State Management

All steps share a unified key-value state store. Every get, set, and delete is automatically traced so you always know when and where your data changed.

πŸ“Š Structured Logging

Motia provides structured, JSON logs correlated with trace IDs and step names. Search and filter your logs without regex hassle.

πŸ“‘ Streams: Real-time Messaging

Push live updates from long-running or asynchronous workflows to clients without polling. Perfect for dashboards, progress indicators, and interactive AI agents.

πŸ‘οΈ End-to-End Observability with Traces

Every execution generates a full trace, capturing step timelines, state operations, emits, stream calls, and logs. Visualise everything in the Workbench's Traces UI and debug faster.


πŸ—‚ Production-Ready Examples

⭐ Explore 20+ sophisticated examples demonstrating real-world use cases from AI agents to enterprise workflows: View All Examples β†’

πŸ€– AI Agents & Workflows

AI Deep Research Agent Finance Analysis Agent PDF RAG System
Comprehensive web research with iterative analysis and synthesis Real-time financial data + AI insights for investment analysis Document processing with Docling, Weaviate, and OpenAI RAG
View Example β†’ View Example β†’ View Example β†’
GitHub PR Manager Gmail Intelligence Vision Analysis
AI-powered PR classification, labeling, and reviewer assignment Smart email analysis, auto-responses, and Discord summaries Multi-modal conversation analysis with visual understanding
View Example β†’ View Example β†’ View Example β†’

🌊 Real-Time Streaming & Chat

Streaming AI Chatbot Real-Time Chat App Live Health Monitor
Token-by-token AI responses with WebSocket streaming Multi-user chat with real-time message processing and moderation Production uptime monitoring with intelligent Discord alerts
View Example β†’ View Example β†’ View Example β†’

⚑ Parallel Processing & Workflows

Parallel Execution Demo Content Automation Task Management
Concurrent task processing with workload distribution Blog-to-Tweet automation with AI content optimization Trello workflow automation with AI task validation
View Example β†’ View Example β†’ View Example β†’

🎯 Key Features Demonstrated:

  • βœ… Multi-Language Workflows - JavaScript, TypeScript, Python working together
  • βœ… Real-Time Streaming - WebSocket integration with live updates
  • βœ… AI Integration - OpenAI, Claude, vision models, and custom AI workflows
  • βœ… Event-Driven Architecture - Complex workflows with automatic retry and fault tolerance
  • βœ… Production Monitoring - Health checks, uptime monitoring, and intelligent alerting
  • βœ… Parallel Processing - Concurrent execution and workload distribution
  • βœ… Enterprise Integration - GitHub, Gmail, Trello, Discord, and social media APIs

πŸš€ Each example includes: Complete source code β€’ Step-by-step tutorials β€’ Production deployment guides β€’ Docker configurations


🌐 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 🚧 Beta handler.step.rb
Go πŸ”„ Coming Soon handler.step.go
Rust πŸ”„ Coming Soon handler.step.rs

πŸ’¬ Get Help

🀝 Contributing

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


Star History Chart

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

🚧 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
Python Types Planned #485 Add support for Python types
Streams: RBAC Planned #495 Add support for RBAC
Streams: Workbench UI Planned #497 Add support for Workbench UI
Queue Strategies Planned #476 Add support for Queue Strategies
Reactive Steps Planned #477 Add support for Reactive Steps
Allow cloud configuration Planned #478 Add support for cloud configuration
BYOC: Bring your own Cloud: AWS Planned #479 Add support for AWS
Point in time triggers Planned #480 Add support for Point in time triggers
Workbench plugins Planned #481 Add support for Workbench plugins
Rewrite our Core in either Go or Rust Planned #482 Rewrite our Core in either Go or Rust
Decrease deployment time Planned #483 Decrease deployment time
Built-in database support Planned #484 Add support for built-in database
BYOC: Google Cloud Platform Planned #486 Add support for Google Cloud Platform
BYOC: Microsoft Azure Planned #487 Add support for Microsoft Azure
BYOC: Vercel Planned #488 Add support for Vercel
BYOC: Cloudflare Planned #489 Add support for Cloudflare
New languages: Go Planned #490 Add support for Go
New languages: Rust Planned #491 Add support for Rust
New languages: Java Planned #492 Add support for Java
New languages: Ruby Planned #493 Add support for Ruby
New languages: C# Planned #494 Add support for C#
BYOC: Kubernetes Planned #496 Add support for Kubernetes

About

Modern Backend Framework that unifies APIs, background jobs, workflows, and AI agents into a single cohesive system with built-in observability and state management.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 74.7%
  • MDX 17.3%
  • Python 3.3%
  • JavaScript 1.8%
  • CSS 1.6%
  • Ruby 0.7%
  • Other 0.6%