# `mix phoenix_kit.entities.export`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.76/lib/mix/tasks/phoenix_kit/entities/export.ex#L1)

Mix task to export entity definitions and data to JSON files.

Each entity is exported as a single file containing both the definition
and all its data records.

Exports are stored in the configured mirror path (default: priv/entities/).

## Usage

    # Export all entities (definitions + data if data mirroring enabled)
    mix phoenix_kit.entities.export

    # Export specific entity
    mix phoenix_kit.entities.export --entity brand

    # Export with data included (regardless of setting)
    mix phoenix_kit.entities.export --with-data

    # Export without data (regardless of setting)
    mix phoenix_kit.entities.export --no-data

    # Custom output path
    mix phoenix_kit.entities.export --output /path/to/export

## Options

    --entity NAME        Export specific entity only
    --with-data          Include data records in export
    --no-data            Exclude data records from export
    --output PATH        Custom output directory (overrides settings)
    --quiet              Suppress output messages

## Output Structure

    priv/entities/
      brand.json       # Contains definition + all data records
      product.json     # Contains definition + all data records

## JSON Format

    {
      "export_version": "1.0",
      "exported_at": "2025-12-11T10:30:00Z",
      "definition": {
        "name": "brand",
        "display_name": "Brand",
        ...
      },
      "data": [
        {"title": "Acme Corp", "slug": "acme-corp", ...},
        {"title": "Globex", "slug": "globex", ...}
      ]
    }

## Examples

    # Full export for version control backup
    mix phoenix_kit.entities.export --with-data

    # Export just the brand entity
    mix phoenix_kit.entities.export --entity brand

    # Export to a specific directory
    mix phoenix_kit.entities.export --output ./backup/entities

---

*Consult [api-reference.md](api-reference.md) for complete listing*
