Going to Production
When it's time to take your Custom Application to production, you need to follow certain steps like building the production bundles.
Make sure that your Custom Application is properly configured.
Building production bundles
The production bundles are created by running the CLI build
command:
mc-scripts build
All the necessary static assets are created in the public
directory.
By default, the build
command compiles the index.html
, included in the public
folder. You can opt-out of the compilation step by using the option --build-only
. See compile-html
command for more information.
Assigning the Application ID
Before deploying the Custom Application to production, make sure to provide the Custom Application ID that you got when you configured the Custom Application in the Merchant Center.
The Custom Application ID is provided when you add a Custom Application in the Merchant Center (Organizations > Custom Applications > Configure > Add). See Managing Custom Applications in the Merchant Center for more information.
Assigning the production URL
In the Custom Application config make sure to provide the production URL where the Custom Application will be hosted.
Deploying the production bundles
Deploying and hosting Custom Applications is managed by you. This allows you to choose whatever hosting solution works best for you.
See Deployment Examples to quickly get up and running with some of the common cloud hosting providers.
Configuring rewrite rules
A Custom Application is a Single-Page Application that uses client-side routing. Therefore, you need to instruct your hosting provider to rewrite all requests to serve the index.html
.
Most of the Deployment Examples explain how to do that in regards to the hosting provider.
See Merchant Center Proxy Router for more information on how the Merchant Center serves Custom Applications.
About Static Assets
Depending on where you want to host your Custom Application you might choose to keep the static assets (JS, CSS, etc.) in the same location as the index.html
or to have them served by something like a CDN.
If you choose to have them hosted in a separate location, you need to configure the CDN URL in the Custom Application config.