Skip to content

implement transaction management #22

@admiradordedamas

Description

@admiradordedamas

Clean Architecture has a single rule: dependencies must always point toward the domain.

Many NestJS projects violate this rule, even those that claim to use Clean Architecture.

NestJS has a key feature that is often misused and ends up breaking the dependency rule.

That same feature, when used correctly (as shown in the documentation), allows the rule to be respected without hacks.

The key is to properly understand the rule and know what to do and what not to do. The documentation explains how to apply the correct option.


There are four strategies to implement transaction management in a NestJS project that uses Clean Architecture.

One of these strategies relies on a feature that has existed since Node.js 12.

Each strategy can be analyzed in terms of:

  • Whether it violates Clean Architecture
  • Whether it is coupled to the framework or a specific library
  • The complexity of the required changes
  • Whether it facilitates testing or not
  • Whether it is thread-safe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions