# Three ORMs, Three Design Styles — Prisma / TypeORM / Sequelize

Source: https://www.skillbyai.com/en/orms/or-three-styles

> Contrast Prisma's schema-first client, TypeORM's decorator entities and Sequelize's model definitions, and recognise each from a code sample.

## Schema-first, decorator-first, model-first

The three most common Node.js ORMs solve the same problem with different designs. **Prisma** is *schema-first*: you describe models in a `schema.prisma` file, run a generator, and get a fully typed client whose query objects are plain JavaScript objects. Prisma's model objects are plain data, not class instances with methods. **TypeORM** is *decorator-first*: you write TypeScript classes and annotate them with decorators such as `@Entity()` and `@Column()`; you query through a `Repository`, an `EntityManager` or a `QueryBuilder`. **Sequelize** is *model-first* and older: you define models in JavaScript with `sequelize.define()` or `Model.init()`, and each result is a model instance with methods such as `save()` and `destroy()`. Sequelize works well in plain JavaScript; TypeScript support exists but needs more manual typing. None is strictly better. The design shapes how you write code, how errors surface, and how much the type checker can help you.

## From definition to first query

Whatever the ORM, setup follows the same path: define the models, generate or initialise, open a connection, then query.

![Four connected stages: define models or schema, generate the client or initialise the ORM, open a database connection, run the first query.](assets/figures/orms/section-2-map.svg) — Figure 2.1: define models -> generate or initialise -> connect -> query

## The same lookup in all three

Find one user by email. Notice the shapes: Prisma uses a typed object, TypeORM uses a repository, Sequelize uses a static model method.

```ts
// Prisma
const a = await prisma.user.findUnique({ where: { email: 'asha@example.com' } });

// TypeORM
const b = await dataSource.getRepository(User).findOneBy({ email: 'asha@example.com' });

// Sequelize
const c = await User.findOne({ where: { email: 'asha@example.com' } });
```

## Interviewers ask about trade-offs, not syntax

Nobody expects you to memorise every method. Be ready to say *why* the styles differ: Prisma generates types from a schema, TypeORM reads metadata from decorated classes at runtime, Sequelize builds models from JavaScript definitions. That one sentence per ORM shows real understanding.

**Quiz:** Which ORM generates a typed client from a separate schema file?

- [ ] TypeORM
- [ ] Sequelize
- [x] Prisma
- [ ] All three generate a client from a schema file

*Answer:* Prisma. Prisma reads schema.prisma and generates Prisma Client. TypeORM reads decorators on classes, and Sequelize reads model definitions written in JavaScript.
