# Legal entities

> Several legal entities inside one organization, each with its VAT and chamber numbers, bank account, logo and fiscal settings and one default per organization. Settings resolve from the legal entity to the organization to the code default, and options.on adds a nullable legal_entity_id to invoices, quotes, orders, numbering, accounting, inventory locations and settings; null means the default entity.

- Category: Tenancy & accounts
- Module: `legal-entities`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/legal-entities
- Page: https://bettersupabase.com/blocks/legal-entities

## Install

```bash
npx better-supabase add legal-entities
```

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

## Configure

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

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

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

## Client

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

## Events

- `legal_entity.created`
- `legal_entity.updated`

## Related blocks

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

Works with: [attachments](https://bettersupabase.com/blocks/attachments.md), [invoices](https://bettersupabase.com/blocks/invoices.md), [quotes](https://bettersupabase.com/blocks/quotes.md), [orders](https://bettersupabase.com/blocks/orders.md), [numbering](https://bettersupabase.com/blocks/numbering.md), [accounting](https://bettersupabase.com/blocks/accounting.md), [inventory](https://bettersupabase.com/blocks/inventory.md), [outbox](https://bettersupabase.com/blocks/outbox.md), [audit](https://bettersupabase.com/blocks/audit.md), [custom-fields](https://bettersupabase.com/blocks/custom-fields.md)
