TypeORM - Introduction



TypeORM framework is an Object Relational Mapping (ORM) framework. In general, Object part refers to the domain / model in your application, Relational part refers to the relationship between tables in Relational Database Management System (e.g. Oracle, MySQL, MS-SQL, PostgreSQL, etc.) and finally the Mapping part refers to the act of bridging the model and our tables.

ORM is a type of tool that maps entities with database tables. ORM provides simplified development process by automating object-to-table and table-to-object conversion. Once you can write your data model in one place, it becomes easier to update, maintain, and reuse the code.

Since, the model is weakly bound to the rest of the application, you can change it without any hard dependency with other part of the application and can be easily use it anywhere inside the application. TypeORM is very flexible, abstracts the DB system away from the application and allows us to benefits from the use of OOPS concept.

Overview

TypeORM is an Object Relational Mapper library running in node.js and written in TypeScript. TypeScript is an improvement to JavaScript with optional typing. TypeScript is a compiled language. It is not interpreted at run-time. The TypeScript compiler takes TypeScript files (.ts) and compiles them in to JavaScript files (.js).

TypeORM supports multiple databases like MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana and WebSQL. TypeORM is an easy-to-use ORM to scaffold new apps that connect to databases. TypeORM functionality is RDBMS-specific concepts.

We can quickly create new projects and micro-services. It is inspired from similar tool like Hibernate, Doctrine, Entity framework, etc., from other programming languages.

Features of TypeORM

TypeORM comes with the following features −

  • Automatically create database table schemes based on your models.
  • Easily insert, update and delete object in the database.
  • Create mapping (one-to-one, one-to-many and many-to-many) between tables.
  • Provides simple CLI commands.

Benefits of TypeORM

TypeORM is easy to use ORM framework with simple coding. It has the following benefits −

  • High quality and loosely-coupled applications.
  • Scalable applications.
  • Easily integrate with other modules.
  • Perfectly fits any architecture from small to enterprise apps.
Advertisements