A Look at my Favorite Node.js Templating Engines

DZone 's Guide to

A Look at my Favorite Node.js Templating Engines

If you're a beginner looking for a place to start, or an experienced developer looking for a new tool, read on for a review of a few Node.js templating engines.

· Web Dev Zone ·
Free Resource

In this blog, we will look at a comparison of different Node.js templating engines and go through the basics of Node.js. Then we will create a signup application in Node.js with MongoDB as the backend.

If you are starting with Node.js from this blog post, you are at the right place. When I started working with Node.js, I got confused will all of the templating in Node.js. So when you start trying Node.js our for yourself, you'll be in the position of choosing the best templating engine. And there is a huge list of templating engines, so don't feel bad if you get confused. So let's start with some names of templating engines, but please have a look at the basics of why we need them because I am not going to cover them here, so as not to turn this post into a book.

So let's start with some amazing top priority names on the basis of their stars and community support:

1. Mustache
2. Handlebars
3. doT
4. Dust
5. EJS
6. Underscore
7. Jade

So let's list some of the ones that I have tried and read about:

  1. Jade
  2. EJS
  3. doT
  4. swig


doT isn't necessarily the easiest to use, but if it fulfills the following requirements, it might be right for you: 

  1. If your app is used by both client and server side.
  2. If your template requires huge logic If you need to make your app faster.
  3. If you need to pre-compile templates.

and much more…


You should definitely be familiar with Jade, Jade is like magic. It means less writing and more relaxing. In the case of Node.js, it can be a bit time-consuming, as you have to convert the file into HTML then back into Jade.


EJS is CanJS’s default template language, which provides live binding when used with Observes. EJS is very easy to use; you write the HTML you want to in the template, along with a few magic tags where you want dynamic behavior. But EJS does not support block functionality.

Your javascript should be good for EJS though.


Swig does not abstract HTML syntax from you (like Jade does) giving a certain feeling of control over the markup. You can fill angular.js syntax here with swig, and, yes, it supports block functionality as well.


I personally liked using EJS, maybe because I started learning NodeJs with it, but it depends on your understanding and requirements for the project. The first priority is performance and then ease of writing code. Although doT is doing an awesome job with performance, its syntax will not make you comfortable if you are not a pure js loving guy.

node.js, template engine, web dev

Published at DZone with permission of Nikhil Kumar , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}