A command-line interface (CLI) tool that generates modules in hexagonal architecture for NestJS, making it easy to follow the principles of clean architecture and separation of concerns.
- Scaffold modules using the hexagonal architecture pattern
- Generate service, controller, repository, and DTO files
- Automatically wire up dependencies using NestJS decorators
- Promote a modular and maintainable code structure
- Enhance separation of concerns and testability
- Enable better code organization and scalability
npm install -g nest-hexagon-cli
To generate a module using the hexagonal architecture pattern, simply run the following command:
nest-hexagon generate module <module-name>
This will create a new module in the current directory with the specified name, along with the necessary files and folder structure.
Generate a new module named users
:
nest-hexagon generate module users
This project is licensed under the MIT License.
Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request.
Here are some ideas and potential features for future development:
- Support for generating other components such as guards, interceptors, and pipes
- Integration with popular testing frameworks to generate test files
- Support for customizing the generated code templates
- Ability to generate modules with additional configuration options
- Improved error handling and user-friendly error messages
Feel free to contribute by implementing any of these features or suggesting your own!
This project is inspired by the principles of hexagonal architecture and the clean architecture movement. Special thanks to the NestJS community for their amazing work and support.
For any questions or inquiries, please contact contact.khalfoun@gmail.com.
We hope this CLI tool helps you build modular and maintainable applications with NestJS and the hexagonal architecture pattern. Happy coding!
Note: This is a sample readme file. You can modify it as per your requirements and add more details specific to your npm library.
Here are a few ideas to enhance your NestJS hexagonal architecture generator:
- Interactive CLI: Create an interactive command-line interface that guides users through the module generation process, allowing them to choose options and configure different components.
- Code Templates: Implement a system that allows users to define custom code templates for different files, enabling them to tailor the generated code to their specific needs.
- Integration with TypeORM: Extend the generator to integrate with TypeORM, enabling the generation of database-related files such as entities, migrations, and query builders.
- Configuration Options: Add support for configuration files where users can define default options for the generator, making it easier to maintain consistency across projects.
- Testing Support: Incorporate testing frameworks such as Jest or Mocha to generate test files alongside the module scaffolding, promoting a test-driven development (TDD) approach.
- Documentation Generation: Include a feature to generate API documentation using tools like Swagger or Compodoc, automating the process of documenting the generated modules.