# Contracts

> Contracts with counterparties from draft through review and signature to active, expired or terminated, built on signatures, versions and reminders. Values are bigint minor units; renewal terms (auto-renew, renewal period, notice days) schedule a reminder before the notice deadline; obligations carry due dates and owners.

- Category: CRM & sales
- Module: `contracts`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/contracts
- Page: https://bettersupabase.com/blocks/contracts

## Install

```bash
npx better-supabase add contracts
```

The command also installs `updated-at`, `tenant`, `jobs`, `access`, `reminders`, `subjects`, `versions`, `signatures`.

## Configure

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

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

export default defineConfig({
  blocks: {
    // Required by contracts; add installs them too.
    "updated-at": {},
    tenant: {},
    jobs: {},
    access: {},
    reminders: {},
    subjects: {},
    versions: {},
    signatures: {},
    // Modes: "managed", "custom". The default is "managed".
    contracts: { mode: "managed" },
  },
});
```

## Client

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

## Events

- `contract.created`
- `contract.renewed`
- `contract.status_changed`
- `contract.updated`
- `obligation.saved`
- `obligation.status_changed`

## Related blocks

Requires: [tenant](https://bettersupabase.com/blocks/tenant.md), [access](https://bettersupabase.com/blocks/access.md), [subjects](https://bettersupabase.com/blocks/subjects.md), [versions](https://bettersupabase.com/blocks/versions.md), [signatures](https://bettersupabase.com/blocks/signatures.md), [reminders](https://bettersupabase.com/blocks/reminders.md)

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

## Recipes

- [Contract renewals](https://bettersupabase.com/recipes/contract-renewals.md): Active contracts with their value, end date and notice deadline, the nearest deadline first, so a renewal is decided in time.
