Sharing Our Ideas

Build an E-Commerce Site With HTML5 and Node.js

In a previous post, we discussed why using HTML5 and Node.js to build a mobile app is a heck of an idea.

While Node.js is by no means perfect, its ability to support thousands of concurrent connections on a single thread is an incredible asset to developers creating programs with high data transaction needs. As for HTML5, it allows developers to move past the clunky, antiquated functionality of its predecessor.

"Shoppers want checkout to be fast and consistent."

So, why would you create an e-commerce website with Node.js serving the back end and HTML5 serving the front end? Is the approach the same as our take on building mobile apps?

Listen to the shoppers 
Before diving into the benefits of using HTML5 and Node.js to construct an e-commerce site, it's important to assess what consumers want. On the surface level, people desire easy navigability, a quick way to access information and a checkout process that doesn't take 10 minutes to complete. From a more granular perspective, PrestaShop's Natalie Biegel noted several factors that influence shopper behavior:

From a development standpoint, we can glean a few insights from these considerations. First, time is of the essence - a necessity that can be met with certain functions offered by Node.js. Second, the website must deliver relevant ads to online shoppers, which suggests that integration with Google DoubleClick for Publishers, a CRM solution and other applications is needed. Third, connecting to social media platform APIs through HTML5 is essential.

HTML5 can provide the front-end functionality customers favor. HTML5 can provide the front-end functionality customers favor.

Giving the website its juice  
One beneficial component of Node.js is how it communicates with other platforms. Readwrite contributor Lauren Orsini noted that Node.js runs JavaScript by employing Google's V8. What V8 does is enable Node.js to translate JavaScript into native machine language as opposed to converting it into bytecode, so this subverts one of the conventional communication slowdowns.

Bouncing off V8's integration, a signature benefit is Node.js' ability to sanction asynchronous communications. It leverages a capability known as the Event Loop, which allows data to be transmitted whenever it's available. That means the latency caused by a client requesting services from the server (in this case, the consumer uploading an e-commerce website) is reduced.

"We'd recommended creating a map of which APIs will connect to HTML5."

Working well with others 
As developers, we'd recommended creating a map of which APIs connect which applications, and how this overarching compatibility will impact your e-commerce site's performance. To keep things simple, let's assume your ad server is connected to Google DoubleClick for Publishers.

Connecting a DoubleClick exit (i.e. a function that directs browsers to other Web pages when they click on ads), necessitates a two step process, according to Google support:

"First, define the exit name in your HTML5 files. Then, when you upload the creative in the Studio Web UI, add a destination URL to the exit you defined."

All things considered, Node.js and HTML5 complement one another quite nicely. The former provides the horsepower needed to quickly load Web pages, while the the latter needs a limited number of plugins to give you the front-end functionality visitors appreciate.