---
schema_version: "1"
id: 3a7943c188f8c9c5924269d618c1061f3c586fb5acadf1a00336e59c69eefcf1
title: Deploy Storefront Next to Managed Runtime (MRT)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/sfnext/guides/sfnext-push-mrt-auto.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-push-mrt-auto.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8cca43c439214a1eb62bd4ffcbe392741d7a890a474b804d185bee706d487b30
products:
  - Composable Storefront
  - Salesforce APIs
---
# Deploy Storefront Next to Managed Runtime (MRT)

To redeploy a storefront that was created in Business Manager after initial deployment, use the Storefront Next CLI and the autocreated MRT project and environment.

## Prerequisites

- Node Package Manager (pnpm) version 10.28.0 or later. See [Installation](https://pnpm.io/installation) on the pnpm site.
- Node.js version 24.13.0 or later. See [Download Node.js](https://nodejs.org/en/download) on the Node.js site.
- To install Storefront Next dependencies specified in `package.json`, run the `pnpm install` command.
- To save the MRT API key credentials using the B2C CLI, install the B2C CLI. See [Agentic B2C Developer Toolkit](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/).

## Steps

1. In Business Manager, navigate to your storefront. Click App Launcher ![App Launcher](https://developer.salesforce.com/docs/media/sfnext/shared/appLauncher.png), then select **Administration > Sites > Storefronts**, and click your storefront.
2. In the storefront detail page, click your environment, and then next to Deployments, click **Manage**.
3. If you have an `.env` file in your storefront with the project ID (`MRT_PROJECT`) and environment ID (`MRT_TARGET`), skip this step. Otherwise, get these values from [Runtime Admin](https://runtime.commercecloud.com/).

   a. To get the environment ID, click **Environment Settings**, and copy the Environment ID value.

   b. To get the project ID, click the project name, then **Project Settings**, and copy the Project ID value.

4. To authenticate the CLI to Managed Runtime, use an API key. Get the Managed Runtime API key in Managed Runtime Admin. In Account Settings, under Personal API Key:

   a. If you haven't yet created an API key, click **Generate**.

   b. If you already have an API key, the value is partially masked. Click **Reset**, then click **Reset my API Key** when asked for confirmation.

   c. Run this command to save the API key locally in the `~/.mobify` file so it can be reused whenever you run the `pnpm sfnext push` command. Replace the placeholder values in this command before running it.

   ```
   b2c mrt save-credentials --user {your-email@example.com} --api-key {your-mrt-api-key}
   ```

   **note:** We recommend saving the MRT API key credentials. If you don't save the MRT API key, you can add the API key in the `MRT_API_KEY` variable in the `.env` file or supply it in the `--api-key` argument on the command line. See [MRT API Key](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.html#mrt-api-key) in the Agentic B2C Developer Toolkit.

5. From your local storefront folder, use this command to create a bundle and deploy it to your Managed Runtime environment. Replace the placeholders with the MRT project ID, target environment, and the API key you got earlier.

   ```
   pnpm sfnext push --project {mrt-project-id} --environment {target-env}
   --message "Deploying quick start bundle."
   ```

   **tip:** Always run `pnpm sfnext push` from the local storefront folder. To run the push command from another folder outside your storefront, use `pnpm dlx @salesforce/storefront-next-dev push` instead and pass in the storefront folder path with `--project-directory {sfnext-project-folder}`.

   **note:** The `.env` file in your Storefront Next project folder contains environment variables that the Storefront Next CLI uses. You can set the project ID in the `MRT_PROJECT` variable and the target environment in the `MRT_TARGET` variable. If you specify these values in both the command line and the `.env` file, the command line arguments are used.

6. Verify that the bundle was deployed to the target environment. In Managed Runtime Admin, in Projects, click your project and then your environment.

## Deploy Bundles in Business Manager (Beta)

If your B2C org is enrolled in the Developer Workspace beta, deploy new bundles from Business Manager and track the deployment progress and history. Before deploying a bundle, create it by following the steps in this page. Omit the `--environment` argument to skip bundle deployment and only upload it. Also, make sure tho remove the `MRT_TARGET` variables from the `.env` file.

To upload a bundle, use either of these commands. Find the project ID in the downloaded `.env` file from the storefront detail page in Business Manager, or in the Complete Your Storefront task.

```
pnpm sfnext push --project {mrt-project-id} --message "Deploying quick start bundle."
```

Alternatively, use the B2C CLI to upload a bundle. With the B2C CLI commands, you can choose SCAPI and use SCAPI authentication with the `--mrt-backend` argument. For more information about setting up the B2C CLI, see [Automate Storefront Administration Tasks with the B2C CLI](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-mrt-cli.md).

```
npx @salesforce/b2c-cli mrt bundle upload-v2  -p {mrt-project-id} --message "Deploying quick start bundle."
```

Next, deploy the bundle to an environment in Business Manager in **Administration > Storefronts > _Your Storefront_ > Bundles**.

![The deployed bundle is displayed in the target environment page](https://developer.salesforce.com/docs/media/sfnext/sfnext-bundles.png '{"class": "image-xl"}')

## Create and Deploy Bundles via the B2C CLI

Use the `mrt bundle` commands to create and deploy bundles to an environment. See [Automate Storefront Administration Tasks with the B2C CLI](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-mrt-cli.md).

## See Also

- [CLI Reference](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-cli.md)
- [Agentic B2C Developer Toolkit: Storefront Next](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/storefront-next.html)
- [Agentic B2C Developer Toolkit: Resolution Priority](https://salesforcecommercecloud.github.io/b2c-developer-tooling/guide/configuration.html#resolution-priority)
- [Manage the Storefront Development Workflow in Business Manager (Beta)](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-developer-workspace.md)
