# tiger-server

> Even simple than trigger

Latest version **0.6.2** (published 2025-12-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiger-server
pnpm add tiger-server
yarn add tiger-server
bun add tiger-server
```

Provides the commands `tiger`, `tiger-server`.

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2025-12-08 |
| First published | 2018-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.6.0 |
| Dependencies | 15 |
| Unpacked size | 117.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kimmy Leo |
| Maintainers | kenpusney |

## Links

- npm: https://www.npmjs.com/package/tiger-server
- Repository: https://github.com/kenpusney/tiger
- Homepage: https://github.com/kenpusney/tiger#readme
- Issues: https://github.com/kenpusney/tiger/issues
- npm.io page: https://npm.io/package/tiger-server

## Dependencies (15)

- [pg](https://npm.io/package/pg.md) ^8.16.3
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [pino](https://npm.io/package/pino.md) ^10.1.0
- [level](https://npm.io/package/level.md) ^10.0.0
- [umzug](https://npm.io/package/umzug.md) ^3.8.2
- [dotenv](https://npm.io/package/dotenv.md) ^17.2.3
- [nanoid](https://npm.io/package/nanoid.md) ^5.1.6
- [radash](https://npm.io/package/radash.md) ^12.1.1
- [express](https://npm.io/package/express.md) ^5.1.0
- [sqlite3](https://npm.io/package/sqlite3.md) ^5.1.7
- [commander](https://npm.io/package/commander.md) ^14.0.2
- [pg-hstore](https://npm.io/package/pg-hstore.md) ^2.3.4
- [sequelize](https://npm.io/package/sequelize.md) ^6.37.7
- [cron-parser](https://npm.io/package/cron-parser.md) ^5.4.0
- [pino-pretty](https://npm.io/package/pino-pretty.md) ^13.1.2

## Recent versions

- 0.6.2 (latest) — 2025-12-08
- 0.6.1 — 2025-12-08
- 0.6.0 — 2025-12-08
- 0.5.3 — 2019-11-16
- 0.5.2 — 2019-11-16
- 0.5.1 — 2019-11-16
- 0.5.0 — 2019-11-15
- 0.4.0 — 2019-08-22
- 0.3.2 — 2019-04-26
- 0.3.1 — 2019-03-09
- 0.3.0 — 2019-02-25
- 0.2.1 — 2018-09-10
- 0.1.2 — 2018-09-08
- 0.1.0 — 2018-09-08

## README

# tiger-server

<img src="./docs/1024px-Ghostscript_Tiger.png" width="250" height="250"/>

Tiger server is a very lightweight server for very simple process like webhooks.

## Usage

```
npm install tiger-server --save
```

and create `server.ts`:

```typescript
import { defineServer, http, cron, queue } from "tiger-server";
import type { QueueModule, CronModule, HttpModule } from "tiger-server";

export default defineServer(async (tiger) => {
  await tiger.use(http, cron, queue);

  await tiger.define<QueueModule<{message: string}>>({
    id: "hello",
    target: "queue:hello",
    async process(_state, message) {
      this.log(`Message received: ${JSON.stringify(message)}`);
    }
  });

  await tiger.define<CronModule<{count: number}>>({
    id: "cron",
    target: "cron:*/5 * * * * *",
    async process({ count = 0 }) {
      count++;
      await this.notify("queue:hello", { count });
      return { count }
    }
  });

  await tiger.define<HttpModule>({
    id: "request",
    target: "http:/hello",
    async process(_state, { req, res }) {
      await this.notify("queue:hello", { message: "request recieved" });
      res.send("success!")
    }
  });
});
```

Run it with Node.js 22.6+:

```
npx tiger-server run server.ts
```

This relies on Node’s native TypeScript loader, so there is no build step and the code runs directly.

> The `http` plugin defaults to `0.0.0.0:9527`. Override `http.port`/`http.host` (or `TIGER_HTTP_PORT`/`TIGER_HTTP_HOST`) to run multiple Tiger instances side-by-side while sharing the same cron queue.

> The Monitor UI follows `monitor.host:monitor.port` (defaults `0.0.0.0:9753`). Tweak `monitor` config or `TIGER_MONITOR_*` env vars—or disable it entirely with `monitor.disabled`/`TIGER_MONITOR_DISABLED=1`.

> The `queue` plugin is now an in-memory message bus. It delivers `queue:` (or legacy `zmq:`) notifications to modules defined in the same process without any external socket or runtime-specific dependency.

> The `cron` plugin persists its schedule either in LevelDB (`cron.levelDbPath`, default `.tiger-cron`) or, when you run distributed mode with a Postgres driver, inside the shared Postgres database. Multiple Tiger processes simply read from the same store and pop due runs cooperatively.

> To build *distributed modules*, configure the `distributed` block. Set `distributed.driver` to `postgres` (and point `DATABASE_URL` to your Postgres instance) to enable a shared job/state store, or leave it as `level` for single-node experimentation. Every distributed module must declare an `id` and `distributed: true`; Tiger will enqueue work, persist state, and heartbeat the node registry through the configured persistence provider. Use `distributed.maxQueueLength` (default `100`) to keep runaway producers from filling the queue indefinitely.

> When running with the Postgres driver, apply the bundled Sequelize migrations (e.g. `DATABASE_URL=postgres://... npx sequelize-cli db:migrate`) before starting Tiger so the job, state, and registry tables exist.

> When distributed mode is enabled, a management dashboard and API are available at `/tiger/manage` on the same port as the monitor. It lists every node’s last heartbeat, whether it is enabled/disabled, and lets you pause or resume queue consumption for any node while it continues to report heartbeats and finish in-flight work.

> Logo is generated from [Wikipedia](https://en.wikipedia.org/wiki/File:Ghostscript_Tiger.svg), the original script is under GPL license.

---
_Source: https://npm.io/package/tiger-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
