# Overview of ORM Database Tools

Object Relational Mapping (ORM)

### Summary

1.  Concepts of ORM
2.  Prisma ORM
3.  Type ORM
4.  Sequelize ORM
5.  Micro ORM

### References

### 1\. Concepts of ORM

Object-Relational Mapping (ORM) is a technique that lets you query and manipulates data from a database using an object-oriented paradigm. When talking about ORM, most people are referring to a library that implements the Object-Relational Mapping technique, hence the phrase “an ORM”.

An ORM library is a completely ordinary library written in your language of choice that encapsulates the code needed to manipulate the data, so you don’t use SQL anymore; you interact directly with an object in the same language you’re using.

### 2\. Prisma ORM

*   [https://www.prisma.io/](https://www.prisma.io/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833046237/6PgaOURee.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833047546/WXCVw7Cw_.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833048950/axWFjW0R2.png)

### Postgres Installation with Docker

docker run --name postgresql -e POSTGRES\_PASSWORD=admin -p 5432:5432 -d postgres

### Prisma Migrate

yarn prisma migrate dev

create product

create category

create product\_category

### Prisma Studio

yarn prisma studio

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833050330/lGw9Sdgyk.png)

### Prisma Relations

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833051680/ziruqVhM3.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833052951/S8GrvBHlW.png)

HTTP/1.1 200 OK

X-Powered-By: Express

Content-Type: application/json; charset=utf-8

Content-Length: 150

ETag: W/"96-UrprlteTTnqfmSPc6+2Svgk22kw"

Date: Thu, 20 Jan 2022 17:45:34 GMT

Connection: close

{

"id": "70df8552-3b15-4532-ba10-084018283e17",

"id\_product": "1d8da63e-c4dc-43e5-87b1-ddf1699dd7f1",

"id\_category": "130b29d6-563b-4a73-8c2e-fe1c737ef99c"

}

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833054312/LBgqBxI-_.png)

### Create a Product with Category

*import* { Request, Response } *from* "express";

*import* { prismaClient } *from* "../database/prismaClient";

*export* class CreateProductWithExistCategory {

async handle(request: Request, response: Response) {

const { name, price, bar\_code, id\_category } = request.body;

const product = *await* prismaClient.productCategory.create({

data: {

product: {

create: {

bar\_code,

name,

price,

},

},

category: {

connect: {

id: id\_category,

},

},

},

});

*return* response.json(product);

}

}

### Demo Prisma Studio

[**prisma\_decode/Prisma-demo.gif at master · Data-Database/prisma\_decode**  
*Contribute to Data-Database/prisma\_decode development by creating an account on GitHub.*github.com](https://github.com/Data-Database/prisma_decode/blob/master/assets/Prisma-demo.gif "https://github.com/Data-Database/prisma_decode/blob/master/assets/Prisma-demo.gif")[](https://github.com/Data-Database/prisma_decode/blob/master/assets/Prisma-demo.gif)

### Demo Prisma Studio

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833055952/J4CmCCb1M.gif)

### Demo Prisma API

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833058465/W_Jm9KNz6.gif)

### 3\. Type ORM

*   [https://typeorm.io/#/](https://typeorm.io/#/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833060266/8D0hFeRk_.jpeg)

### 4\. Sequelize ORM

*   [https://sequelize.org/](https://sequelize.org/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833061905/7o4pINnmA.png)

### 5\. Micro ORM

[**MikroORM: TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns…**  
*TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns.*mikro-orm.io](https://mikro-orm.io/ "https://mikro-orm.io/")[](https://mikro-orm.io/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833063561/zxsc4zzFW.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1662833064971/0AXh-eFQV.png)

### References

*   [https://sequelize.org/](https://sequelize.org/)
*   [https://mikro-orm.io/](https://mikro-orm.io/)
*   [https://www.prisma.io/](https://www.prisma.io/)
*   [https://typeorm.io/](https://typeorm.io/#/)
