Connect Contentstack to Shared Hosting

Contentstack provides push publishing for online applications, which improves the overall performance and content delivery speed of your website. We use a Node.js web application framework contentstack-express for building websites with push-publishing.

In push publishing, the content that you publish via Contentstack is saved in the local file system of the web server. Subsequently, whenever there is an incoming page request on the website, the content is retrieved and rendered directly from the local storage, instead of fetching it from Contentstack database via APIs.

To set up and connect Contentstack to the web server using Express, perform the following steps:

  1. Install Node.js v4.2.0 or a later version to use contentstack-express.
  2. Run the following command in a Terminal or Command Prompt to obtain and globally install Contentstack’s command line interface (CLI) on your system:
    $ npm install -g contentstack-cli
  3. In the terminal, navigate to your workspace, and run the 'connect' command.
    $ contentstack connect
  4. This will prompt you to enter the stack API key and access token.
    Enter your stack api key: {API_KEY}
    Enter your stack access token: {ACCESS_TOKEN}

    Note: We have stopped supporting Access Token for all stacks created after December 16, 2020. For stacks created after this release, the Access Token will no longer be generated. Refer to our FAQs on Access Token Removal to know more.

  5. Once the stack is validated, you will be prompted to enter the project root directory and select the publishing environment ('development') which we created in the earlier step.
    Enter name of the directory to contain the project: (my-site)
    Select the publishing environment:
    1. development

This will automatically configure your project for the selected publishing environment along with the basic theme for the website. This will complete your website’s connection to the web server for shared hosting.

Additional Resource: To know more about how to get started with creating a website, you can check out Quickstart in 5 mins guide. Another guide that could come handy is Get started with Contentstack DataSync.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

^