well, there’re reasons why it’s not included in official typeorm packages. i haven’t looked into your code, but i bet there will be shit tons of problems with edge cases. different propagation mechanisms also will lead to lots of problems. check this one out: https://github.com/Aliheym/typeorm-transactional it started with cls-hooked and then switched to AsynLocalStorage when it got introduced to Node. but it has never been adopted across community because of many underlying issues. in any case, good luck! Answer from ActualPositive7419 on reddit.com
🌐
Papooch
papooch.github.io › plugins › available plugins › @nestjs-cls/transactional
@nestjs-cls/transactional | NestJS CLS
The @Transactional decorator can be used to wrap a method call in the withTransaction call implicitly. It has the following call signatures: ... Similar to other @nestjs/<orm> libraries, the @nestjs-cls/transactional plugin can be used to manage transactions for multiple database connections, ...
🌐
Medium
medium.com › @testjokerqwerty › integrating-typeorm-transactional-in-your-nest-js-project-a-step-by-step-guide-26d2093ef1b5
Integrating TypeORM-Transactional in Your Nest.js Project: A Step-by-Step Guide | by Eugene Moskalenko | Medium
November 27, 2024 - The @Transactional decorator from the typeorm-transactional library simplifies the management of database transactions in your Nest.js application. By applying this decorator to your service methods, you ensure that all database operations within ...
🌐
Reddit
reddit.com › r/nestjs › why i built typeorm-transactional-decorator
r/nestjs on Reddit: Why I built typeorm-transactional-decorator
September 14, 2025 -

I got tired of threading the EntityManager/QueryRunner through every layer of a modular NestJS backend—passing it as a parameter into every service and method. It was noisy, brittle, and honestly, a pain. I went hunting for a decorator-based solution for TypeORM transactions. I found a few, tried them, but they felt overconfigured and, crucially, the same transaction didn’t reliably propagate into deeply nested calls. Maybe I misused them—but the DX wasn’t there.

So I built typeorm-transactional-decorator: a small, focused layer that uses Node’s async hooks to carry a transactional context and patches TypeORM’s DataSource/EntityManager so repositories automatically bind to the current transaction if one exists. You get a dead-simple @Transactional decorator, @IgnoreTransaction to opt out where needed, reliable propagation into nested methods, automatic rollback on errors, and a TransactionResultManager to register side effects for onCommit/onRollback (think: delete an S3 file if the DB transaction fails). It’s based on typeorm-transactional, but simplified and tuned for a predictable, minimal workflow.

It slots neatly into NestJS via TypeOrmModule’s dataSourceFactory, or you can call addTransactionalDataSource(dataSource) in any Node app. The package grows as my needs evolve, but the north star is the same: minimal API, maximum ergonomics for real-world, layered architectures.

How are you handling TypeORM transactions?

NPM: https://www.npmjs.com/package/typeorm-transactional-decorator

🌐
npm
npmjs.com › package › @nestjs-cls › transactional
nestjs-cls/transactional
A nestjs-cls plugin for transactional decorators. Latest version: 3.2.1, last published: 2 months ago. Start using @nestjs-cls/transactional in your project by running `npm i @nestjs-cls/transactional`. There are 2 other projects in the npm registry using @nestjs-cls/transactional.
      » npm install @nestjs-cls/transactional
    
Published   May 25, 2026
Version   3.2.1
🌐
Medium
medium.com › @jsankit99 › transaction-management-in-nestjs-typeorm-3-3-the-transactional-decorator-7fd60466b8a4
Transaction Management in NestJS + TypeORM (3/3): The @Transactional Decorator | by Ankit Pradhan | Medium
January 28, 2026 - This decorator simply marks methods with metadata. The real magic happens in the executor. This service scans your application at startup and wraps all @Transactional methods automatically: import { Injectable, OnApplicationBootstrap } from ...
🌐
npm
npmjs.com › package › @hodfords › nestjs-transaction
@hodfords/nestjs-transaction - npm
April 8, 2026 - You can use the @Transactional decorator to mark a method as transactional. This means that all database operations within this method and child methods will be executed within a transaction context.
      » npm install @hodfords/nestjs-transaction
    
Published   Apr 08, 2026
Version   11.3.2
🌐
Stack Overflow
stackoverflow.com › questions › 79268579 › how-can-i-use-transactional-decorator-in-nest-js
nestjs - How can I use @Transactional Decorator In Nest.js - Stack Overflow
import { EntityManager } from '@mikro-orm/postgresql'; @CommandHandler(OrganizationRegisterCommand) export class OrganizationRegisterCommandHandler { constructor( @InjectRepository(Organization) private readonly organizationRepository: OrganizationRepository, @Inject(EntityManager) private readonly em: EntityManager, ) {} @Transactional() async execute(command: OrganizationRegisterCommand): Promise<void> { try { const organization = await Organization.register({ ...command }); await this.em.persistAndFlush(organization); // await this.organizationRepository.persist(organization); } catch (error) { if (error instanceof UniqueConstraintViolationException) { logger.log('OrganizationNameAlreadyRegisteredException', error); throw new OrganizationNameAlreadyRegisteredException(); } console.log('etc error', error); } } }
Find elsewhere
🌐
DEV Community
dev.to › alphamikle › the-easiest-way-to-use-transactions-in-nest-js-41h0
The easiest way to use transactions in Nest.js - DEV Community
February 13, 2021 - START TRANSACTION // ... SELECT "Purse"."id" AS "Purse_id", "Purse"."balance" AS "Purse_balance", "Purse"."userId" AS "Purse_userId" FROM "purse" "Purse" WHERE "Purse"."id" IN ($1) START TRANSACTION SELECT "Purse"."id" AS "Purse_id", "Purse"."balance" AS "Purse_balance", "Purse"."userId" AS "Purse_userId" FROM "purse" "Purse" WHERE "Purse"."id" IN ($1) UPDATE "purse" SET "balance" = $2 WHERE "id" IN ($1) COMMIT ROLLBACK · The only working way, which the documentation describes, is to avoid using decorators.
🌐
DeepWiki
deepwiki.com › Papooch › nestjs-cls › 4.1-transactional-decorator
Transactional Decorator | Papooch/nestjs-cls | DeepWiki
May 20, 2025 - The @Transactional decorator provides a convenient way to manage database transactions in NestJS applications using nestjs-cls. It allows you to declaratively wrap method calls in transactions without cluttering your business logic with transaction ...
🌐
Socket
socket.dev › npm › package › nestjs-typeorm-transactions
nestjs-typeorm-transactions - npm Package Security Analysis ...
The transaction function runs the callback using async local storage, sharing the transactional entity manager with other potential nested calls. The second argument is the name of the connection specifying which database configuration should be used. It defaults to the default connection where name property is not specified in forRoot method. In order to inject the data source objects, use @InjectTransactionalDataSource decorator, passing data source name if needed.
🌐
GitHub
github.com › KIMBEOBWOO › nestjs-transaction
GitHub - KIMBEOBWOO/nestjs-transaction: A Transactional Method Decorator for TypeORM that uses Async Local Storage to handle and propagate transactions between different repositories and service methods. · GitHub
A Transactional Method Decorator for TypeORM that uses Async Local Storage to handle and propagate transactions between different repositories and service methods. - KIMBEOBWOO/nestjs-transaction
Author   KIMBEOBWOO
🌐
Reddit
reddit.com › r/nestjs_framework › how do you handle database transactions in your nestjs project with typeorm?
r/Nestjs_framework on Reddit: How do you handle database transactions in your NestJs project with TypeORM?
March 6, 2023 -

Hello everyone,

I have been looking online for a nice way to handle database transactions in NestJs.

I looked at the examples in the docs and I read some articles online, but they all revolve around passing the EntityManager around.

I am guessing that I can't be the only one looking for a better alternative as passing that object around different methods across your codebase doesn't bother me only.

So, I am curious, did anyone find a better alternative to this? To somehow hide and abstract away the EntityManager?

Looking forward to hearing your thoughts!

Many thanks!

🌐
Medium
medium.com › @jsankit99 › transaction-management-in-nestjs-typeorm-2-3-clean-repository-layer-e904b9146800
Transaction Management in NestJS + TypeORM (2/3): Clean Repository Layer | by Ankit Pradhan | Medium
January 28, 2026 - Next up: Transaction Management in NestJS + TypeORM (3/3): The @Transactional Decorator — Learn how to create a @Transactional decorator that automatically wraps your service methods in transactions, removing boilerplate and keeping your code clean.
🌐
DEV Community
dev.to › teamhive › creating-a-transaction-interceptor-using-nest-js-2inb
Creating a Transaction Interceptor Using Nest.js - DEV Community
December 7, 2021 - Instead, using Nest's ... decorator, any parameter you decorator in a controller function that is being intercepted by the TransactionInterceptor will receive a transaction that will be created per request....
🌐
Medium
medium.com › @dev.muhammet.ozen › advanced-transaction-management-with-nestjs-typeorm-43a839363491
Advanced Transaction Management with NestJS & TypeORM | by Muhammet Özen | Medium
September 17, 2023 - In the remaining sections of the article, I’ll set up a new project from scratch where I’ll be showing an advanced way to manage transactions using interceptors, request-scoped repositories and custom decorators. If you like advanced stuff, stick around until the end 😃 · Now we know how to implement transactions at a basic level, it’s time to implement transactions using repository design pattern and request-scoped providers. Note: I assume you already know how to use TypeORM and understand NestJS ecosystem at a basic level.
🌐
Hodfords
opensource.hodfords.uk › nestjs-transaction
@hodfords/nestjs-transaction | Hodfords OpenSource
You can use the @Transactional decorator to mark a method as transactional. This means that all database operations within this method and child methods will be executed within a transaction context.
🌐
GitHub
github.com › KIMBEOBWOO › nestjs-transaction › blob › master › README.md
nestjs-transaction/README.md at master · KIMBEOBWOO/nestjs-transaction
A Transactional Method Decorator for TypeORM that uses Async Local Storage to handle and propagate transactions between different repositories and service methods. - KIMBEOBWOO/nestjs-transaction
Author   KIMBEOBWOO
🌐
Andronio
andronio.me › 2022 › 02 › 02 › per-request-transactions-with-nest-js-and-typeorm
Per-request transactions with Nest.js and TypeORM | Nicolò Andronio
February 2, 2022 - createParamDecorator is an utility provided by Nest.js that builds a decorator that is correctly interpreted during a request and injects a specific value into a function parameter. As you can read above, the Transactional decorator grabs the current request from the context and instantiates ...
🌐
Bytesmith
bytesmith.dev › blog › 20240320-nestjs-transactions
How I Harnessed Transactions in NestJS with TypeORM ...
March 19, 2024 - Launch your MVP in 30 days. ByteSmith is a precision-engineered boutique software studio that builds scalable, high-performance applications.