# @x12i/api-live-sdk

> Embeddable in-memory /_live status dashboard: process health sparklines, hourly push/pull volume bars, and traffic rings.

Latest version **1.0.1** (published 2026-09-23) · exellix-license license · 0 weekly downloads

## Install

```sh
npm install @x12i/api-live-sdk
pnpm add @x12i/api-live-sdk
yarn add @x12i/api-live-sdk
bun add @x12i/api-live-sdk
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2026-09-23 |
| First published | 2026-09-23 |
| Weekly downloads | 0 |
| License | exellix-license |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.0.0 |
| Dependencies | 0 |
| Unpacked size | 101.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | x12i |
| Keywords | x12i, api, live, live-view, status, observability, dashboard |

## Links

- npm: https://www.npmjs.com/package/@x12i/api-live-sdk
- Repository: https://github.com/neo-connectors/vulnerabilities-connectors
- Homepage: https://github.com/neo-connectors/vulnerabilities-connectors#readme
- Issues: https://github.com/neo-connectors/vulnerabilities-connectors/issues
- npm.io page: https://npm.io/package/@x12i/api-live-sdk

## Recent versions

- 1.0.1 (latest) — 2026-09-23
- 1.0.0 — 2026-09-23

## README

# `@x12i/api-live-sdk`

Embeddable **in-memory `/_live` status dashboard** for any Node HTTP service.

- Process sparklines (CPU, RSS, heap, host memory, external, event-loop busy)
- UTC hourly push / pull volume bars (up to 48 hours)
- Traffic rings for inbound and worker (outbound) calls
- Adapters: Fastify and Node `http`
- No database

## Install

```bash
npm install @x12i/api-live-sdk
```

Peer (Fastify adapter only): `fastify@^5`.

## Fastify

```ts
import Fastify from "fastify";
import { attachFastifyLiveSdk } from "@x12i/api-live-sdk/fastify";

const app = Fastify();
const live = await attachFastifyLiveSdk(app, {
  service: {
    id: "my-api",
    title: "My API",
    port: 8080,
    env: "PORT",
    origin: "http://127.0.0.1:8080/",
    description: "Example service",
  },
});

const fetchLive = live.createInstrumentedFetch({ caller: "worker" });
await fetchLive("https://example.test/x");

await app.listen({ port: 8080, host: "127.0.0.1" });
// Open http://127.0.0.1:8080/_live
```

## Node http

```js
import http from "node:http";
import { createNodeHttpLiveSdk } from "@x12i/api-live-sdk/node-http";

const port = 8080;
const live = createNodeHttpLiveSdk({
  service: { id: "fixture", title: "Fixture", port },
});

http
  .createServer(async (req, res) => {
    if (await live.tryHandle(req, res)) return;
    res.writeHead(200, { "content-type": "application/json" });
    res.end(JSON.stringify({ ok: true }));
  })
  .listen(port);
```

## Manual volume (non-HTTP writers)

```ts
live.recordVolume({ direction: "push", bytes: 12_345 });
live.recordVolume({ direction: "pull", bytes: 67_890, requests: 0 });
```

Default semantics match station Memorix live views: **pushed** = request / write bodies in, **pulled** = response / read bodies out.

## Endpoints (default `basePath: /_live`)

| Path | Purpose |
|------|---------|
| `GET /_live` | HTML dashboard |
| `GET /_live/api/info` | Service metadata |
| `GET /_live/api/status` | Liveness + process snapshot + volume |
| `GET /_live/api/health-series?limit=` | Process samples (default 120) |
| `GET /_live/api/volume-series?limit=` | UTC hourly buckets (default 48) |
| `GET /_live/api/traffic?lane=inbound\|worker` | Recent traffic entries |

Health probes and `/_live/*` are excluded from the inbound ring.

## License

`exellix-license`

---
_Source: https://npm.io/package/@x12i/api-live-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
