Skip to Content
Engineering11 Documentation 🔥

Events API

Abstract base classes for strongly-typed event payloads in event-driven architecture.

What It Does

The Events API provides foundational abstract base classes for defining strongly-typed event payloads in a microservices architecture. It serves as the base layer for the Foundation’s event-driven system, enabling type-safe event handling for create, update, and delete operations.

Note: This package is marked as DEPRECATED but still widely used across the Foundation ecosystem at version 5.6.0.

Key Capabilities

CapabilityDescription
Typed Event PayloadsGeneric abstract classes for create, update, and delete events
Type SafetyTypeScript support with generics for payload types
ConsistencyEnsures uniform event structure across microservices
ExtensibilityAllows services to extend with domain-specific event types
IntegrationFoundation for event publishing and validation services

Base Event Classes

BaseCreatedEvent<T>

Represents entity creation events:

  • Contains payload of type Event<T>
  • Used when new entities are created
  • Triggers onCreate Cloud Functions

BaseUpdatedEvent<T>

Represents entity update events:

  • Contains payload of type UpdatedEvent<T>
  • Includes before/after values
  • Triggers onUpdate Cloud Functions

BaseDeletedEvent<T>

Represents entity deletion events:

  • Contains payload of type Event<T>
  • Used when entities are deleted
  • Triggers onDelete Cloud Functions

Event Structure

Events follow this structure:

{ kind: 'event', item: any, // Actual payload data timestamp: string, // ISO timestamp senderId: string // Triggering entity ID }

Common Use Cases

  • Event-driven microservices: Base classes for domain events
  • Firestore triggers: Cloud Function event handling
  • Pub/Sub messaging: Type-safe event publishing
  • Event validation: Schema-based event validation
  • Audit trails: Track entity lifecycle events

What Customers Don’t Have to Build

  • Abstract event base classes
  • Event type definitions
  • Generic payload typing
  • Event structure consistency
  • Type-safe event inheritance
Last updated on