Contentstack is a SaaS-based, headless content management platform. The content — stored and managed in the cloud — can be retrieved and delivered to any channel (web, mobile, devices, etc.) via its Content Delivery APIs.
For websites, however, we also provide push publishing, which improves the overall performance and content delivery speed of your website. 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.
Contentstack provides a Node.js web application framework ‘contentstack-express’ for building websites with push-publishing. The framework is designed for developing complex and customized websites quickly. It provides tools and options to readily incorporate common/familiar features, rather than re-inventing the wheel by coding from scratch.
Since the framework is based on Node.js Express, it supports all the features that are offered by Node.js Express. Let’s look at some of the other benefits it provides.
Once the framework is installed, it syncs all the content on your web server. Subsequently, whenever you publish or unpublish content from Contentstack, it automatically saves or removes content, respectively, from the local storage of your web server.
The framework’s theming and templating options make it easy to manage the views and routes of your website. Its in-built routing handles all the hard work needed to set-up your site’s routing.
You can customize the look and feel of your website or web application with the various theming options offered by contentstack-express.
You can add custom logic (redirect rule, static site generator) to your site via plugins. The framework provides a number of hooks—using which you can create extensions—that help you extend the functionality of Contentstack.
contentstack-express enables the web server to cache published data in memory. This cached data is then rendered whenever there is a subsequent request for a published web page. This further improves the site’s performance and content delivery speed.
contentstack-express provides several configuration settings that help you define a range of behaviours of your site. You can enable various features and functionalities by simply customizing the default configuration settings.
Using the ‘contentstack-express’ web framework provides several benefits for website owners. Let’s look at some of them.
The content is created using Contentstack’s user-friendly CMS platform. However, post publishing, it is stored and delivered from the local storage of your web server. This separates the authoring/content management environment from the content delivery environment.
The content is fetched from the lightweight local store and served to users without connecting to Contentstack. This ensures uninterrupted service even when the CMS platform is temporarily down or slow. You have full control over your website’s availability.
Push publishing reduces the load on the server by storing content locally. Whenever there is an incoming request for content, it fetches the relevant content from local storage and delivers it to the web page for presentation. This delivery from local storage is much quicker than fetching content from any CMS database via APIs.
The decoupled architecture ensures that even if the data of your content delivery environment is exposed to security threats, the data in content management environment is secure. You can then use this data to create another secure content delivery environment.
Push publishing is designed to scale as it allows syncing content with multiple web servers at once.
Now that we know the basics of the framework, let’s dive deep into this, and learn how to get started with it.