# Comments operations

Comments let your team pin numbered notes on your running app and reply to them. This package is the server half: tables, access rules, and the `comments.*` [operations](https://vitehub.dev/docs/development/operations). The browser half is [UI comments](https://vitehub.dev/docs/ui/comments).

```ts [server/comments.ts]
import { defineComments } from 'vite-hub/comments'

export default defineComments({
  authorize: ({ user }) => Boolean(user),
})
```

Add this file, and ViteHub:

- Adds the `vitehub_comment_threads`, `vitehub_comment_messages`, and `vitehub_comment_counters` tables to your Database.
- Adds the operations `comments.list`, `get`, `create`, `reply`, `edit`, `delete`, `resolve`, `reopen`, and `users`. The Console, `vitehub comments list`, the [MCP endpoint](https://vitehub.dev/docs/development/mcp), and the browser client all call this code.
- Adds a **Comments** section to the [Console](https://vitehub.dev/docs/development/console). It lists the threads you may read, with filter chips and a page link. A row opens the thread in a side panel, where you reply, resolve, reopen, and `@`-mention people.

Only the people that `authorize` allows can see comments. Without a policy, people that the Console admits to its Comments section may read and write. On the dev server, anonymous people may too.

## Next steps

- [Get started](https://vitehub.dev/docs/comments/operations/get-started): add comments to an app.
- [Configure](https://vitehub.dev/docs/comments/operations/configure): `authorize`, subjects, mentions, and the Database.
- [Server API](https://vitehub.dev/docs/comments/operations/server-api): the operations and the browser transport.
- [Limits and errors](https://vitehub.dev/docs/comments/operations/limits-and-errors): limits and error codes.

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/comments.md)
- [Get started](https://vitehub.dev/raw/docs/comments/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/comments/configure.md)
- [Server API](https://vitehub.dev/raw/docs/comments/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/comments/hosts.md)
- [Limits and errors](https://vitehub.dev/raw/docs/comments/limits-and-errors.md)
- [With ViteHub](https://vitehub.dev/raw/docs/comments/with-vite-hub.md)
- [Operations overview](https://vitehub.dev/raw/docs/comments/operations.md) (this page)
- [Operations tutorial](https://vitehub.dev/raw/docs/comments/operations/get-started.md)
- [Configure operations](https://vitehub.dev/raw/docs/comments/operations/configure.md)
- [Operations server API](https://vitehub.dev/raw/docs/comments/operations/server-api.md)
- [Operations limits and errors](https://vitehub.dev/raw/docs/comments/operations/limits-and-errors.md)

Next: [COMMENTS_R0021](https://vitehub.dev/raw/docs/comments/diagnostics/comments_r0021.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
