DDD + Hexagonal Architecture Generator for VS Code
Overview
The DDD + Hexagonal Architecture Generator is a VS Code extension designed to streamline the creation of Domain-Driven Design (DDD) and Hexagonal Architecture structures. It allows developers to easily scaffold projects with customizable folder and subfolder configurations tailored to specific features.
Features
Installation
- Install the extension from the VS Code marketplace or clone this repository.
- Open your project in VS Code.
Usage
1. Generate DDD Structure
- Right-click on a folder in the VS Code Explorer.
- Select "Generate DDD + Hexagonal Structure".
- Follow the interactive prompts:
- Feature Name: Optionally provide a feature name to create a scoped structure.
- Select Folders: Choose which folders to include (e.g.,
domain , application ).
- Configure Subfolders: Customize subfolders for each selected folder.
2. Customize .dddconfig.json
The .dddconfig.json file allows you to define default settings:
{
"version": "1.0.0",
"defaultFolders": ["domain", "infrastructure", "application", "presentation", "shared"],
"templates": {}
}
3. Add a Feature
- During the structure generation process, you can specify a feature name. If provided, the structure will be created under this feature folder, allowing for modular organization.
- Example: If you enter
user_management as the feature name, the resulting structure will look like:
src/
├── user_management/
│ ├── domain/
│ │ ├── entities/
│ │ ├── valueobjects/
│ │ ├── repositories/
│ │ ├── services/
│ │ └── mod.rs
│ ├── infrastructure/
│ │ ├── database/
│ │ ├── repositories/
│ │ ├── datasources/
│ │ └── mod.rs
│ ├── application/
│ │ ├── usecases/
│ │ ├── dtos/
│ │ ├── validators/
│ │ └── mod.rs
│ ├── presentation/
│ │ ├── controllers/
│ │ ├── routes/
│ │ └── mod.rs
│ ├── shared/
│ │ ├── services/
│ │ ├── utilities/
│ │ ├── validators/
│ │ └── mod.rs
│ └── mod.rs
Note: This approach is optional and can be disabled by leaving the feature name empty. Is ideal for modular development and feature-oriented organization, enabling separation of concerns and scalability.
Configuration Options
- Default Folders: Specify the core folders to include in the structure, such as
domain , infrastructure , application , presentation , and shared .
- Templates: Define subfolders for each core folder (e.g.,
Entities , Repositories , Controllers ).
- Feature Name: Optionally provide a feature name to create a scoped structure for modular development.
- Mod.rs Files: Automatically generate
mod.rs files for Rust projects.
- Interactive Prompts: Guide users to select features, folders, and subfolders with an intuitive interface.
- Reusable Boilerplate: Generate reusable boilerplate files for Rust projects.
- Feature-Oriented Organization: Add feature-specific folders for modular development.
- Default Configuration: Automatically generate a
.dddconfig.json file with default settings if it does not exist.
- Customizable Folder Structure: Choose and configure core folders and their subfolders.
- Scalability: Enable separation of concerns and scalability through modular development.
License
This project is licensed under the MIT License.
| |