Use the Sync False Architecture

Contentstack is a SaaS-based, headless content management platform that stores and manages content in the cloud. This setup enables users to retrieve and deliver content to any channel (web, mobile, devices, etc.) via Contentstack's Content Delivery APIs.

Contentstack provides a Node.js-based web application framework contentstack-express for building websites with push-publishing. This framework lets you save the content you publish via Contentstack in the local file system of a web server. Subsequently, for every incoming page request on the website, the content is retrieved and rendered directly from the local storage instead of fetching it from the Contentstack database via APIs.

Warning: contentstack-express framework has been deprecated. We will soon stop supporting this framework. Instead, we recommend using DataSync, which is faster and more flexible than the web framework.

Let’s see how you can set up your server architecture based on this structure.

Single sync in multiple servers

In this architecture, you connect all your servers to the Contentstack database but sync your content with only one web server. Here’s the diagrammatic representation of this architecture.

Contentstack Server Scalability.jpg

This architecture, too, has its own set of pros and cons.


  • High availability - If any servers go down, your process management app (PM2) can easily restart them. Once the app is restarted, all the content still in the “Pending” state in the Contentstack’s publish queue will be synced.
  • High scalability - As there’s only a single application registered to Contentstack’s servers, the rest of the delivery applications can be scaled up/down as required.
  • Data consistency and Reduced bandwidth - A single application connects to real-time and reads/writes data onto the storage provider.


  • No querying referenced content
  • Reduced delivery speed
  • No internal data caching in the application

Next, we will see how to set up the web servers using a process management app.

Set up web applications using a process management app

When setting up the “Single sync in multiple servers” architecture, you need to make sure that you set one server to run on default configuration (SYNC=true) and on a different port, for example, 8000.

  • Linux: PORT=8000 node app.js
  • Windows: set PORT=8000; node app.js

This server will connect with Contentstack’s real-time servers and sync (i.e., read/write on storage) the published, unpublished, and deleted contents. Only this server will be able to write on the database.

On the other hand, the rest of the servers will run on another port and their “SYNC” environment variable set to “false”.

  • Linux: SYNC=false PORT=4000 node app.js
  • Windows: SYNC=false; PORT=4000; node app.js

This server will only be serving data (i.e., only read from the database)

Was this article helpful?