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.
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
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.
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 modules 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 modules. 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.
OS | Path |
---|---|
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
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 the access keys from the module.
Usage: juno logout [options]
Options:
-h, --help Output usage information.
Init
Set up your project.
Usage: juno init [options]
Options:
--minimal Skip few prompts and generate a config file with a placeholder satellite ID.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-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.
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 app to your satellite.
Usage: juno deploy [options]
Options:
-c, --clear Clear existing app files before proceeding with deployment.
--no-apply Submit the deployment as a change but do not apply it yet.
-k, --keep-staged Keep staged assets in memory after applying the change.
-i, --immediate Deploy files instantly (bypasses the change workflow).
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
Notes:
- The option --keep-staged only applies when --no-apply is NOT used (i.e. the change is applied immediately).
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.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
Snapshot
Handle snapshot-related tasks.
Usage: juno snapshot <subcommand> [options]
Subcommands:
create Create a snapshot of your current state.
restore Restore a previously created snapshot.
delete Delete an existing snapshot.
Options:
-t, --target Which module type should be snapshotted? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
Notes:
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
Stop
Stop a module.
Usage: juno stop [options]
Options:
-t, --target Which module type should be stopped? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
Notes:
- Targets can be shortened to s for satellite, m for mission-control and o for orbiter.
Start
Start a module.
Usage: juno start [options]
Options:
-t, --target Which module type should be started? Valid targets are satellite, mission-control or orbiter.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-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 app 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 app.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
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 A path to a specific local gzipped WASM file to publish.
--clear-chunks Clear any previously uploaded WASM chunks (applies if the WASM size is greater than 2MB).
--no-snapshot Skip creating a snapshot before upgrading.
-r, --reset Reset to the initial state.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-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.
- 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 developer tasks like starting/stopping a local network.
Usage: juno dev <subcommand> [options]
Subcommands:
start Start a local Internet Computer network in a container.
stop Stop the local network.
build Alias for juno functions build.
eject Alias for juno functions eject.
Start
Start a local Internet Computer network in a container.
Usage: juno dev start [options]
Options:
-l, --lang Specify the language for building the serverless functions: rust, typescript or javascript.
--cargo-path Path to the Rust manifest.
--source-path Optional path to the TypeScript or JavaScript entry file.
-w, --watch Rebuild your functions automatically when source files change.
-h, --help Output usage information.
Notes:
- The language and path options are only used in combination with watch.
- If no language is provided, the CLI attempts to determine the appropriate build.
- Language can be shortened to rs for Rust, ts for TypeScript and mjs for JavaScript.
- Use --cargo-path to specify a specific crate path. For Rust builds, this maps to --manifest-path for cargo build. For TypeScript and JavaScript, it points to the Rust crate (commonly "Sputnik") that imports the functions.
- An optional --source-path to specify the source file for TypeScript and JavaScript (e.g. index.ts or index.mjs).
- The watch option rebuilds when source files change, with a default debounce delay of 10 seconds; optionally, pass a delay in milliseconds.
Functions
Build and upgrade your satellite's serverless functions.
Usage: juno functions <subcommand> [options]
Subcommands:
build Build your functions.
eject Scaffold the necessary files for developing your serverless functions.
publish Publish a new version of your functions.
upgrade Upgrade your satellite's serverless functions.
Notes:
- The local server supports live reloading.
- You can use fn as a shortcut for functions.
Build
Build your serverless functions.
Usage: juno functions build [options]
Options:
-l, --lang Specify the language for building the serverless functions: rust, typescript or javascript.
--cargo-path Path to the Rust manifest.
--source-path Optional path to the TypeScript or JavaScript entry file.
-w, --watch Rebuild your functions automatically when source files change.
-h, --help Output usage information.
Notes:
- If no language is provided, the CLI attempts to determine the appropriate build.
- Language can be shortened to rs for Rust, ts for TypeScript and mjs for JavaScript.
- Use --cargo-path to specify a specific crate path. For Rust builds, this maps to --manifest-path for cargo build. For TypeScript and JavaScript, it points to the Rust crate (commonly "Sputnik") that imports the functions.
- An optional --source-path to specify the source file for TypeScript and JavaScript (e.g. index.ts or index.mjs).
- The watch option rebuilds when source files change, with a default debounce delay of 10 seconds; optionally, pass a delay in milliseconds.
Eject
Generate the required files to begin developing serverless functions in your project.
Usage: juno functions eject [options]
Options:
-l, --lang Specify the language for building the serverless functions: rust, typescript or javascript.
-h, --help Output usage information.
Notes:
- Language can be shortened to rs for Rust, ts for TypeScript and mjs for JavaScript.
Publish
Publish a new version of your serverless functions.
Usage: juno functions publish [options]
Options:
--no-apply Submit the release as a change but do not apply it yet.
-k, --keep-staged Keep staged assets in memory after applying the change.
-s, --src A path to a specific local gzipped WASM file to publish.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
Notes:
- The option --keep-staged only applies when --no-apply is NOT used (i.e. the change is applied immediately).
Upgrade
Upgrade your serverless functions.
Usage: juno functions upgrade [options]
Options:
--cdn Select a previously published WASM file from the CDN (interactive).
--cdn-path Use a specific published WASM file from the CDN.
--clear-chunks Clear any previously uploaded WASM chunks (applies if the WASM size is greater than 2MB).
--no-snapshot Skip creating a snapshot before upgrading.
-r, --reset Reset to the initial state.
-s, --src A path to a specific local gzipped WASM file to publish.
-h, --help Output usage information.
Notes:
- If no option is provided, the default local build output will be used.
- If --src is specified, it takes precedence over any CDN options.
- Use --cdn to interactively select from recent published releases.
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.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-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 init [options]
Options:
-c, --cli Check only the version of the CLI.
-m, --mode Set env mode. For example production or a custom string. Default is production.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.
-h, --help Output usage information.
Who am I?
Display your current profile, access key, 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.
--container-url Override a custom container URL. If not provided, defaults to production or the local container in development mode.
--console-url Specify a custom URL to access the developer Console.