Skip to main content

CLI

The Juno CLI provides a variety of tools for managing and deploying projects.

Installing the Juno CLI

To download and install Juno CLI, run the following command:

npm i -g @junobuild/cli

Administration

Commands dedicated to configuring and managing deployed Satellites, Mission Control, and other modules.

tip

The CLI automatically runs in non-interactive mode if either a JUNO_TOKEN is set or the --headless argument is used.

The former is set when you set up a GitHub Actions.


Login

important

Authenticating your terminal saves sensitive information on your device. We recommend setting up a password to encrypt this file when prompted.

Generate an authentication for use in non-interactive environments.

Usage: juno login [options]

Options:
-b, --browser A particular browser to open. supported: chrome|firefox|edge.
-h, --help Output usage information.
note

The authentication process requires a browser.

If you've previously authenticated your terminal and decide to log in again, the CLI will prompt you about reusing your existing identity.

This allows you to reuse your authorization, especially when creating new segments like satellites or orbiters.

How does it work?

A new principal is generated on your local machine and added as a controller of the selected segments. This principal is then used to authenticate any CLI calls made from your terminal to your satellites, mission controls or other modules.

The key is saved in the OS-specific user's variables path.

OSPath
Mac~/Library/Preferences/juno-nodejs
Windows%APPDATA%\juno-nodejs\Config (for example, C:\Users\USERNAME\AppData\Roaming\juno-nodejs\Config)
Linux~/.config/juno-nodejs (or $XDG_CONFIG_HOME/juno-nodejs)

Logout

caution

This action currently does not remove the controllers from satellites and/or mission control and/or orbiter. It only logs out your local machine by removing the locally saved key (principal).

Log out of the current device. ⚠️ This action does not remove controllers from the module.

Usage: juno logout [options]

Options:
-h, --help Output usage information.

Init

Set up your project.

Usage: juno init [options]

Options:
-h, --help Output usage information.

The juno init command creates a juno.config file in the root directory of your project.

Depending on your project, it will either create a TypeScript, JavaScript, or JSON file.

tip

We recommend using the first two options because they can leverage your IDE's IntelliSense with type hints.

This file is necessary for deploying, configuring, or running any other CLI commands for your app.

Read more about the configuration.


Deploy

Deploy your dapp to your satellite.

Usage: juno deploy [options]

Options:
-c, --clear Clear existing dapp files before proceeding with deployment.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.

Config

Apply configuration to satellite.

Usage: juno config [options]

Options:
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.

Backup

Handle backup-related tasks.

Usage: juno dev <subcommand> [options]

Subcommands:
create Create a backup of your current state.
restore Restore a previously created backup.
delete Delete an existing backup

Options:
-t, --target Which module type should be backed up? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.

Notes:

- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.

Clear

Clear existing dapp code by removing JavaScript, HTML, CSS, and other files from your satellite.

Usage: juno clear [options]

Options:
-f, --fullPath Clear a particular file of your dapp.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.
note

This command removes existing files from the satellite and only affects the app assets. The user's uploaded files will not be cleared as the app is deployed to a reserved collection, #dapp.


Upgrade

Upgrade a module to a new version.

Usage: juno upgrade [options]

Options:
-t, --target Which module type should be upgraded? Valid targets are satellite, mission-control or orbiter.
-s, --src An optional local gzipped WASM file for the upgrade. By default, the CDN will be used.
-r, --reset Reset to the initial state.
-cc, --clear-chunks Clear any previously uploaded WASM chunks (applies if the WASM size is greater than 2MB).
-nb, --no-backup Skip creating a backup before upgrading.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.

Notes:

- Resetting a mission control is not possible.
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
important
  • We recommend that you stay current with the Juno releases, as some features may not perform correctly in the console if your smart contracts are outdated.
  • Upgrading requires a stable internet connection for a successful process.

The CLI automatically runs in non-interactive mode if either a JUNO_TOKEN is set or the --headless argument is used.


Development

Handle development-related tasks such as building and deploying locally using Cargo and Docker.

Usage: juno dev <subcommand>

Subcommands:
build Compile satellite features using Cargo.
eject Create a Rust template for custom satellite feature hooks and extensions.
start Start a local Internet Computer network, encapsulated in a Docker environment.
stop Stop the Docker environment.
tip

Find more about local development and extending features with serverless functions in the related guide.


Others

Additional commands for managing and interacting with the CLI environment.


Open

Open your satellite in your browser.

Usage: juno open [options]

Options:
-b, --browser A particular browser to open. supported: chrome|firefox|edge.
-c, --console Open satellite in the console.
-m, --mode Set env mode. For example production or a custom string. Default is production.
-h, --help Output usage information.

Use

Switch between multiple profiles.

Usage: juno use [options]

Options:
-p, --profile The profile that should be use.
-l, --list What are the available profiles.
-h, --help Output usage information.

Version

Check the version of the modules and cli.

Usage: juno version [options]

Options:
-h, --help Output usage information.
-m, --mode Set env mode. For example production or a custom string. Default is production.

Who am I?

Display your current profile, controller, and links to your satellite.

Usage: juno whoami [options]

Options:
-h, --help Output usage information.
-m, --mode Set env mode. For example production or a custom string. Default is production.