---
title: Authoring and Publishing
description: Publish tested TypeScript source through generated shadcn registry JSON
---

Start with a working implementation of a supported category contract:

- [Custom gateways](../gateways/custom) defines gateway exports, capabilities, credentials, and model defaults.
- [Authoring plugins](../plugins/create-plugin) defines server/client contributions, schema ownership, and framework adapters.
- [Authoring tools](../tools/authoring) defines server and renderer exports, registration descriptors, and environment requirements.

## Keep source in code

In this repository, gateway source lives under `packages/registry/src/gateways/<id>/` and tool source under `packages/registry/src/tools/<id>/`. Optional implementation source lives under `packages/registry/src/plugins/<id>/`. Declare files, dependencies, installation targets, and metadata in `packages/registry/registry.ts`.

Use standard shadcn `dependencies` for npm packages and `registryDependencies` for shared registry items. ChatJS metadata describes the category contract. The public item name does not have to contain the category name.

## Generate and publish JSON

Run `bun run --cwd packages/registry build`. The build serializes the typed registry definition and descriptors, then runs shadcn to embed source files in `packages/registry/dist/r/*.json`. Treat these files as generated artifacts.

Publish the generated item files at your registry endpoint. Configure an alias using a URL template ending in `{name}.json`, as described in [Namespaces](./namespaces). Consumers install those files through shadcn or the ChatJS CLI, and own the resulting source in their app.

Before publishing, follow [Building and Testing](./testing) to check both the source and its installation into an independent app.

## Mirror the reference application

Use [Registry Mirror](./mirror) to preview canonical source changes in `apps/chat` while root `bun dev` runs. The guide covers source locations, generated-file ownership and regeneration commands. Keep core application source in `apps/chat`.

Fresh core scaffolds exclude optional implementation source and start with empty plugin registrations. [Create](../cli/create) and [add](../cli/add) assemble the selected implementations. Application settings, permissions and runtime tool selections remain editable.
