# Governance

> Audit, field history and data lifecycle, the blocks behind records of who changed what and how long it is kept.

Source: https://bettersupabase.com/docs/blocks/governance

Covers accountability: the audit log, per-field change history and retention with legal holds. The plan called it `compliance`; see [the names](/docs/blocks/catalog-composites).

```bash
better-supabase add governance
```

```ts title="better-supabase.config.ts"
export default defineConfig({ blocks: { governance: {} } });
```

`add` lists `governance` in `blocks`, writes the modules of every part and wires the client in `lib/blocks.ts`. Import the manifest from `better-supabase/blocks/governance` when you build the set with [`createBlocks`](/docs/blocks/create-blocks).

```ts
import { governanceBlock } from "better-supabase/blocks/governance";
```

## Parts [#parts]

Installing `governance` installs these blocks. Each stays an ordinary block in the config and keeps its own client.

- [`audit`](/docs/blocks/audit)
- [`field-history`](/docs/blocks/field-history)
- [`data-lifecycle`](/docs/blocks/data-lifecycle)

## Helpers [#helpers]

`exportSubject`: Request a subject data export, then record it in the audit log under a key derived from the export id, so a retry never writes a second entry.

```ts
await blocks.governance.exportSubject({ subjectType: "contact", subjectId });
```

The helper returns a `Result`; each step is idempotent, so retrying after a partial failure is safe.

## Remove [#remove]

```bash
better-supabase remove governance
better-supabase remove governance --with-parts
```

The first command replaces `governance` in `blocks` with its parts. The second removes the parts too, except any part another block still needs ([`remove`](/docs/cli/init#remove)).