@grantex/destinations package, you can forward events to SIEMs, data warehouses, and message brokers without writing custom plumbing.
Architecture
EventSource class connects to the SSE stream and dispatches each event to one or more destinations you configure. Destinations buffer events and flush them in batches for efficiency.
Event Types
Each event has the same envelope:
SSE Endpoint
GET /v1/events/stream returns a Server-Sent Events stream. Authenticate with your API key as a Bearer token.
curl
types query parameter (comma-separated):
TypeScript
Python
WebSocket Endpoint
GET /v1/events/ws upgrades to a WebSocket connection. Each message is a JSON-encoded event.
TypeScript
Python
@grantex/destinations Package
The@grantex/destinations package provides a high-level EventSource class that connects to the SSE stream and dispatches events to one or more destinations. Install it with:
Basic Usage
Available Destinations
Shared Configuration
All destinations accept these base options:Graceful Shutdown
Always callstop() to flush pending events and close connections:
Custom Destinations
Implement theEventDestination interface to build your own:
Next Steps
- Datadog Integration — monitors and alerting
- Splunk Integration — saved searches and dashboards
- S3 & BigQuery Archival — compliance archival
- Webhooks — push-based event delivery to your own endpoints
- Metrics & Observability — Prometheus metrics and Grafana dashboards