Skip to main content

Make 🧱

The make command in Forge cli allows you to create a new feature, adhering to clean architecture principles. This command generates the necessary folder structure and files for the specified feature within your Flutter project.

Usage​

forge_cli make <feature_name>

Replace <feature_name> with the name of the feature you want to create.

Example​

To create an authentication feature, you would run:

forge_cli make authentication

Generated Folder Structure​

When you run the make command, Forge cli generates a folder structure that follows clean architecture principles. Here’s an example of the folder structure created for the authentication feature:

authentication
β”œβ”€β”€ data
β”‚Β Β  └── models
β”‚Β Β  β”œβ”€β”€ authentication_model.dart
β”‚Β Β  └── authentication_models_export.dart
β”œβ”€β”€ domain
β”‚Β Β  β”œβ”€β”€ entities
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ authentication_entities_export.dart
β”‚Β Β  β”‚Β Β  └── authentication_entity.dart
β”‚Β Β  └── repositories
β”‚Β Β  └── authentication_repository.dart
└── presentation
β”œβ”€β”€ views
β”‚Β Β  └── authentication_screen.dart
└── widgets
└── example_widget.dart

Folder Breakdown​

  • data: Contains data sources, models, and repository implementations.
    • datasources: Manages data retrieval from remote or local sources.
    • models: Contains data models.
    • repositories: Implements the repository interfaces defined in the domain layer.
  • domain: Contains business logic, entities, repository interfaces, and use cases.
    • entities: Defines core business objects.
    • repositories: Contains repository interfaces.
    • usecases: Contains business logic operations.
  • presentation: Manages the user interface and state.
    • bloc: Contains the BLoC (Business Logic Component) for state management.
    • pages: Contains the UI pages and widgets.

Benefits​

  • Consistency: Ensures a consistent project structure following clean architecture principles.
  • Separation of Concerns: Divides the project into distinct layers, making it easier to manage and scale.
  • Scalability: Facilitates the addition of new features without impacting existing code.

Last updated: May 27, 2024