Express with AllStak
Add error and request monitoring to your Express app with one setup call (beta).
- Source repository:
- AllStak/allstak-express
- Source README:
- README.md
- SDK version:
- 0.1.1
- Installation source:
- npm
- Last verified:
- 2026-05-31
Installation
Install the SDK and core package (peer: express >=4).
npm install @allstak/express @allstak/jsConfiguration
Call allstakExpress(app, options) — it initializes @allstak/js and mounts the request handler first and the error handler last for you.
import express from 'express';
import { allstakExpress } from '@allstak/express';
const app = express();
allstakExpress(app, {
apiKey: process.env.ALLSTAK_API_KEY,
environment: process.env.NODE_ENV ?? 'production',
release: process.env.ALLSTAK_RELEASE,
serviceName: 'api',
});Basic example
That single call wires everything; define your routes after it.
Capturing errors
Thrown errors and next(err) are captured by the auto-mounted error handler. Capture manually via the re-exported AllStak.captureException.
import { AllStak } from '@allstak/express';
AllStak.captureException(new Error('checkout failed'));Tracking requests
The request handler (mounted first by allstakExpress) records each inbound request via AllStak.captureRequest on response finish and opens an http.server span named by the route pattern.
Best practices
- Call allstakExpress(app, …) before defining routes.
- Set serviceName and release on the options.
- Use init: false / mountErrorHandler: false for advanced manual control.