Catalyst

Catalyst is a dynamic patching system and "meta-framework" for scaffolding production-ready Elixir applications.

Goals

High-Level Architecture

Catalyst operates on a Declarative Pipeline model. It does not execute logic immediately; instead, it resolves a list of intent (Actions) which are then executed by a central engine.

Core Concepts:

Project Structure

catalyst/
├── lib/
│ ├── catalyst.ex # Main Pipeline
│ ├── catalyst/
│ │ ├── action.ex # Action Behaviour
│ │ ├── config.ex # Configuration Structs
│ │ ├── plugin.ex # Plugin Behaviour
│ │ ├── actions.ex # Actions Type Contract
│ │ ├── actions/
│ │ │ ├── add_file.ex # Action Struct + Runner
│ │ │ ├── add_dependency.ex # Action Struct + Runner
│ │ │ ├── system_command.ex # Action Struct + Runner
│ │ │ └── executor.ex # Central Action Dispatcher
│ └── mix/
│ └── tasks/
│ └── catalyst.run.ex # CLI Entry Point
└── mix.exs

Commands

Catalyst runs from a config file:

mix catalyst.run path/to/config.exs

Official plugins live in a sibling catalyst_plugins package/repository. The core package owns the engine, action APIs, and plugin behavior; the plugins package owns built-in plugin modules and their templates.

Configuration

Catalyst config supports two modes:

Example (mode: :new):

alias Catalyst.Config
alias Catalyst.Plugins
%Config{
version: 1,
mode: :new,
app: %Config.App{
name: "My App",
path: "my_app",
module: "MyApp"
},
plugins: [
{Plugins.PhoenixBase,
phoenix: "1.18.4",
flags: [install: false, ecto: false, mailer: false]},
{Plugins.Credo},
{Plugins.Sobelow, strict_post_validate: false}
]
}

Example (mode: :existing):

alias Catalyst.Config
alias Catalyst.Plugins
%Config{
version: 1,
mode: :existing,
app: %Config.App{
path: "."
},
plugins: [
{Plugins.Credo},
{Plugins.Sobelow, strict_post_validate: false}
]
}