> ## Documentation Index
> Fetch the complete documentation index at: https://chorus.pixelsprout.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Commands

> Laravel Chorus provides several Artisan commands to help you manage real-time synchronization. All commands use the `chorus:` prefix.

## Installation & Setup

### `chorus:install`

Install and set up Laravel Chorus with Reverb for WebSocket broadcasting.

```bash theme={null}
php artisan chorus:install
```

This command:

* Publishes migrations, config files, and JavaScript resources
* Sets up Laravel Reverb for WebSocket broadcasting
* Configures broadcasting settings
* Prompts you to select your frontend framework (React, Vue, Svelte, or Vanilla JS)
* Installs the appropriate Chorus package for your chosen framework
* Creates the `resources/js/_generated` directory with default schema

### `chorus:generate`

Generate IndexedDB schema and TypeScript types from models that are using the Harmonics trait.

```bash theme={null}
php artisan chorus:generate
```

This command:

* Scans all models in the `app/Models` directory
* Identifies models using the `Harmonics` trait
* Generates IndexedDB schema based on sync fields
* Creates a TypeScript schema file at `resources/js/_generated/schema.ts`
* Create generated types for sync fields at `resources/js/_generated/types.ts`

When declaring sync fields, you can optionally provide JavaScript types for your sync fields on
a given model. If no type is given for a field, then the default will be the `any` type.

```php theme={null}
use Pixelsprout\LaravelChorus\Support\JSType;

protected $syncFields = [
    'id' => JSType::String,
    'body'  => JSType::String,
    ...
];
```

## Server Management

### `chorus:debug`

Debug Chorus active channels and connections.

```bash theme={null}
php artisan chorus:debug
```

This command shows:

* Active WebSocket channels and their connection timestamps
* Active user IDs
* Debugging instructions for testing real-time updates

## Code Generation

### `chorus:make-action`

Create a new ChorusAction class for handling multi-table write operations.

```bash theme={null}
php artisan chorus:make-action CreatePostWithActivityAction
```

Creates a ChorusAction class in `App\Actions\ChorusActions` namespace that extends the `ChorusAction` base class.

### `chorus:make-prefix-resolver`

Create a new PrefixResolver class for channel prefixing.

```bash theme={null}
php artisan chorus:make-prefix-resolver UserPrefixResolver
```

Creates a PrefixResolver class in `App\Chorus\Resolvers` namespace that implements the `PrefixResolver` contract.
