How Nonfig saves Cost to Company

Tutorial For Nodejs Application


Drive Changes without deploying the code

Nonfig is a one-stop solution for configurations across the stack. It provides a platform to store, modify, and operate Software Configuration from a unified platform and a drop-in replacement for major programming languages. I firmly believe that the configurations should not be the part of the Version Control System i.e GIT, SVN, etc and each stakeholder in the company should be empowered to drive the changes on their product.

So let’s take a look at how Nonfig can be integrated into a simple shopping cart application. For this tutorial we will be using one of the open-source shopping cart project called ExpressCart


Step 1:

Create a Nonfig account

Step 2:

After logging in successfully, create the desired configuration. Supported configuration formats are: YAML, XML, JSON, and TEXT.

One can also create a config in the form of a key/value store.

For the shopping cart use case, we will be moving hardcoded shipping values to nonfig


Step 3:

To integrate Nonfig with the expressCart, we will need APP_ID and APP_SECRET as per the documentation. To get the credentials, we will have to create a consumer, a consumer is nothing but a unique identifier for each unique pair of APP_ID and APP_SECRET.

The rationale behind creating multiple consumers is for tracking, analysis, and future policy-based access control.

Once a consumer is created, copy-paste the constructor which already has APP_ID and APP_SECRET populate to use it in our ToDo app


Step 1:

As per the demo, let us clone expressCart repository in our local:

And install nonfig-sdk

Require and create an instance on nonfig client in app.js

Step 2:

Let’s remove the hardcoded values from the lib/modules/shipping-basic.js and use nonfig client for fetching the shipping cost related values, as per the screenshot below:

And just start the server:

Voila!! Now any changes done in nonfig will be visible on the shopping cart, without changes in code or any form of deployment and that too in just 2 steps.

If you want to experience the above tutorial, here is a link to the live demo. Add an item to the shopping cart you will see some shipping value. Login to our admin app with below credentials:

And feel free to modify the shipping values on this file. On the very next operation on the shopping cart, like adding one more item or on a simple refresh the page and you will see the modified values.

Leave a Reply

Your email address will not be published. Required fields are marked *