SelectoMix (selecto_mix v0.4.6)

Mix tasks and tooling for automatic Selecto configuration generation.

SelectoMix provides utilities to automatically generate Selecto domain configurations from Ecto schemas, create overlay modules for app-specific customizations, and scaffold related SelectoComponents persistence helpers.

Key Features

  • Automatic Schema Discovery: Finds and introspects all Ecto schemas in your project
  • Intelligent Configuration Generation: Creates comprehensive Selecto domains with suggested defaults
  • Overlay Customization: Keeps app-specific modifications outside generated base files
  • Igniter Integration: Uses modern Elixir project modification tools
  • Persistence Scaffolds: Generates saved views, saved view configs, exported views, and filter set persistence modules
  • Domain Artifacts: Exports normalized domain JSON artifacts for tools and round-trip checks
  • Domain Import Plans: Checks import/readback plans and can write validated, placeholder-free domain previews from normalized artifacts
  • Domain Inspection: Generates Studio/tooling inspection JSON from normalized domain artifacts
  • Domain Diagrams: Generates Mermaid diagrams from domain inspection artifacts
  • Domain Docs: Generates Markdown references from normalized domain artifacts
  • Studio Host Artifacts: Can generate trusted host-app inspection providers for SelectoStudio.DomainArtifacts

Main Mix Tasks

Getting Started

  1. Add SelectoMix to your project dependencies
  2. Run mix selecto.install to setup basic structure
  3. Generate domains with mix selecto.gen.domain --all
  4. Put app-specific changes in the generated overlay modules
  5. Re-run mix selecto.gen.domain --force after schema changes to refresh generated base files

Configuration

You can configure SelectoMix in your config/config.exs:

config :selecto_mix,
  output_dir: "lib/my_app/selecto_domains",
  default_associations: true

Example Usage

# Generate domain for a single schema
mix selecto.gen.domain Blog.Post

# Generate for all schemas in a context
mix selecto.gen.domain Blog.*

# Generate for all schemas with associations
mix selecto.gen.domain --all --include-associations

# Force regeneration of the generated base file
mix selecto.gen.domain Blog.Post --force

Summary

Functions

Get configuration for SelectoMix.

Get the default output directory for generated domains.

Check if Selecto dependencies are available.

List all available Ecto schemas in the current project.

Validate a schema module exists and is an Ecto schema.

Get the version of SelectoMix.

Functions

config()

Get configuration for SelectoMix.

default_output_dir()

Get the default output directory for generated domains.

dependencies_available?()

Check if Selecto dependencies are available.

discover_schemas()

List all available Ecto schemas in the current project.

validate_schema_module(module_name)

Validate a schema module exists and is an Ecto schema.

version()

Get the version of SelectoMix.