SelectoMix (selecto_mix v0.4.7)
Mix tasks and tooling for automatic Selecto configuration generation.
SelectoMix provides utilities to automatically generate Selecto domain configurations from Ecto schemas or database relations, create overlay modules for app-specific customizations, and scaffold related SelectoComponents persistence helpers.
Key Features
- Schema and Relation Discovery: Introspects Ecto schemas or direct database relations
- 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
- Domain Contract Verification: Verifies consumer domain dependencies against provider published surfaces and snapshots published contracts
- Studio Host Artifacts: Can generate trusted host-app inspection
providers for
SelectoStudio.DomainArtifacts
Main Mix Tasks
mix selecto.gen.domain- Generate Selecto domains from Ecto schemas or database relationsmix selecto.install- Install Selecto dependencies and setup project structuremix selecto.gen.saved_views- Generate persistent saved views supportmix selecto.gen.saved_view_configs- Generate per-view-type saved config persistencemix selecto.gen.exported_views- Generate exported iframe view persistencemix selecto.gen.filter_sets- Generate filter set persistencemix selecto.domain.export- Export normalized domain JSON artifactsmix selecto.domain.check- Check normalized domain JSON artifactsmix selecto.domain.import- Check import plans or write validated previews for normalized artifactsmix selecto.domain.inspect- Inspect normalized domain JSON artifactsmix selecto.domain.describe- Generate Studio/tooling inspection JSON from normalized artifactsmix selecto.domain.diagram- Generate Mermaid diagrams from domain inspection artifactsmix selecto.domain.diff- Diff normalized domain JSON artifactsmix selecto.domain.docs- Generate Markdown docs from normalized domain JSON artifactsmix selecto.domain.verify- Verify consumer dependencies against a provider artifactmix selecto.domain.contract.snapshot- Write published domain contract snapshotsmix selecto.domain.contract.diff- Diff published domain contract snapshots
Getting Started
- Add SelectoMix to your project dependencies
- Run
mix selecto.installto setup basic structure - Generate domains with
mix selecto.gen.domain --all - Put app-specific changes in the generated overlay modules
- Re-run
mix selecto.gen.domain --forceafter 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: trueExample 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 (host) Mix project.
Validate a schema module exists and is an Ecto schema.
Get the version of SelectoMix.
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 (host) Mix project.
Uses Mix.Project.config()[:app] to resolve the current host application
and inspects its compiled module list. Returns [] if there is no Mix
project loaded (e.g. when called outside of a Mix task/session) or if the
host application has no modules key available yet.
Validate a schema module exists and is an Ecto schema.
Get the version of SelectoMix.