Magek Framework
    Preparing search index...

    Magek CLI

    The Magek CLI is a command line interface that helps you develop your Magek applications. It is built with Node.js and published to NPM through the package @magek/cli. It's automatically included as a dependency in every Magek project - no global installation required!

    When you create a Magek project using npm create magek@latest, the CLI is automatically included as a dependency. Simply use npx magek to run any CLI command within your project directory.

    # Create a new project (CLI automatically included)
    npm create magek@latest my-project

    # Navigate to your project and start using the CLI
    cd my-project
    npx magek --help

    Once you're in your Magek project directory, you can use the npx magek command to see the help message.

    Tip: You can also run npx magek --help to get the same output.

    Command Description
    new:command Creates a new command in the project
    new:entity Creates a new entity in the project
    new:event Creates a new event in the project
    new:event-handler Creates a new event handler in the project
    new:read-model Creates a new read model in the project
    new:scheduled-command Creates a new scheduled command in the project

    Tip: To create a new Magek project, use the modern npm create pattern:

    npm create magek@latest my-project
    

    All CLI commands should be run with npx magek within your project directory.

    npm create magek@latest my-project
    

    Magek CLI automatically discovers adapter packages named @magek/adapter-* that export a magekCli object. Any commands listed there are registered at startup and appear in npx magek --help.

    export const magekCli = {
    commands: {
    'migrate:status': MigrateStatusCommand,
    'migrate:apply': MigrateApplyCommand,
    },
    }

    Note: Plugin discovery executes code from installed adapter packages. Only install trusted adapters in your project.

    See the Getting Started guide for details.