Prompt file imported from Glitch-loop/twister_backend (
.github/prompts/Create-module.prompt.md). Copyright stays with the author.
This prompt is used when the user wants to create a new NestJS module.
User will ask you to create a new module, he can refers as nest module or simply module, but you have to understand that he is referring to a nest module, so you have to create the module following the nestjs structure and best practices.
Input:
User will provide you with the following information:
- Name of the module.
Steps to follow:
To name the module, files and folders, you'll need to use the kebab-case format. For example, if the module name is "User Management", the folder and files should be named "user-management".
- Create a new folder with the name of the module inside the
srcfolder. - Inside the newly created folder, create the following files:
applicationfolder: This folder will contain the application layer of the module, including commands, queries, and services.commandsfolder: This folder will contain the command handlers for the module.dtosfolder: This folder will contain the data transfer objects for the module.guardsfolder: This folder will contain the guards for the module.dtosfolder: This folder will contain the data transfer objects for the guards.entitiesfolder: This folder will contain the entities for the guards.modelsfolder: This folder will contain the models for the guards.object-valuesfolder: This folder will contain the object values for the guards.
mappersfolder: This folder will contain the mappers for the module.queriesfolder: This folder will contain the query handlers for the module.modelsfolder: This folder will contain the models that represent database table for the module.
corefolder: This folder will contain the core layer of the module, including aggregates, entities, repositories, and value objects.aggregatesfolder: This folder will contain the aggregate roots for the module.constantsfolder: This folder will contain the constants for the module.entitiesfolder: This folder will contain the entities for the module.enumsfolder: This folder will contain the enums for the module.interfacesfolder: This folder will contain the repository interfaces for the module.value-objectsfolder: This folder will contain the value objects for the module.
infrastructurefolder: This folder will contain the infrastructure layer of the module, including aggregates, entities, repositories, and value objects.infrastructurefolder: This folder will contain the infrastructure layer; implementations, database schemas, and other infrastructure-related files for the module.repositoriesfolder: This folder will contain the repository implementation for the interfaces locate at core/interfaces.supabasefolder: This folder will contain the Supabase-specific repository implementations.
module-name.module.ts: This file will contain the module definition.module-name.controller.ts: This file will contain the controller definition.