Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Foundational Patterns

This section contains intermediate examples demonstrating common patterns for building production-ready applications with Motia.

📂 Categories

Learn how to build robust APIs with file processing, data transformation, and analysis capabilities.

Master essential workflow patterns for production applications.

Discover automation patterns for content processing, messaging, and scheduled tasks.

Explore containerization, parallel processing, and monitoring patterns.


🎯 What You'll Learn

  • File processing and transformation
  • Essential workflow patterns (human-in-the-loop, long-running workflows)
  • Content automation workflows
  • Scheduled data fetching with Cron Steps
  • Docker containerization
  • Parallel execution patterns
  • Health monitoring and uptime tracking

📚 Examples by Category (10 Total)

API Patterns

Concepts: Full-Stack Application, CRUD APIs, Real-time Streaming, Background Jobs

Comprehensive todo application showcasing Motia's complete feature set - APIs, events, cron jobs, streaming, and state management.

Key Features:

  • RESTful CRUD API (create, list, get, update, delete)
  • Real-time updates via Motia Streams
  • Background jobs (notifications, analytics, gamification)
  • Scheduled tasks (cleanup, statistics)
  • Visual Workbench plugin for management
  • Redis-backed state persistence

⭐ Highlights: Complete production-ready application demonstrating all Motia capabilities in one example


Concepts: File Processing, Image Transformation, API Design

Process and resize images on-the-fly with configurable dimensions and formats.

Key Features:

  • Image upload handling
  • Multiple format support
  • Dimension transformation
  • Error handling

Concepts: Text Analysis, NLP, API Design

Analyze text sentiment using natural language processing.

Key Features:

  • Sentiment scoring
  • Text classification
  • API endpoint design
  • Response formatting

Workflow Patterns

Concepts: Long-Running Workflows, Human Approval, State Checkpointing, Webhook Re-Entry

Build workflows that pause for human decisions and resume when ready - perfect for order approvals, content moderation, or any process requiring human judgment.

Key Features:

  • Auto vs. manual routing (low-risk bypasses, high-risk pauses)
  • Visual approval gate with red/green buttons
  • Webhook re-entry pattern
  • State checkpointing at every step
  • Idempotent processing

⭐ Highlights: Answers the common question "How does Motia handle workflows that pause and wait for external signals?"


Automation

Concepts: Content Repurposing, Event Chains, Social Media

Automatically convert blog posts into Twitter-ready content.

Key Features:

  • Content extraction
  • Text summarization
  • Character limit handling
  • Social media formatting

Concepts: Cross-Platform Integration, Event Processing

Bridge Telegram messages with Gmail for unified communication.

Key Features:

  • Telegram bot integration
  • Gmail API integration
  • Message routing
  • Event-driven workflow

Concepts: Cron Steps, External APIs, Scheduled Tasks

Monitor currency exchange rates with scheduled checks.

Key Features:

  • Cron-based scheduling
  • External API integration
  • Data persistence
  • Rate comparison

Infrastructure

Concepts: Containerization, Deployment, Docker

Containerize your Motia applications for easy deployment.

Key Features:

  • Docker configuration
  • Multi-stage builds
  • Environment management
  • Production deployment

Concepts: Concurrency, Performance Optimization

Execute multiple tasks concurrently for improved performance.

Key Features:

  • Parallel event processing
  • Concurrency control
  • Performance optimization
  • Resource management

Concepts: Health Checks, Monitoring, Alerting

Monitor service availability and get alerts on downtime.

Key Features:

  • Endpoint monitoring
  • Health checks
  • Alert notifications
  • Status tracking

🚀 Getting Started

  1. Choose a category that matches your use case
  2. Navigate to the specific example
  3. Follow the README in each example
  4. Install dependencies
  5. Configure environment variables
  6. Run the example

📖 Learning Path

Start with API Patterns if you need to:

  • Process files or images
  • Analyze text data
  • Build robust APIs

Move to Automation if you want to:

  • Automate content workflows
  • Integrate multiple platforms
  • Schedule recurring tasks

Explore Infrastructure when you're ready to:

  • Deploy to production
  • Optimize performance
  • Monitor your services

🔗 Next Steps

After mastering these foundational patterns, explore:

📚 Resources