Contentstack DataSync vs contentstack-express

Note: contentstack-express framework has been deprecated. We will soon stop supporting this framework.

Difference between Contentstack DataSync and contentstack-express 

contentstack-express Framework: It syncs data locally and provides a framework to build websites using the synced data. It gives you the deployment status of your entries and assets that is, Pending, In Progress, and Published.

Contentstack DataSync: It is a webhook-based utility that simply syncs the data with your infrastructure.  Also, the deployment status of your entries and assets is not available when compared with the contentstack-express Framework.

Why switch to Contentstack DataSync

  1. Decoupling: We have decoupled the sync features from contentstack-express and now provide the sync feature as a standalone utility through Contentstack DataSync. Moreover, the contentstack-express framework has been deprecated. 
  2. Improved scalability: Using Contentstack DataSync, you can store data not only on Filesystem but on other database systems as well (such as MongoDB).
  3. Quick and easy website creation: Lastly, Contentstack DataSync provides a boilerplate to get started as well as a JavaScript SDK boilerplate to create JavaScript-based websites. We have also created a guide on an example e-commerce website for your reference, read it here

Migrate from contentstack-express to Contentstack DataSync

If you already a website running on contentstack-express, switching to Contentstack DataSync can be achieved using the steps below:

  1. Start Contentstack DataSync
    Start the utility as mentioned here. All your published data will be synced and stored on your local storage system.
  2. Add routes of your web pages
    Routes in contentstack-express were handled by the framework itself. In Contentstack DataSync, you will have to add your web pages routes as shown in here
  3. Migrate the templates
    1. Then, migrates the templates by copy and pasting the public folder from your contentstack-express app (./themes/basic/public) in the boilerplate template (./public).
    2. Add the layout for your templates from (./themes/layout) to (./views/layout) and configure 'view' path & engine accordingly.
    3. Add partials from (./themes/partials) to (./views/partials) and add the following line of code in your header and footer templates.
      {% set header = header.entry %} or {% set footer = footer.entry %}
    4. If you have used any Template Helper methods, such as getAssetUrl, you will have to write your own middleware to support them.
    5. Add and configure a middleware to serve images.
  4. Migrate the plug-ins
    1. If you have used custom routes in contentstack-express similar to the following snippet:
      Myplugin.templateExtends = function(engine) {
          engine.getEnvironment().addFilter('shorten', function(str, count) {
             return str.slice(0, count || 5);
    2. Then, then you will have to add your route in the boilerplate as follows:
      module.exports = (engine) => {
           engine.addFilter('shorten', function (str, count) {
               return str.slice(0, count || 5);
    3. For accessing the template engine, write the code in app.js
      var engine = nunjucks.configure('views', {
      watch: true,
      autoescape: false,
      express: app
    4. You will then have to migrate all the routes as shown here:
      Myplugin.serverExtends = function(app) {
            .get('/careers', function(req, res, next){
            var query = stack.ContentType('careers').Query().toJSON().find();
                .then((data) => {
                    req.getViewContext().set("data", data);
                .catch((error) => {
                    req.getViewContext().set("data", {});

Related Topics

Was this article helpful?