Skip to content

Node.js SDK

bash
npm install @amlexiahq/node

Package: @amlexiahq/node · Source: GitHub

Client

typescript
import { AmlexiaClient } from '@amlexiahq/node';

const client = new AmlexiaClient({
  sdkKey: process.env.AMLEXIA_SDK_KEY!,
  ingestUrl: process.env.AMLEXIA_INGEST_URL ?? 'https://ingest.amlexia.com',
  flushIntervalMs: 5000,
  maxBatchSize: 50,
  maxRetries: 5,
});
OptionDefaultDescription
sdkKeyrequiredProject SDK key
ingestUrlhttps://ingest.amlexia.comIngest base URL
flushIntervalMs5000Background flush
maxBatchSize50Events per request
maxRetries5Retry attempts

Methods

  • track(event) — queue an event
  • flush() — send buffer now
  • shutdown() — stop timer, flush all (call on SIGTERM)

Exports

ImportUse
@amlexiahq/nodeClient
@amlexiahq/node/expressExpress
@amlexiahq/node/fastifyFastify
@amlexiahq/node/honoHono
@amlexiahq/node/nextNext.js
@amlexiahq/node/tracingcreateTraceContext, childSpan
@amlexiahq/node/otelexportOtelSpans

Event fields

See Event fields.