Structuring Angular Modules for Scalability
Understand best practices for organizing modules in an Angular application to foster scalability and maintainability as projects grow.
0 likes
43 views
Rule Content
{ "title": "Structuring Angular Modules for Scalability", "description": "Understand best practices for organizing modules in an Angular application to foster scalability and maintainability as projects grow.", "category": "Angular Cursor Rules", "rules": [ { "pattern": ".*", "message": "Ensure the application is divided into feature modules, each encapsulating a specific functionality. This modular approach enhances maintainability and scalability.", "severity": "warning" }, { "pattern": ".*", "message": "Implement lazy loading for feature modules to improve performance by loading modules only when needed.", "severity": "warning" }, { "pattern": ".*", "message": "Create a Core Module for singleton services and components used across the application, importing it only in the root module.", "severity": "warning" }, { "pattern": ".*", "message": "Develop a Shared Module for reusable components, directives, and pipes, ensuring it does not contain services to prevent multiple instances.", "severity": "warning" }, { "pattern": ".*", "message": "Adopt a feature-based folder structure, grouping related files together to enhance code organization and readability.", "severity": "warning" }, { "pattern": ".*", "message": "Use consistent naming conventions for files and directories to improve code maintainability and collaboration.", "severity": "warning" }, { "pattern": ".*", "message": "Avoid placing business logic directly in components; instead, delegate it to services to adhere to the Single Responsibility Principle.", "severity": "warning" }, { "pattern": ".*", "message": "Utilize Angular's dependency injection system to manage dependencies between modules, promoting loose coupling and easier testing.", "severity": "warning" }, { "pattern": ".*", "message": "Regularly review and refactor the module structure to accommodate new features and maintain scalability as the project evolves.", "severity": "warning" } ] }