Getting Started
The Catalyst CLI is generally available, but Native Hosting is currently in closed beta. There may be breaking changes to the Native Hosting APIs as we finalize them. To express interest in gaining access, fill out the Native Hosting Closed Beta Interest Form.
This guide shows how to deploy a Catalyst application to BigCommerce’s Native Hosting infrastructure with the Catalyst CLI. If you’re starting from scratch, follow the New project quick start. If you already have a Catalyst repository, jump to Set up with an existing project. Both paths converge on the shared Working with your deployment steps.
Make sure to read the Overview documentation for how BigCommerce’s hosting infrastructure and configuration variables work, and the CLI Reference for the full list of commands.
Prerequisites
- The Native Hosting feature flag enabled - This flag enables the core hosting APIs and allows you to create an API Account with the correct permissions. While Native Hosting is in closed beta, you must be approved to have this flag turned on.
- Configuration variables - Refer to the Overview documentation for which variables are needed and where they are read from.
- Your store user account must have “high-risk user permissions” to create Store-level API Accounts.
New project quick start (recommended)
Scaffold, deploy, and view a hosted storefront in five steps.
-
Scaffold a project. The CLI walks you through naming the project, authenticating via your browser, and connecting a channel, then writes your credentials to
.env.local, installs dependencies, and initializes a git repository.To set up Native Hosting at the same time, add the
--hosting commerceflag. When you omit it, scaffolding stays hosting-agnostic and you can opt in later — the firstcatalyst deploywill offer to run setup for you. -
Run it locally. This starts the dev server and generates the GraphQL types the build needs.
-
Create your Native Hosting project. This creates a BigCommerce infrastructure project and links it to your local repository.
-
Deploy. The CLI builds your project and deploys the assets to BigCommerce’s hosting infrastructure. On success it prints a View your deployment at: URL — that line is the success signal.
-
View your storefront at the printed deployment URL.
Because you authenticated during step 1, you can skip the Authenticate step. To add runtime secrets, point a channel at the deployment, or attach a custom domain, continue with Working with your deployment.
Set up with an existing project
If you already have a Catalyst project (created via the One-Click Catalyst app or manually), add Native Hosting to it.
-
Install the CLI and the OpenNext Cloudflare adapter in the directory that contains your Catalyst app (the project root for a standalone project, or
core/in the monorepo template). -
Authenticate. See Authenticate below.
-
Create or link a project. See Create or link a project below.
-
Deploy. The first time you run
pnpm catalyst deploy(orpnpm catalyst project link) on a project that isn’t set up yet, the CLI prompts to run Commerce Hosting setup. Accepting it transforms your project automatically so you don’t have to make these changes by hand:- Renames
proxy.tstomiddleware.ts, changesexport const proxytoexport const middleware, and addsruntime: 'experimental-edge'to the exported config. This is required becauseproxy.tsis locked to the Node.js runtime, which the OpenNext Cloudflare adapter doesn’t support. (This workaround will be removed once the adapter supports Node middleware via the Adapters API.) - Installs
@opennextjs/cloudflare. - Detects the default
instrumentation.ts(which registers@vercel/otel, incompatible with the Cloudflare Workers bundle and the cause of a “Failed to prepare server” error at cold start) and prompts to remove it and drop@vercel/otelfrompackage.json.
The
instrumentation.tsremoval prompt only appears in an interactive terminal. In any non-interactive context (CI, piped input, or a background shell), the cleanup is silently skipped — delete or gateinstrumentation.tsyourself, or your deployed worker will keep logging the cold-start error. - Renames
Once setup completes, continue with Working with your deployment.
Working with your deployment
The steps below apply to both paths above once your project is set up. See the CLI Reference for the full list of commands and options.
Authenticate
Commands that interact with the BigCommerce API need your store credentials.
If you scaffolded your project with pnpm create, you’re already authenticated — the CLI stored your credentials in .env.local during setup, so you can skip this step.
Otherwise — for example, a freshly cloned repository with no stored credentials — authenticate based on your environment:
Local development (interactive): Run pnpm catalyst auth login to authenticate via your browser. The CLI opens the BigCommerce authorization page, walks you through an OAuth device-code flow, and stores your credentials locally in .bigcommerce/project.json.
After logging in, you can omit the --store-hash and --access-token flags from all subsequent commands — the CLI reads them automatically.
CI/CD (non-interactive) — In environments like GitHub Actions where a browser is not available, provide credentials via environment variables (CATALYST_STORE_HASH, CATALYST_ACCESS_TOKEN) or pass them directly as flags (--store-hash and --access-token) on each command. See the Overview documentation for the full configuration priority order.
Create or link a project
Run the project create command to create a new BigCommerce infrastructure project and link it to your local repository.
Alternatively, if you’ve already created a project, you can link to an existing one if you know the project’s uuid using the project link command.
After creating a new project or linking to an existing one, a .bigcommerce/project.json file should have been created for you. This file stores the necessary configuration variables such as your store hash, access token, etc. Since this file includes an access token, it should not be checked into source control.
Runtime environment variables and secrets
In addition to the configuration variables mentioned in the creation step, your deployment needs the runtime variables that Catalyst requires. See the Environment Variables documentation for a full list of required variables.
Save those runtime variables once with catalyst env add. They are stored in .bigcommerce/project.json and sent as encrypted secrets on every deploy, so you don’t need to pass them again each time.
To set or override a variable for a single deployment without storing it, pass it with the --secret flag. A --secret value takes precedence over a stored value for the same key.
Running pnpm catalyst deploy invokes the CLI directly and does not run the GraphQL codegen step. On a brand-new project this can surface a TypeScript error such as 'response.data' is of type 'unknown' because the generated types don’t exist yet. Run pnpm dev once (or pnpm build, or pnpm run generate) to generate them before deploying. In CI, use pnpm run deploy, which runs codegen first.
After a successful deploy, the CLI prints output similar to the following. The final View your deployment at: line is the success signal — if it’s missing, the deploy failed even when the surrounding build output looks normal.
Point a channel at your deployment
After a successful deploy, point a BigCommerce channel’s site URL at one of your deployment hostnames so the storefront resolves to your new deployment. Run channel update to select a channel and hostname interactively.
To skip the prompts, pass the channel and hostname directly. Run pnpm catalyst project list to see the available deployment hostnames.
You can also let the deploy do this for you by passing --update-site-url, which prompts to update a channel’s site URL after a successful deploy.
(Optional) Add a custom domain
By default, your deployment is served from a BigCommerce-provided hostname in the form <your-project>.catalyst-sandbox.store (your worker URL), shown in the catalyst deploy output and via pnpm catalyst project list. To serve it from your own domain, add the domain to your project with catalyst domains add and create the matching DNS record at your DNS provider.
Subdomain (e.g. shop.example.com) — create a CNAME record pointing at your worker URL.
Apex/root domain (e.g. example.com) — create an A record pointing at your store IP, which you can find in the store Control Panel under Settings → Email & DNS Records.
Then register the domain with the CLI:
New domains start in a pending verification state and become active once DNS has propagated and BigCommerce can verify the record. DNS propagation can take anywhere from a few minutes up to a day, so check back on the status periodically rather than waiting on a single command. You can check a domain’s status at any time, list all domains on the project, and remove a domain you no longer need.
See the CLI Reference for the full set of domains options.
View logs
Once your storefront is deployed, you can stream live logs or query historical ones. Both commands are scoped to your linked project.
The --format request option renders access-log style output that’s useful for spotting failing routes and status codes, and --format json is handy for piping into other tools. See the CLI Reference for the full set of logs filters.