Moose CLI

Moose CLI Reference

Installation

Moose comes with a handy CLI for managing your 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>

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 Moose 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 support ts (Typescript) and python.
  • --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

Check

Checks the project for non-runtime errors.

Terminal
moose check

Data Model

Data Model Init

Initializes a new Data Model for your project. By specifying a sample data file, the CLI will be able to auto-generate the schema for you based on the data itself. Learn more about Data Models here.

Terminal
moose data-model init <NAME> --sample <SAMPLE>
  • <NAME>: Name of your data model.
  • <SAMPLE>: Path to a sample .csv or .json data file to introspect the schema from.

Import

Terminal
moose import --file <FILE> <DATA_MODEL_NAME>
  • <FILE>: Path to a .csv or .json file to import into the Data Model.
  • <DATA_MODEL_NAME>: Name of the Data Model to import the file into.

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 <SOURCE> --destination <DESTINATION>
  • <SOURCE>: Name of the source Data Model.
  • <DESTINATION>: Name of the destination Data Model.

Block

Block Init

Generates a new Block for your project. Learn more in the Blocks docs.

Terminal
moose block init <NAME>
  • <NAME>: Name of your block.

Consumption

Consumption Init

Generates a new Consumption API for your project. Learn more in the Consumption docs.

Terminal
moose consumption init <NAME>
  • <NAME>: Name of your consumption API route.

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