Enterprises and the respective developers of enterprise applications tend to have all the problems the web space has, plus problems small businesses have, on top of a host of other issues that they have to work to resolve. There is a mix of systems to authenticate against (or synchronize single sign on with); there are data format standards to battle, shadow IT systems to find, application tiers to determine, architecture to design, and a host of other problem domains. Put simply, there are 99 problems and not having a problem isn’t one.
In this article, I’m going to take a look at some of the top options for enterprise developers in need of a Node.js framework that helps break down these issues, while providing a solid full-stack application design. I’ll break this out as a simple tiered approach, broken down by middle tier, front end, and data store.
Middle Tier and Front End
The middle tier and front end Node.js frameworks almost all follow a basic Model View Controller (MVC) architecture. Additional patterns are then used around the core MVC for subsequent functionality. Some provide a little more guidance with their basic scaffolding commands and some are lighter. Below I highlight some enterprise-ready options:
This is probably one of the most popular frameworks in the Node.js community of coders right now. The core philosophy behind Express.js is to offer an application framework for single or multi-page web apps, using views and template engines such as Jade. The Express.js framework also includes a multitude of utilities to work with HTTP and building APIs. The pluggable middleware in the framework provides a great way to add elements, such as passport.js, as you need them.
Getting a project started using Express.js is simple. Simply install the framework with the following command.
sudo npm install -g express
Now run the following command.
That provides a full skeleton Express.js Web Application ready to work from.
Tower.js is one of those technology frameworks that is built with a pluggable design and enterprise needs in mind. The main library is a collection of components such as adapter, resource, router, validator, memory and more.
Included in all of that development framework there is the Tower CLI too, which provides the ability to start and stop things like MongoDB or create recipes. It’s similar in approach to the Express.js CLI in design and premise.
The other thing that makes Tower.js really helpful is the ability to install the library to the client side using component.
To install via component just type the following command.
component install tower/tower
To install Tower.js via NPM for server-side development, issue this NPM install.
sudo npm install tower -g
To access each of the component modules of the main Tower.js Library, set up the require declaration and then each of the subsequent components of the library can be accessed as tower.<theComponentToUse> as shown below.
var tower = require('tower');
Once any of these are declared, a great place to start in figuring out their usage is in the Guides Tower Organization Project. You can find examples located here. As the names of the components imply, they’re modeled very closely to known patterns (re: Design Patterns Catalog). The consistent naming of patterns and components is just one more reason I say the Tower.js library screams enterprise applications.
Another framework that has a very solid MVC core is Geddy.js. Some of the other features that immediately put it into the enterprise space are built-in support for internationalization, SSL, authentication using passport.js and built in errors and email support. The convention based approach makes Geddy.js one of the quickest to set up and start coding with a functional baseline of features.
Installing Geddy.js is as easy as the standard NPM install command.
sudo npm install -g geddy
Geddy, as with the other tools, comes with a CLI that provides the ability to create a skeleton application by issuing the following command.
geddy gen scaffold employee name:string position_description:text
If you’re familiar with Ruby on Rails you’ll notice there is a lot of similarity between the two command structures of the CLIs.
Sails starts with the premise of being appropriate for large, enterprise-grade, modern Node.js applications. However Sails.js provides more than just pluggable architecture with the ability to use middle tier integrations and related things. It’s also a solid platform for charting, dashboards, and related development. It does all this while providing scaffolding focused around patterns specifically for these feature sets.
Sails.js installs and uses a CLI type approach as is familiar with the other stacks listed. Simply install the framework globally.
sudo npm -g install sails
Create a new application by issuing the following command.
sails new sample_project
Run the server with the following CLI command.
First make sure you meet all the prerequisites.
-Install Python 2.7
-Install C++ Compiler Toolchain (GCC, Visual Studio w/ C++, etc)
-Get the Oracle SDK: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
-Set environment variables
OCI_VERSION=<10, 11, or 12> # Integer. Optional, defaults to ’11’
NLS_LANG=.UTF8 # Optional, but required to support international characters
-Symlink libclntsh and libocci
-Install the dynamic library path to include $OCI_LIB_DIR
Then the easy installation command:
npm install oracle
SQL Server Driver
SQL Server is also another really popular database in the enterprise. Microsoft actually went to bat and produced some drivers for SQL Server themselves. These are available on Github under the Azure Organization. @jkint, @jguerin along with others have put in a lot of work on this driver.
Setting up the SQL Server Driver has a few prerequisites.
-Make sure Python 2.7.x is installed
-Install node-gyp globally
sudo npm install -g node-gyp
-Visual C++ 2010 – Express edition is free here http://www.visualstudio.com/en-us
-SQL Server Native Client 11 available here http://www.microsoft.com/en-us/download/details.aspx?id=29065
-Build the driver
For more examples check out the code on github and the integration/unit tests, which provide a great base to learn and work from.
MongoDB Native Driver
The Mongo Database breaks from many enterprise trends and steps into the NoSQL and big data realms of the software industry. Even though it isn’t nearly as utilized as SQL Server or Oracle, there are a number of MongoDB projects on the rise in enterprises, including MetLife, Forbes, ADP and others. Connecting to Mongo via Node.js is available with the native driver. There are other options available, but I’ll focus on the node.js driver supported by Mongo here.
To install the Mongo driver first install via NPM.
npm install mongodb
In this article I’ve covered a number of frameworks, options, and databases — all of which are enterprise grade and available for use in Node.js enterprise development right now. If there is a specific library you’d like for me to deep dive into, please let me know and I’ll do a follow-up post that puts it front and center!