This post has some notes and the code I did while studying nestjs. The idea is to code and see the database configured and ready to start some applications to use the database.
Nest can work with different database, SQL or NoSQL. You just need use the correct driver. The general libraries to Node.JS are MikroORM, Sequelize, TypeORM (most mature for TypeScript) and Prisma. The NodeJS provides tight integration with @nestjs/typeorm, @nestjs/sequelize and @nestjs/mongoose. You can use more than one instance of the database and different combinations of the database libraries.
Here are examples how to configure the main supports to database. The database config you can add in the AppModule or in a separate file. The code you can see here.
TypeORM
More details about the use of configurations with configService or external files and about the sort of relations between the entities you can see here[1], [2], [3].
Sequelize
More details about the use of configurations with configService or external files an the relations between the entities you can see here[1], [4], [5].
After those steps your project will be created with a folder prisma and the schema file where you will add your entities. In this case you don't need declare the configuration in the module. You will do this in your .env file. For all the other libraries is possible use the .env file to that as well but prisma has it as default.
Here is the example how it works. The complete code you can see here.