# Event-Driven Automation at Scale

> Manage thousands of triggers with centralized monitoring and intelligent event routing. Scale with automatic load balancing and failure recovery across global edge locations.

Canonical: https://triggers.do/

## In code

```ts
import { Triggers } from 'triggers.do'

// Centralized event-driven automation at scale
const manager = Triggers.manager({
  namespace: 'production',
  monitoring: true,
  rateLimit: { events: 1000000, per: 'minute' }
})

// Register multiple triggers with priorities
await manager.register([
  { event: 'Payment.received', handler: processPayment, priority: 'high' },
  { event: 'Order.created', handler: fulfillOrder, priority: 'normal' },
  { event: 'User.signup', handler: onboardUser, priority: 'low' }
])

// AI optimizes performance automatically
Triggers.every.hour($ => $.AI.optimize.TriggerPerformance({ period: '24h' }))
```

## Frequently asked questions

### How do triggers.do workflows differ from traditional event systems?

Triggers.do provides centralized management, monitoring, and optimization for thousands of event-driven workflows. Traditional event systems (Kafka, RabbitMQ, EventBridge) require manual setup, consumer management, and monitoring. Triggers.do includes intelligent event routing, automatic load balancing, circuit breakers, and AI-powered performance optimization out of the box. Semantic event patterns (on.Payment.received) express business intent with type-safe handlers and automatic retries. Scale to millions of events per second with consistent <10ms routing latency.

### What happens if trigger handlers fail at scale?

Automatic retry with per-trigger configurable strategies, dead letter queues for persistent failures, and circuit breakers to prevent cascading failures. Failed events are isolated and don't block other processing. Bulk replay operations let you reprocess thousands of failed events after fixing issues. Full error context captured including stack traces, event payloads, and system state. Alert aggregation prevents notification storms during incidents. Automatic degradation to backup handlers maintains service continuity.

### Can triggers handle complex multi-step workflows?

Yes. Define workflow orchestration with trigger dependencies, parallel execution, conditional branching, and compensating transactions. Workflows can run for hours or days with automatic state persistence—wait for human approvals, external events, or scheduled times. Saga pattern support handles distributed transactions across services with automatic rollback on failure. Visual workflow monitoring shows execution progress, bottlenecks, and failure points in real-time. Workflow versioning enables safe updates without disrupting in-flight executions.

### How do I monitor and debug thousands of triggers?

Centralized dashboard shows metrics for all triggers: success rates, latency percentiles, error rates, throughput, and cost. Distributed tracing correlates events across triggers, services, and databases. AI identifies anomalies (latency spikes, error increases) and suggests root causes. Query historical trigger executions by event type, status, duration, or custom attributes. Time-travel debugging replays any trigger execution locally with full context. Export metrics to external monitoring (Datadog, Prometheus, Grafana) via integrations.

### Can AI optimize trigger performance automatically?

Yes. AI analyzes trigger patterns (latency, failure rates, throughput) and automatically optimizes concurrency, retry strategies, timeout values, and routing algorithms. Agents identify underutilized handlers, overloaded regions, and inefficient event patterns. Predictive scaling prepares capacity before event spikes (Black Friday, product launches). A/B testing framework validates optimizations measure real-world impact. Cost optimization suggests consolidating similar triggers or adjusting sampling rates. Continuous learning improves recommendations based on observed outcomes.

## Part of Platform.do

triggers.do is one of the primitives of Platform.do, in the Workflows layer (triggers, steps and functions). Every .do shares one grammar, Business-as-Code, and one SDK.

- What is Business-as-Code? https://platform.do/business-as-code
- Platform.do: https://platform.do/
- Docs: https://docs.platform.do
