Apps Quick Start
BigCommerce Apps Quick Start
In this quick start tutorial, you will create a single-click app using Node.js, React, Next.js, and BigDesign.
Prerequisites
To successfully complete this tutorial, you will need the following:
- BigCommerce sandbox store (required to develop and test apps)
- Developer Portal Account (required to register apps)
- Experience using pnpm
- Node.js 24 or later
Get started
- Start by forking the starter-sc-app-next repository.
- Navigate to the root directory of your project and install packages.
- Copy the sample environment file. You will fill in its values in a later step.
Expose your local server over HTTPS
You will need a publicly accessible HTTPS URL to connect the draft app to BigCommerce. BigCommerce calls your app back over the internet and renders it in a control panel iframe, so a bare http://localhost:3000 will not work.
This tutorial uses ngrok, a tool that lets you expose local servers like localhost:3000 to the public internet over secure tunnels. The starter app also documents VS Code port forwarding and GitHub Codespaces as alternatives.
- In a new terminal window, install ngrok using Homebrew.
You can obtain your authtoken by going to https://dashboard.ngrok.com/get-started/your-authtoken.
- Expose the web server to the internet.
- Copy the
https://<subdomain>.ngrok-free.appForwarding URL. This tutorial refers to it as your app origin.
Most free tunneling services issue a new URL every time you restart the tunnel. When the URL changes, you must update both APP_ORIGIN and the callback URLs in the Developer Portal, then restart the dev server. Keeping the tunnel running for the length of a work session saves a lot of re-editing.
Register the app
Next, create a draft app profile in the Developer Portal using the following steps:
- Sign in to the Developer Portal.
- Click Create an app.
- Give the app a name.
- Click Technical.
- Enter the Auth Callback URL as
https://{app_origin}/api/app/auth. For example,https://12345.ngrok-free.app/api/app/auth. You can get theapp_originfrom the terminal that is runningngrok http 3000. - Enter the Load Callback URL as
https://{app_origin}/api/app/load. - Enter the Uninstall Callback URL as
https://{app_origin}/api/app/uninstall. - If your app supports multiple users, locate the App Features section. Select Multiple Users, then enter the Remove User Callback URL as
https://{app_origin}/api/app/remove_user. - Set the OAuth scopes the starter app requires: Customers
modify, Marketingmodify, Channel Settingsread-only, Channel Listingsread-only, Information & Settingsread-only, and App Extensionsmanage. To learn more about the available OAuth scopes, see OAuth scopes. - Click Update & Close.
- Click View Client ID to view this app’s client ID and client secret, or app-level API account.
Keep this tab open for the next step.
The Auth callback URL must match APP_ORIGIN exactly. The app sends it back to BigCommerce as the OAuth redirect_uri during the token exchange, and BigCommerce rejects a mismatch.
Scope changes only take effect for a store on the next install. If you change scopes later, uninstall and reinstall the app.
Configure environment variables
After registering the draft app, add its credentials and app origin to your project’s environment variables file.
-
Open the
.env.localfile you created in the root directory of your project. -
Set the following variables.
-
Replace the
BIGCOMMERCE_CLIENT_IDandBIGCOMMERCE_CLIENT_SECRETwith the app’s client ID and client secret from the Developer Portal. -
Update
APP_ORIGINwith your tunnel URL, omitting any trailing slash. You can get it from the terminal that is runningngrok http 3000. -
Generate the
SESSION_SECRETandCREDENTIALS_ENCRYPTION_KEYvalues.
Secret generation
- Each secret should be at least 32 random bytes.
- You can generate a random key using the following command in your terminal:
Run the command once per variable so the two secrets get different values. SESSION_SECRET signs this app’s own session cookie, and CREDENTIALS_ENCRYPTION_KEY encrypts stored store access tokens at rest. Neither is interchangeable with BIGCOMMERCE_CLIENT_SECRET, which only verifies BigCommerce’s inbound signed payloads.
Ensure not to share these keys publicly. If you change CREDENTIALS_ENCRYPTION_KEY, previously stored tokens can no longer be decrypted — delete data/credentials.sqlite and reinstall the app.
-
Set
DATA_MODEtoMULTITENANT. This scopes every request to a store through the/store/[storeHash]route segment, authenticates it with the app’s session cookie, and sources API tokens from the credentials store rather than mock or static data. -
Leave
CREDENTIALS_STORE_DRIVERset toSQLITE. The database is a plain file at./data/credentials.sqlite, created automatically on first use and gitignored. No migration step or external service is needed.
SQLite is a local development choice only. Because it is a single file on one machine’s disk, it cannot be shared across the multiple instances a real deployment runs. For a hosted environment, see the starter app’s Vercel deployment guide.
Start dev environment
In a separate terminal from ngrok, start the app’s dev environment.
Restart the dev server after any change to .env.local. A running server does not pick up environment variable changes, and APP_ORIGIN is read at startup to allow-list Server Action origins.
Ngrok configuration
Although you can use the ngrok npm package without creating an account, any unauthenticated tunnels you create will expire after two hours. For the best development experience, create a free ngrok account, find your ngrok authtoken, and add the authtoken to your global ngrok configuration.
Install the app
Finally, install the draft app on any store registered to the same email as your Developer Portal account using the following steps:
- Confirm the tunnel is up and public by opening your app origin in a browser. In
MULTITENANTmode, you should see the “unauthorized” root route warning rather than an error. That means the app is reachable and correctly refusing to serve an unscoped route. - Sign in to the store, navigate to Apps > Develop, and install the app, then approve the requested scopes.
- If everything is configured correctly, BigCommerce calls
/api/app/auth, which exchanges the code for a token, saves the store, mints a session cookie, and redirects into/store/{store_hash}/. The app then renders inside the control panel iframe. - Navigate back to My Apps to see the list of installed apps.
- Click Launch on the draft app to test the
/api/app/loadcallback, which verifies BigCommerce’s signed payload and issues a fresh session. - Navigate back to My Apps and click Uninstall to test the
/api/app/uninstallcallback.
Congrats! You’ve created and installed a BigCommerce draft app.
Becoming a partner
Interested in sharing or selling your app? Learn more about becoming a BigCommerce partner and getting your app approved.
Next steps
- Learn more about building apps
- Apply to become a BigCommerce partner
- Check out the BC App Marketplace approval requirements