Reactive Programming

Raindrop Observers

Build applications that respond automatically. Raindrop Observers execute code in response to events—file uploads, queue messages, data changes—without polling or complex infrastructure.

No polling required
Automatic triggers
Event-driven architecture
Event Processing
File Uploaded
Observer triggered automatically
Process file in background
Generate thumbnails & metadata
Zero Infrastructure
"No polling, no webhooks, no complex setup"

Two Types of Observers

Choose the right observer for your event-driven needs

Object Observers

React to data changes

Watch for changes to objects in your buckets and execute code in response. Perfect for processing files after upload, generating thumbnails, or triggering workflows.

raindrop.manifest
application "demo" {
  bucket "user-uploads" {}

  observer "file-processor" {
    source {
      bucket = "user-uploads"
      rule {
        actions = ["PutObject", "CompleteMultipartUpload"]
      }
    }
  }
}
Monitor bucket changes
Process files automatically
Generate thumbnails & metadata

Queue Observers

Asynchronous task processing

Process messages as they arrive in queues. Perfect for background jobs, sending notifications, processing payments, or any task that shouldn't block your main flow.

raindrop.manifest
queue "background-jobs" {}

observer "job-processor" {
  source { queue = "background-jobs" }
}
Process queue messages
Background job handling
Automatic retries & scaling

Event-Driven Architecture Made Simple

See how observers automatically respond to events without complex infrastructure

Event Processing Flow

1
Event Occurs
File uploaded, message queued, or data changed
2
Observer Triggered
Automatically detects the event and starts processing
3
Process Event
Execute your custom logic in response
4
Complete & Scale
Observer scales down automatically when done

Implementation Example

index.ts
export default class extends Each<Body, Env> {
  async process(message: observers.BucketEventNotification): Promise<void> {
    console.log(`Processing file: ${message.key}`);

    // Your custom processing logic here
    await this.processUploadedFile(message.key);
    await this.generateThumbnails(message.key);
    await this.updateMetadata(message.key);
  }
}
No polling or timers needed
Automatic event detection
Built-in error handling

Supported Trigger Actions

Fine-grained control over which events trigger your observers

Object Creation Events

React when files are added

PutObject
Direct file uploads
CopyObject
File copy operations
CompleteMultipartUpload
Large file uploads

Object Deletion Events

React when files are removed

DeleteObject
Manual deletions
LifecycleDeletion
Automatic cleanup

Common Use Cases

Build reactive applications that respond to events automatically

Image Processing

Automatically generate thumbnails, resize images, and extract metadata when files are uploaded.

Email Notifications

Send welcome emails, order confirmations, and status updates without blocking your main application.

Data Processing

Process uploaded data files, generate reports, and update analytics in the background.

Payment Processing

Handle payment confirmations, refunds, and subscription renewals asynchronously.

Analytics & Reporting

Generate reports, update dashboards, and process analytics data when new information arrives.

Data Synchronization

Sync data between systems, update caches, and maintain consistency across your application.

Ready to transform your data

Start building today!