Moose CLI

Installation

MooseJS comes with a handy CLI for managing your MooseJS application. Navigate to your project's directory to run commands. There are a few ways to run the CLI:

The simplest method to run the CLI is via NPX. No extra installation is necessary for this method.

Terminal
$ npx @514labs/moose-cli <command>

Moose CLI commands

Init

Instead of using create-moose-app, you can initialize your project manually with the CLI, if you'd like more flexibility and control. Either option will initialize a new MooseJS project for you, with all the necessary directories including temporary ones for data storage.

Terminal
moose init <name> --language <language> <--location <location>> <--no-fail-already-exists>
  • <name>: Name of your app or service.
  • --language <language>: Language of your app or service. We currently only support Typescript.
  • --location <location>: Location of your app or service. The default is the name of the project.
  • --no-fail-already-exists: By default, the init command fails if location exists, to prevent accidental reruns. This flag disables the check.
  • Build

    Builds your moose project. Syncs model changes, performs cleanup and prepares your project for use and deployment.

    When the --docker flag is used, the Moose build command also packages your project into local Docker containers. You can also use optional flags to specify which architecture to build for.

    Terminal
    moose build <--docker> <--amd64 | --arm64>

    Dev

    Starts a development environment running the full stack of your MooseJS application locally. As you develop your MooseJS application locally, changes you make to your codebase will be automatically reflected here in real-time (when you save changes).

    Terminal
    moose dev

    Prod

    Starts Moose in production mode. This command is automatically invoked from a packaged Moose Docker container.

    Terminal
    moose prod

    Function

    Function Init

    Generates a new Streaming Function for you, including creating and structuring the necessary files based on your specified data models. Learn more in the Streaming Function docs.

    Terminal
    moose function init --source <YourSourceDataModel> --destination <YourDestinationDataModel>

    Generate

    Generate SDK

    Generates an ingest sdk for the specified project.

    Terminal
    moose generate sdk -l <Language> -d <Directory> -p <ProjectLocation>
  • -l, --language: Language of the SDK. We currently only support Typescript.
  • -d, --destination: Directory to generate the SDK in.
  • -p, --project: Location of the project to generate the SDK for.
  • -f, --full-package: Whether or not to generate a full fledged package or just the source files in the language of choice.
  • Generate Migrations

    Generates migration scripts for models that are different from the previous version. Learn more in the Data Change Management docs.

    Terminal
    moose generate migrations

    Bump Version

    Bumps the version field in package.json, and adds an entry of the current version and commit hash to [supported_old_versions] section in moose.config.toml. Learn more in the Data Change Management docs.

    Terminal
    moose bump-version <new_version>
  • <new_version>: optional parameter, if omitted, moose will default to bumping the minor version.
  • Clean

    Clears all temporary data and stops development infrastructure.

    Terminal
    moose clean

    Logs

    View logs to help debug how data moves through Moose.

    Terminal
    moose logs <--tail> <--filter <search_string>>

    Processes

    View processes created by Moose, such as its underlying streaming platform & database with local access credentials.

    Terminal
    moose ps

    List

    View Moose primitives & infrastructure.

    Terminal
    moose ls -v <version> -l <limit> -s
  • -v, --version: View a specific version of data models & database infrastructure. Defaults to latest version.
  • -l, --limit: Limit output to a specific number of data models. Defaults to 10.
  • -s, --streaming: View streaming topics per data model.
  • Metrics

    View live metrics from your Moose application

    Terminal
    moose metrics