Before you start
Create the project with the JavaScript / TypeScript integration type.
| What you need | Why it matters |
|---|---|
| Project API token | Authenticates your app when sending events |
| Hosted Logister base URL | Used to build the ingest and check-in endpoints |
| Node 18+ app | Lets you run the published logister-js package |
Setup flow
Recommended installation path
- Create the project and generate an API key.
- Install
logister-jsin the Node or TypeScript app. - Configure the client with the project API key and base URL.
- Add the Express middleware and error handler if you run an HTTP service.
- 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-jstypescript
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