Complete, Lightweight, Ready
X2 Framework for Node.js is a collection of modules published with NPM and designed to provide a complete toolset for creating back-end applications that expose RESTful APIs and are backed with a SQL database.
The framework is Complete because it aims at including everything one needs to build a full-featured application with all the functionality expected from a modern web-service.
The framework is Lightweight because it relies on the minimum of external dependencies, it is simple in its concepts and provides transparency of its internal operation.
The framework is Ready because the simplest application built with it is ready to be facing the Internet with all the features expected from a live web-service out-of-the-box.
Major modules include:
Persistent Resources
The pinnacle
module for any web-service implementation that exposes a RESTful API allowing access to the data stored in the back-end database. This module brings together other modules that comprise the framework including basic RESTful API foundation, access to a SQL database, definitions of data models (or records in the framework terminology), data validation rules, security, etc. Features like ETags and conditional HTTP requests are supported out-of-the-box.
Basic RESTful APIs
Provides the foundation for any web-service application including mapping RESTful API endpoints to handlers, parsing URI patterns, basic call processing framework, CORS, marshalling/unmarshalling of the data, streams and everything else expected from a full-featured modern web-service.
Record Validators
When data is submitted to the web-service via its API it needs to be validated before the transaction can take place. The validators module extends the record types library and adds validation rules and validation error messages to the record types. The module includes a collection of useful validators and allows applications to add their own. The error messaging framework fully supports internationalization and message templates.
JSON Pointers
An advanced implementation of the JSON Pointer specification (RFC 6901) that is integrated with the record types library and allows essential record modification operations driven by the record element pointers, walking
the record data, etc.
SQL Database Operations
The DBOs module makes working with a SQL database as easy as with a NoSQL database while fully utilizing all the RDBMS features including data integrity constraints, clear and reasonably normalized data storage, transactions, etc. Applications that use the DBOs module do not have to deal with constructing SQL queries and parsing query result sets into the hierarchical JSON data structures normally used throughout modern back-ends. The DBOs module takes care of all of that in the most efficient ways.
Record Types Library
Provides the application data model definitions, called record types in the framework. The extensibility of the record types library module allows other modules to add specific attributes to the record types such as mappings to the database tables and columns, data validation rules, etc. Normally, every application starts with the record type definitions that model the application's persistent data domain.
SQL Query Result Set Parser
Parsing tabular SQL query result sets into hierarchical data models is one of the most cumbersome tasks facing any modern application that works with SQL databases. This module uses special markup in the result set column labels to fully automate the task. It supports array properties, nested objects, polymorphic objects and merging result sets produced by multiple queries.
JSON Patch
An implementation of JSON Patch (RFC 6902) as well as JSON Merge Patch (RFC 7386) specifications. The framework uses the patch objects to specify and apply modifications to the records.