NexORM is a powerful ORM designed to simplify database management while delivering high performance and flexibility. Inspired by MongoDB, Prisma, and TypeORM, it combines the best features of these tools, offering advanced operators (like $set and $inc with more), a built-in caching system, and a decorator-based schema definition for clean and intuitive modeling.
With full TypeScript support, Nexorm ensures type-safe , modern development using JavaScript (ES2021). It supports MySQL, PostgreSQL, SQLite, MariaDB, and MSSQL, making it suitable for projects of any scale, from small apps to complex enterprise systems.
Start building with NexORM to enjoy effortless, scalable, and maintainable database interactions.
Features
Full Type Support:Seamless TypeScript integration for type-safe development.
Decorator-Based Schema Definition:Clean and intuitive schema modeling using decorators.
Multi-Database Support:Compatible with MySQL, PostgreSQL, SQLite, MariaDB, and MSSQL.
Full JSON Support:Easily handle arrays and objects in JSON format.
Hooks Support:Lifecycle hooks for enhanced control over database events.
Encryption, Decryption, and Hashing:Built-in utilities for secure data management.
Validation Support:Ensure data integrity with powerful validation tools.
CLI Support:Command-line tools for streamlined database operations.
Cache Support:Built-in caching for faster queries and improved performance.
Index Support: Optimize queries with advanced indexing capabilities.
Advanced Operator Support: Extendable operators for flexible database operations.
Debug and Logging Support: Track and troubleshoot with detailed logs and debug tools.
And more...
With NexORM your schemas & models look like this:
/* ./schemas/user.ts */
import Model from 'nexorm/model';
import {
Schema, Timestamps,
Column, Default, Required
} from 'nexorm/decorators';
@Schema
@Timestamps /* UpdatedAt And CreatedAt Sections */
class UserSchema {
@Column
@Required
static personName = String; /* Required String Column */
@Column
@Required
static personSurname = String; /* Required String Column */
@Column
@Default(16)
static personAge = Number; /* Number Column If Value Is Not Available */
/* Value Is Set To '16' */
@Column
@Default(['Personal'])
static tags = Array(String); /* String[] Column If Value Is Not Available */
/* Value Is Set To '["Personal"]' */
@Column
static audit = Object; /* Object Column */
};
/* Integrating The Schema Into The Model And Exporting */
export default new Model(UserSchema);
Install the npm package:
npm install nexorm --save
You may need to install reflect-metadata:
npm install reflect-metadata --saveand import it somewhere in the global place of your app (for example in src/index.ts):
import 'reflect-metadata';
You may need to install node typings:
npm install @types/node --save-dev
Install a database driver:
for MySQL
npm install mysql2 --save
for PostgreSQL
npm install pg --save
for SQLite
npm install sqlite3 --save
for Microsoft SQL Server
npm install tedious --save
for MariaDB
npm install mariadb --save
TypeScript Configuration
Also, make sure you are using TypeScript version 4.5 or higher, and you have enabled the following settings in tsconfig.json:
Working with a database starts with creating tables. How do you tell NexORM to create a database table? The answer is - through the models. Your models in your app are your database tables.
And you want to store photos in your database. To store things in the database, first, you need a database table, and database tables are created from your models. Not all models, but only those you define as entities.