# Channels

> Named conversations on the messaging core: public channels anyone in the tenant reads and joins, private ones for their members, each with a topic, a purpose and an optional linked record. Create, rename, join, leave and browse; messages, threads, typing and read markers come from messaging.

- Category: Collaboration
- Module: `channels`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/channels
- Page: https://bettersupabase.com/blocks/channels

## Install

```bash
npx better-supabase add channels
```

The command also installs `updated-at`, `tenant`, `access`, `subjects`, `messaging`.

## Configure

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

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

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

## Client

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

## Events

- `channel.created`
- `channel.updated`

## Related blocks

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

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

## Recipes

- [Channel sidebar](https://bettersupabase.com/recipes/channel-sidebar.md): The caller's channels with unread and mention counts, kept live, with dialogs to browse, join and create channels.
- [Message list](https://bettersupabase.com/recipes/message-list.md): A conversation's messages over Realtime, with older pages on demand, who is typing, reply counts and the composer.
- [Thread panel](https://bettersupabase.com/recipes/thread-panel.md): A thread beside the channel: the root message, its replies live over Realtime, and a composer that replies into it.
