# Pipelines

> Tenant-editable pipelines for any registered subject: ordered stages whose categories map to open, success or failure, a stage history with time in stage, board totals per currency and a status mapping that runs through state-machine.

- Category: Work management
- Module: `pipelines`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/pipelines
- Page: https://bettersupabase.com/blocks/pipelines

## Install

```bash
npx better-supabase add pipelines
```

The command also installs `updated-at`, `memberships`, `permissions`, `subjects`.

## Configure

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

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

export default defineConfig({
  blocks: {
    // Required by pipelines; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    subjects: {},
    // Modes: "managed", "custom". The default is "managed".
    pipelines: { mode: "managed" },
  },
});
```

## Client

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

## Events

- `pipeline.archived`
- `pipeline.created`
- `pipeline.restored`
- `pipeline.updated`
- `pipeline_stage.archived`
- `pipeline_stage.created`
- `pipeline_stage.restored`
- `pipeline_stage.updated`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md), [subjects](https://bettersupabase.com/blocks/subjects.md)

Works with: [outbox](https://bettersupabase.com/blocks/outbox.md), [audit](https://bettersupabase.com/blocks/audit.md), [state-machine](https://bettersupabase.com/blocks/state-machine.md), [notifications](https://bettersupabase.com/blocks/notifications.md)

## Recipes

- [Deal board](https://bettersupabase.com/recipes/deal-board.md): Deals as cards in pipeline stage columns, moved by drag and drop.
