{"id":30384492,"url":"https://github.com/muneeb-i-khan/layerdog","last_synced_at":"2026-04-10T00:54:14.494Z","repository":{"id":310198876,"uuid":"1038942556","full_name":"muneeb-i-khan/LayerDog","owner":"muneeb-i-khan","description":"An intelliJ plugin to enforce correct layering structure of a maven project at run time.","archived":false,"fork":false,"pushed_at":"2025-08-16T11:25:57.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-16T13:38:50.948Z","etag":null,"topics":["gradle","intellij","intellij-plugin","java","kotlin","layering","maven"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muneeb-i-khan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-16T06:10:47.000Z","updated_at":"2025-08-16T11:45:30.000Z","dependencies_parsed_at":"2025-08-16T13:38:56.939Z","dependency_job_id":"0f5f2b45-7eea-4e68-8b6c-b28a239558b1","html_url":"https://github.com/muneeb-i-khan/LayerDog","commit_stats":null,"previous_names":["muneeb-i-khan/layerdog"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/muneeb-i-khan/LayerDog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muneeb-i-khan%2FLayerDog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muneeb-i-khan%2FLayerDog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muneeb-i-khan%2FLayerDog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muneeb-i-khan%2FLayerDog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muneeb-i-khan","download_url":"https://codeload.github.com/muneeb-i-khan/LayerDog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muneeb-i-khan%2FLayerDog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271415496,"owners_count":24755639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","intellij","intellij-plugin","java","kotlin","layering","maven"],"created_at":"2025-08-21T02:00:48.207Z","updated_at":"2025-12-30T21:41:04.474Z","avatar_url":"https://github.com/muneeb-i-khan.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Layer Dog - Architecture Enforcer Plugin\n\nAn IntelliJ IDEA plugin that enforces architectural layering rules in Java projects using Maven build system.\n\n## Architecture Layers\n\nThe plugin enforces the following layering rules:\n\n### 1. Controller Layer\n- **Purpose**: Handle HTTP requests/responses\n- **Rules**: \n  - Should have no business logic\n  - Should only call DTO layer\n- **Naming conventions**: Classes ending with `Controller`, `Resource`, `Endpoint` or in packages containing `controller`, `web`, `rest`\n\n### 2. DTO Layer (Data Transfer Object)\n- **Purpose**: Data validation, conversion, and transfer\n- **Rules**:\n  - Should only call API layer\n  - Should do validations and conversions\n  - Should have no business logic\n- **Naming conventions**: Classes ending with `DTO`, `Dto`, `Request`, `Response`, `Model` or in packages containing `dto`, `model`\n\n### 3. API Layer (Service/Business Layer)\n- **Purpose**: Contains all business logic\n- **Rules**:\n  - Should contain business logic\n  - Should call DAO or FLOW layers\n  - Should not call other API layers directly\n- **Naming conventions**: Classes ending with `Service`, `ServiceImpl`, `Manager`, `Handler`, `Processor` or in packages containing `service`, `business`, `logic`\n\n### 4. FLOW Layer\n- **Purpose**: Orchestrate multiple API calls\n- **Rules**:\n  - Should be used when API needs to call other APIs\n  - Should orchestrate API operations\n  - Should call API layers only\n- **Naming conventions**: Classes ending with `Flow`, `Workflow`, `Orchestrator`, `Coordinator` or in packages containing `flow`, `workflow`, `orchestrat`\n\n### 5. DAO Layer (Data Access Object)\n- **Purpose**: Database interaction\n- **Rules**:\n  - Should only talk to database\n  - Should contain no business logic\n  - Should handle data persistence operations\n- **Naming conventions**: Classes ending with `DAO`, `Dao`, `Repository`, `Mapper`, `Entity` or in packages containing `dao`, `repository`, `data`, `persistence`\n\n## Installation\n\n### 📥 Download from GitHub Releases (Recommended)\n\n1. **Download the latest plugin**:\n   - Go to [Releases](https://github.com/muneeb-i-khan/LayerDog/releases)\n   - Download `layer-dog-x.x.x.zip` from the latest release\n\n2. **Install in IntelliJ IDEA**:\n   - Go to `File → Settings → Plugins`\n   - Click the ⚙️ gear icon and select `Install Plugin from Disk...`\n   - Select the downloaded ZIP file\n   - Restart IntelliJ IDEA\n\n### 🛠️ Building from Source (Advanced)\n\n1. Clone this repository\n2. Open in IntelliJ IDEA  \n3. Run the Gradle task: `./gradlew buildPlugin`\n4. The plugin will be built in `build/distributions/`\n\n## Usage\n\nOnce installed, the plugin automatically checks your Java code for layer violations:\n\n### Real-time Inspection\n- Violations are highlighted with red underlines as you type\n- Error messages explain the specific violation\n- Hover over violations to see detailed descriptions\n\n### Quick Fixes\nEach violation includes quick fixes that provide guidance on how to resolve the issue:\n- **Move to DTO Layer**: For controller violations\n- **Use FLOW Layer**: For API-to-API communication\n- **Extract Business Logic**: For logic in wrong layers\n- **Create DAO Method**: For data access violations\n\n### Configuration\n\nThe plugin works out of the box with default naming conventions. It detects layers based on:\n- Class name suffixes (Controller, DTO, Service, Flow, DAO, etc.)\n- Package names (controller, dto, service, flow, dao, etc.)\n- Annotations (@Controller, @Service, @Repository, etc.)\n\n## Examples\n\n### ✅ Correct Usage\n\n```java\n// Controller - only calls DTO\n@RestController\npublic class UserController {\n    private UserDTO userDTO;\n    \n    public ResponseEntity\u003cUser\u003e getUser(Long id) {\n        return ResponseEntity.ok(userDTO.getUser(id));\n    }\n}\n\n// DTO - calls API layer\npublic class UserDTO {\n    private UserService userService;\n    \n    public User getUser(Long id) {\n        // Validation and conversion\n        validateId(id);\n        return userService.findUser(id);\n    }\n}\n\n// API/Service - contains business logic\n@Service\npublic class UserService {\n    private UserDAO userDAO;\n    private UserFlow userFlow; // For complex operations\n    \n    public User findUser(Long id) {\n        // Business logic here\n        return userDAO.findById(id);\n    }\n}\n\n// FLOW - orchestrates multiple APIs\npublic class UserFlow {\n    private UserService userService;\n    private NotificationService notificationService;\n    \n    public void processUserRegistration(User user) {\n        userService.createUser(user);\n        notificationService.sendWelcomeEmail(user);\n    }\n}\n\n// DAO - database operations only\n@Repository\npublic class UserDAO {\n    public User findById(Long id) {\n        // Database query\n        return entityManager.find(User.class, id);\n    }\n}\n```\n\n### ❌ Violations Detected\n\n```java\n// ❌ Controller calling API directly\n@RestController\npublic class UserController {\n    private UserService userService; // Should use DTO instead\n}\n\n// ❌ DTO with business logic\npublic class UserDTO {\n    public User processUser(User user) {\n        // ❌ Complex business logic should be in API layer\n        if (user.getAge() \u003e 65) {\n            user.setDiscount(0.15);\n            calculatePremium(user);\n        }\n        return user;\n    }\n}\n\n// ❌ API calling another API directly\n@Service\npublic class UserService {\n    private OrderService orderService; // ❌ Should use FLOW layer\n}\n\n// ❌ DAO with business logic\n@Repository\npublic class UserDAO {\n    public User findUser(Long id) {\n        User user = findById(id);\n        // ❌ Business logic should be in API layer\n        if (user.isActive()) {\n            user.updateLastAccessed();\n        }\n        return user;\n    }\n}\n```\n\n## Supported Annotations\n\nThe plugin recognizes these common annotations for layer detection:\n- `@RestController`, `@Controller` → Controller layer\n- `@Service` → API layer  \n- `@Repository`, `@Entity`, `@Table` → DAO layer\n\n## Development\n\n### Project Structure\n```\nsrc/main/kotlin/com/layerdog/\n├── inspections/           # Inspection implementations\n│   ├── BaseLayerInspection.kt\n│   ├── ControllerLayerInspection.kt\n│   ├── DTOLayerInspection.kt\n│   ├── APILayerInspection.kt\n│   ├── FlowLayerInspection.kt\n│   └── DAOLayerInspection.kt\n└── utils/\n    └── LayerDetector.kt   # Layer detection utility\n```\n\n### Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Submit a pull request\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Support\n\nFor issues and feature requests, please create an issue in the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuneeb-i-khan%2Flayerdog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuneeb-i-khan%2Flayerdog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuneeb-i-khan%2Flayerdog/lists"}