Development of the theme:
Some implementations, like addons in NestJS, switch the Service provider of the database in the Module. For example: https://www.npmjs.com/package/@nestjs-addons/in-memory-db
I personally disagree. Why?
In the development scenario, it may make sense, but what about a test that uses only inMemory? Would we have to add an "if" statement in every Module? Or validate NODE_ENV in every service? It doesn't seem to have good maintainability for other scenarios besides the current development.
What do I consider correct?
As shown in the image I sent, I believe it would be more appropriate to have a database configuration file (in the image: Kernel) that states: "We are using (prisma | typeorm | etc.), or we are using inMemory." If we want to change only the InMemoryService of one controller, it should be enough to modify it in the Module (Dependency Injection).
Considerations:
1 - Do not take ORM into account at this moment.
2 - Do not consider that we can deploy the containers to Github Actions for testing.
3 - Do not consider end-to-end tests in containers.