# Job queue

> Typed jobs on Supabase Queues (pgmq) or a plain table (blocks.queue.options.backend): leases, retries with backoff, dead letters, deduplication keys, queue stats, and schedules with pg_cron or the drain route.

- Category: Automation
- Module: `queue`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/queue
- Page: https://bettersupabase.com/blocks/queue

## Install

```bash
npx better-supabase add queue
```

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Modes: "managed". The default is "managed".
    queue: { mode: "managed" },
  },
});
```

## Client

The block has no React entry yet. Its server-side TypeScript is in `better-supabase/blocks/queue`.

## Related blocks

Works with: [data-lifecycle](https://bettersupabase.com/blocks/data-lifecycle.md)

## Recipes

- [Job runs table](https://bettersupabase.com/recipes/job-runs-table.md): The latest background job runs with their status, attempts and error, and a button to retry a failed run.
