Proxies all requests to Uniform to perform composition enhancement using the following integrations:
- Salesforce Commerce Cloud
- Contentful
- Cloudinary
Built on top of Next.js.
- Node 14+
- npm 6.14.4+
npm run uniform:push
commands from .\storefront
folder, see Readme in there for details.
-
Add Uniform-specific env vars in
.env
file (see.env.example
), it should contain your Uniform project's API key and Project Id:UNIFORM_API_KEY= UNIFORM_PROJECT_ID=
Read-only permissions are sufficient here.
-
Add the following environment variables with values specific to your Salesforce B2C Commerce instance:
SALESFORCE_COMMERCE_CLOUD_CLIENT_ID= SALESFORCE_COMMERCE_CLOUD_CLIENT_SECRET= SALESFORCE_COMMERCE_CLOUD_ORG_ID= SALESFORCE_COMMERCE_CLOUD_SHORT_CODE= SALESFORCE_COMMERCE_CLOUD_SITE_ID= SALESFORCE_COMMERCE_CLOUD_EINSTEIN_ID= SALESFORCE_COMMERCE_CLOUD_EINSTEIN_SITE_ID=
-
Optional: if you'd like to activate Contentful as an additional content source, make sure to add the following env variables specific to Contentful:
CONTENTFUL_SPACE_ID= CONTENTFUL_ENVIRONMENT= CONTENTFUL_CDA_ACCESS_TOKEN= CONTENTFUL_CPA_ACCESS_TOKEN=
-
Run
npm install
to install all the dependencies.
-
npm run dev
-
Open the proxy on localhost:3001 and make sure the following paths render:
http://localhost:3001/api/v2/manifest
-> must return a valid manifest JSON from your Uniform projecthttp://localhost:3001/api/v1/canvas?slug=/
-> must return a valid composition JSON from your Uniform project's Home composition.
The proxy can be deployed to any place that runs Node.js, or Next.js, here are a couple of options:
-
Install Vercel CLI:
npm i -g vercel
-
Run this command to deploy the proxy:
vercel
Make sure to add the environment variables to your Vercel site.
-
Install Netlify CLI:
npm install netlify-cli -g
-
Run this command to deploy to the Netlify site.
netlify deploy --build
Make sure to add the environment variables to your Netlify site. You can run
netlify env:import .env
to import your the environment variables from your .env file to your Netlify site.
Open the proxy on localhost:3001 and make sure the following paths render:
https://your-deployed-proxy.oncdn/api/v2/manifest
-> must return a valid manifest JSON from your Uniform projecthttps://your-deployed-proxy.oncdn/api/v1/canvas?slug=/
-> must return a valid composition JSON from your Uniform project's Home composition.