What tools and framework complement Node.js
?Node.js includes servers, database interface, server and client frameworks.
Node.js ecosystem overview. This is not exhaustive and not final, on the contrary, it is a sphere of constant development .
As you can see, the main components of the environment are, in addition to Node.js API, backend, extensions, interface with the client and the client itself, an application or page with a possible framework.
In fact, the interface is divided into the server part and the client part, and we have some freedom to put its essence on one side or another. Here are the details of which programs can be used to perform the role of each component.
Backend
CommonJS is a project to create a standard API for the JavaScript language in order to make it as rich as Java or another popular language.
Applications with JavaScript GUI must be created on the desktop. The site contains a list of already executed modules.
Already defined standards: Modules (used by Node.js), file system, sockets, test, packages, JSGI (alternative to JavaScript CGI).
Async.js to switch to synchronous or parallel mode. The main completeness in relation to Node concerns the addition of callbacks that go in parallel with asynchronous mode, which, by the way, is the main advantage of the system.
With Async, we get rid of callbacks and get closer to the simplicity of Go language corutins.
CouchDB is a database manager that stores documents in the form of JSON structures and is integrated into Node.js as node-couchdb. This format is well suited for a JavaScript-based system, as JSON code can be automatically parsed in this language and easily converted to HTML. Using CouchDB, you can also formulate queries in JavaScript.
It can replace MySQL, which is less suitable for one website, even if the second is suitable for an application that stores data such as login and password. CouchDB is no faster than MySQL and, however, is not relational.
It allows you to manage documentation and, if necessary, view it using a template, as Wordpress does. The Wordpress template is actually PHP code that can also be used in the back end with Node.js, as shown on this site.
There are derivatives such as couchbase, mobile server and others. An alternative is MongoDB, which also stores documents in JSON format, faster but less suitable for mobile devices. CouchDB also uses HTTP rather than MongoDB. Look at that comparison.
If you need something lighter, in the style of SQLite (which also works with Node.js), but easily distributed using the application, the manager himself writes a solution like NDB to JS.
Another solution at the time of choice is to use an intermediate library like Knex.js, which facilitates queries and interacts with most BDDs.
Bower is a package manager created by Twitter for Node. It allows you to dynamically add JavaScript libraries, pages, or images. It dynamically does what NPM does statically and therefore allows the user to load additional components from JavaScript instructions.
Rendr is an HTML page generator for an application using Backbone.js. The application works dynamically in JavaScript, but the pages created are static.
Interface: Server Frameworks
They help create pages and therefore have the same role as PHP or ROR. With these modules, Node.js can replace classic CMS written in PHP, Java, or another language.
They serve as a backend for web applications and provide them with useful services such as database connectivity .
Mojito Application Framework
It runs on Linux and is based on YUI, but transforms into a module to serve as a backend for an online application. The same infrastructure can be used by the client. It allows you to create functional components on the server or on the client .
Backend replaces PHP to create pages and sends them to a browser that displays them either statically as is or dynamically with YI JavaScript code.
It plays the same role as nodeQuery: the jQuery framework on the server, or socketStream.
Express or Hapi.js
The two frameworks share the same goal of making Node easier to use on the server side, providing more intuitive code. They are used by large sites.
Modern web infrastructure for cloud applications. Automatically refresh pages. It runs on the client side, but has a Node.js interface on the server. Because Express makes it easier to create applications, it adds an API for client code in the browser. It has been compared to Ruby On Rails in the JavaScript version. Specificity - the ability to make database requests in client code .
It does not use npm, unlike Derby, which is another MVC framework, and another RoR alternative.
Meteor is not easily used with other frameworks or interfaces built for other frameworks. The application must be basic for Meteor. It can also prove slow as audiences expand.
It has its own communication protocol between the client and the Node on the server called DDP (Distributed Data Protocol) based on JSON. It is enough to declare Meteor.publish on the server and Meteor.subscribe on the client, and the system automatically manages all data exchanges .
Using GraphQL for queries simplifies database access.
Server
Node.js is not a server, but a framework for creating a page server or applications using a script using the API provided to them.
This is a server that can serve as a front for Node.js on dedicated hosting. It is used for static websites, while only Node.js is used for online applications.
Client frameworks only
These are also possibly server frameworks if they have a part implemented in the module, but they are supplemented by the client API. A purely client framework would be something like jQuery or any other Ajax framework.
By wrapping server-side JavaScript code in a file that is included in the document, you can use the objects that are included in the server code. After that, the necessary commands are placed in the client code, and it can use objects created by different modules .
You should always run the node with the server script, but this one is shortened, all logic is transferred to the client side.
It is extensible, you can create a file to include for any module.
Automating actions in the browser, at the forefront of Phantom.js. In addition to mimicking user behavior, it also allows you to delete callbacks and write processes in linear form. According to the version, Phantom is not stable.
Similar tools: Dalek.js, SeleniumHQ plugin Firefox.
Node without browser
Modules for using Node as a server and processing data.
This tool is used to process web pages in the background, as well as to create HTML or SVG content using the built-in webkit renderer. The advantage of the browser is absolute control over the page as an object and the way the content is displayed.
Phantom.js, even if it includes a server, can be used with Node.js and allows WebKit to be integrated into this environment.
In March 2018, the project was archived, and its development was suspended with unresolved bugs. It is replaced by Chrome Headless.
You may need to add a definition from the Headless Browser... This is not a headless browser, but rather a browser without a display, which allows the program to process pages. We always show them when we want.
By adding Qt as a module, you can implement an interface that displays windows on the desktop to present content and goes through the browser when using other Node modules. Of course, we can make it easier with Electron.
Create executable
Several tools are available to convert a Node application with all its modules into one executable, easy-to-install program:
Node, custom API, or CMS extensions in JavaScript
Start a Node.js-based CMS with modules for creating a blog, static or dynamic.
There are few shared hosts that the Node.js server offers. The Githube Page service really allows you to place the application for free. Another solution is to use a virtual server, which you can get for €5 per month.
Your content is posted on GitHub. The module allows you to view it as a website. Node-blog by the same author - a specialized version used for a demo site, showing that it can be used in production.
As an alternative to HTML, its site is created locally using a code editor and after generating pages, the remote site is updated on a regular server.
Specialized APIs
Infrastructure for creating a mail server and exchanging data through JSON files.
Utilities
Unix shell implementation on Node.js. Allows you to use well-known commands such as mkdir, ls, grep, etc. Also runs on Windows.
Create, read, or write XML documents. The Node-Swiz serialization tool allows you to convert and save objects in XML or JSON format, as well as convert them between two formats.