# kiribi

> A simple job management library consisting of the Cloudflare stack.

Latest version **0.2.1** (published 2024-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install kiribi
pnpm add kiribi
yarn add kiribi
bun add kiribi
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2024-12-15 |
| First published | 2024-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | aiji42 |

## Links

- npm: https://www.npmjs.com/package/kiribi
- npm.io page: https://npm.io/package/kiribi

## Dependencies (5)

- [zod](https://npm.io/package/zod.md) ^3.23.8
- [hono](https://npm.io/package/hono.md) ^4.6.13
- [drizzle-orm](https://npm.io/package/drizzle-orm.md) ^0.38.0
- [@hono/zod-validator](https://npm.io/package/@hono/zod-validator.md) ^0.4.1
- [@paralleldrive/cuid2](https://npm.io/package/@paralleldrive/cuid2.md) ^2.2.2

## Recent versions

- 0.2.1 (latest) — 2024-12-15
- 0.0.1 (true) — 2024-04-17
- 0.0.0-beta-0005 (beta) — 2024-04-17
- 0.2.0 — 2024-12-12
- 0.1.3 — 2024-12-12
- 0.1.2 — 2024-12-11
- 0.1.1 — 2024-12-11
- 0.1.0 — 2024-12-11
- 0.0.16 — 2024-05-10
- 0.0.15 — 2024-05-10
- 0.0.14 — 2024-05-10
- 0.0.13 — 2024-05-07
- 0.0.12 — 2024-04-29
- 0.0.11 — 2024-04-29
- 0.0.10 — 2024-04-25
- … 13 more at https://npm.io/package/kiribi/versions

## README

# 🎇 Kirini

A simple job management library consisting of the Cloudflare stack.

See documentation at [kiribi.pages.dev](https://kiribi.pages.dev/).

## Getting Started

```bash
npm install kiribi
```

```bash
$ npx wrangler d1 create kiribi-db
$ npx wrangler queues create kiribi-queue
```

```typescript
// src/index.ts
import { Kiribi } from 'kiribi'
import { client } from 'kiribi/client'
import { rest } from 'kiribi/rest'

export default class extends Kiribi {
  client = client
  rest = rest
}

import { KiribiPerformer } from 'kiribi/performer'

export class MyPerformer extends KiribiPerformer {
  async perform(payload) {
    console.log('preform', payload)
  }
}
```

```toml
# wrangler.toml
name = "my-kiribi"
compatibility_date = "2024-04-03"
main = "src/index.ts"

[[d1_databases]]
binding = "KIRIBI_DB"
database_name = "kiribi-db"
database_id = "xxxxxxxxxxxxx"
migrations_dir = './node_modules/kiribi/migrations'

[[queues.producers]]
binding = "KIRIBI_QUEUE"
queue = "kiribi-queue"

[[queues.consumers]]
queue = "kiribi-queue"
max_retries = 5

[[services]]
binding = "KIRIBI"
service = "my-kiribi"

[site]
bucket = "./node_modules/kiribi/client"

[[services]]
binding = "MY_JOB"
service = "my-kiribi"
entrypoint = "MyPerformer"
```

```bash
npx wrangler d1 migrations apply kiribi-db --remote
```

```bash
npx wrangler deploy
```

## Usage

```toml
# wrangler.toml
name = "enqueuer"
compatibility_date = "2024-04-03"
main = "src/index.ts"

[[services]]
binding = "KIRIBI"
service = "my-kiribi"
```

```typescript
// src/index.ts
import { Kiribi } from 'kiribi'

interface Env {
  KIRIBI: Service<Kiribi>
}

export default {
  async fetch(req: Request, env: Env, ctx: ExecutionContext) {
    await env.KIRIBI.enqueue('MY_JOB', { key: 'value' }, { maxRetries: 5 })

    return new Response('OK')
  }
}
```

## Development

See [development.md](https://github.com/aiji42/kiribi/blob/main/development.md).

## License

See [LICENSE](https://github.com/aiji42/kiribi/blob/main/LICENSE).

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