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/exportOptions
--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 messagesOutput Structure
priv/entities/
brand.json # Contains definition + all data records
product.json # Contains definition + all data recordsJSON 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