Installing @sentrinel/plugin in your apps

The plugin lives in the public repo Zaga-ltd/sentinel_packages, so any Elysia app can install it straight from GitHub โ€” no npm publish needed:

bun add "@sentrinel/plugin@github:Zaga-ltd/sentinel_packages"

Pin to a specific commit or tag for reproducible builds:

bun add "@sentrinel/plugin@github:Zaga-ltd/sentinel_packages#v0.1.0"   # tag
bun add "@sentrinel/plugin@github:Zaga-ltd/sentinel_packages#abc1234"  # commit

Or in package.json:

{
  "dependencies": {
    "@sentrinel/plugin": "github:Zaga-ltd/sentinel_packages"
  }
}

Wire it up

import { Elysia } from "elysia";
import { sentrinelPlugin } from "@sentrinel/plugin";

const app = new Elysia()
  .use(
    sentrinelPlugin({
      serverUrl: process.env.SENTRINEL_URL ?? "http://localhost:3001",
      appName: "my-api",
      env: process.env.NODE_ENV ?? "dev",
      apiKey: process.env.SENTRINEL_API_KEY, // required when the server enforces keys

      requestLogging: {
        enabled: true,
        sampleRate: 0.25,             // errors + slow requests are always kept
        slowRequestThresholdMs: 200,
        maskHeaders: [/^authorization$/i, /^cookie$/i],
      },

      logCapture: { enabled: true }, // Logs tab in the request modal
    })
  )
  .get("/", () => "hello")
  .listen(3000);

Full option reference is in the plugin's own README: https://github.com/Zaga-ltd/sentinel_packages#readme.

Updating the public repo after plugin changes

The plugin source of truth is packages/plugin in this (private) monorepo. To publish changes:

bash scripts/publish-plugin.sh
cd sentinel_packages
git add -A && git commit -m "sync plugin" && git push

Consumers pick up the update with bun update @sentrinel/plugin (or by bumping the pinned tag/commit).