Orm Framework for Nodejs using Ecmascript 6

Orm Framework for Nodejs using Ecmascript 6

es-entity ORM framework for Node js based on Ecmascript 6 and Typescript.


ORM framework for Node js based on Ecmascript 6 and Typescript.


Nitin Bansal https://github.com/nitinbansal1989


$ npm install es-entity


Create DB context and provide connection configuration.

const es = require("es-entity");

Entity Class

Entity class is the reference to the table in the database. The property in this class are field objects which refers to the columns of the table.

Note: The class members are camel cased from the snake case database columns. Annotation for custom column name will be implemented in future.

class Employee {
    constructor() {
        this.id = new es.Number();
        this.name = new es.String();
        this.description = new es.String();

DB Configuration

Context is provided with the connection parameters of the database to connect.

var config = new es.ConnectionConfig();
config.handler = "mysql";
config.hostname = "localhost";
config.name = "mysql";
config.username = "root";
config.password = "application";
config.database = "test";


Context class is created which extends from es.Context. This class works as database context for all your queries. The property in this class as queryable object to the respective classes.

const Employee_1 = require("./Employee");
class EmpContext extends es.Context {
    constructor(config, entityPath) {
        super(config, entityPath);
        this.employees = new es.DBSet(Employee_1.default);

Provide the database config object and mapping folder object to the context object to bind.

const EmpContext_1 = require("./modal/EmpContext");
var context = new EmpContext_1.default(config);


Select Entities

let p = context.employees.where((a) => {
    return (a.id.lt(q)).or(a.id.eq(2));

p.then((v) => {
    for (var i = 0; i < v.length; i++) {
        var j = v[i];
        console.log("id: " + j.id + ", name: " + j.name + ", desc: " + j.description);

Select Entity By Id

let p = context.employees.get(1);

p.then((v) => {
    console.log("id: " + v.id + ", name: " + v.name + ", desc: " + v.description);

Updating Entity

v.description.set("test update 2");
let p = context.employees.update(v);
p.then((v) => {
    console.log("id: " + v.id + ", name: " + v.name + ", desc: " + v.description);

Inserting Entity

let a = context.employees.getEntity();
a.name.set("name 2");
a.description.set("desc insert 2");
let p = context.employees.insert(a);
p.then((v) => {
    console.log("id: " + v.id + ", name: " + v.name + ", desc: " + v.description);

Deleting Entity

let p = context.employees.delete(v);
p.then(() => {

Note: Currently it is very basic and only supports mysql. Please provide suggestions if any.

Download Details:

Author: InHeap

Source Code: https://github.com/InHeap/es-entity

node nodejs javascript ecmascript es6

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Node.js Live - 2 | ES6 Tutorial | How to setup ES6 for Node.js

This Edureka video on ES6 Tutorial will talk about the fundamental concepts of ECMAScript 6. It 'will also talk about how you can setup ES6 in your Node.js Applications.

Javascript Tutorial | Using ECMAScript modules with Node.js

ECMAScript modules are the official standard format to package JavaScript code for reuse. Modules are defined using a variety of import and export statements. Node.js fully supports ECMAScript modules as they are currently specified and provides limited interoperability between them and the existing module format, CommonJS.

What is ES6, What is ECMAScript & Why You Should Learn it? – JavaScript ES6 for Beginners

Learn what ES6 is, what ECMAScript is, and why it is important to learn for writing modern JavaScript.

What is ECMAScript and How is it Different From JavaScript?

Many times developers use JavaScript and ECMAScript synonymously for each other. Though they are very closely linked to each other, it does not mean they are the same thing.here is a complete story on the history of JavaScript and how it came into existence. To cut the long story short, ECMA in ECMAScript refers to Europen Computer Manufacturers Association to which JavaScript 1.1 was submitted for standardization back in the year 1997.

Node canvas is a Cairo backed Canvas implementation for NodeJS.

node-canvas is a Cairo-backed Canvas implementation for Node.js.