# Expenses

> Expense reports with lines in categories and receipts as attachments, spend policies (a limit per category, a receipt threshold) checked on submit, approval through the approvals block, and the approved total and its reimbursement posted on the ledger in bigint minor units.

- Category: Billing & commerce
- Module: `expenses`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/expenses
- Page: https://bettersupabase.com/blocks/expenses

## Install

```bash
npx better-supabase add expenses
```

The command also installs `updated-at`, `tenant`, `access`, `approvals`, `ledger`.

## Configure

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

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

export default defineConfig({
  blocks: {
    // Required by expenses; add installs them too.
    "updated-at": {},
    tenant: {},
    access: {},
    approvals: {},
    ledger: {},
    // Modes: "managed", "custom". The default is "managed".
    expenses: { mode: "managed" },
  },
});
```

## Client

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

## Events

- `expense_report.approved`
- `expense_report.cancelled`
- `expense_report.created`
- `expense_report.reimbursed`
- `expense_report.submitted`

## Related blocks

Requires: [tenant](https://bettersupabase.com/blocks/tenant.md), [access](https://bettersupabase.com/blocks/access.md), [approvals](https://bettersupabase.com/blocks/approvals.md), [ledger](https://bettersupabase.com/blocks/ledger.md)

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