Documentation / JavaScript

Integrate a Node or TypeScript app with Logister.

The best path for JavaScript and TypeScript projects is the logister-js package. It sends telemetry into the Logister backend and matches the JavaScript-specific setup experience in the app for Express-based services.

Before you start

Create the project with the JavaScript / TypeScript integration type.

What you needWhy it matters
Project API tokenAuthenticates your app when sending events
Hosted Logister base URLUsed to build the ingest and check-in endpoints
Node 18+ appLets you run the published logister-js package

Setup flow

Recommended installation path

  1. Create the project and generate an API key.
  2. Install logister-js in the Node or TypeScript app.
  3. Configure the client with the project API key and base URL.
  4. Add the Express middleware and error handler if you run an HTTP service.
  5. Use the shared client for custom metrics, logs, transactions, and check-ins.

Tip

Start with request timing and uncaught Express errors first. Once those are flowing, add custom events where you need more product-specific visibility.

Install

Add the package

shell
npm install logister-js
yarn add logister-js
pnpm add logister-js
bun add logister-js
typescript
import { LogisterClient } from "logister-js";

const client = new LogisterClient({
  apiKey: process.env.LOGISTER_API_KEY ?? "",
  baseUrl: process.env.LOGISTER_BASE_URL ?? "https://logister.org"
});

Package source: logister-js on GitHub. Self-hosted backend: Logister app on GitHub.

Express

Capture requests and uncaught route errors.

typescript
import express from "express";
import { LogisterClient } from "logister-js";
import {
  createLogisterErrorHandler,
  createLogisterMiddleware
} from "logister-js/express";

const app = express();
const client = new LogisterClient({
  apiKey: process.env.LOGISTER_API_KEY ?? "",
  baseUrl: process.env.LOGISTER_BASE_URL ?? "https://logister.org"
});

app.use(createLogisterMiddleware({ client }));

app.get("/orders/:id", async (_req, res) => {
  res.json({ ok: true });
});

app.use(createLogisterErrorHandler({ client }));

Important

Register the Logister request middleware before your routes and the Logister error handler before your final Express error response middleware.

Custom events

Report metrics, logs, and check-ins from the same client.

typescript
await client.captureMetric("cache.hit_rate", 0.98, {
  context: { service: "checkout-api" }
});

await client.captureMessage("Queue backlog rising", {
  level: "warning",
  context: { queue: "emails" }
});

await client.checkIn("nightly-import", "ok", {
  context: { environment: "production" }
});
Verification
Activity page checklist
transactions visible
uncaught route errors visible
custom metrics and check-ins present