The Flutter Clean Architecture CLI (fca-cli) is a command-line tool that helps you quickly set up a clean architecture structure in Flutter projects. It provides organized modules and components, making your code more scalable, testable, and easier to maintain.
You can install fca-cli globally:
npm install -g fca-cli@latestOr, you can run it using npx without installation:
npx fca-cli@latest [options] [command]fca-cli [options] [command]This CLI tool supports various commands to generate specific components within your Flutter project's clean architecture.
-
-V, --version
Output the version number offca-cli. -
-h, --help
Display help for the command.
⚠️ The `fca-cli add-usecase` command is deprecated.
Please use the new command `fca-cli add-use-case` instead.
| Command | Description |
|---|---|
add-feature <featureName> [options] |
Adds a new feature module to lib/features with a clean folder structure. |
add-data-source [options] <featureName> [dataSourceName] |
Creates a data source (local or remote) within the specified feature. |
add-repository <featureName> <repositoryName> |
Generates a repository template inside a feature for managing data sources. |
add-model <featureName> <modelName> |
Creates a data model within the specified feature for handling API or data responses. |
add-entity <featureName> <entityName> |
Defines an entity within the specified feature, representing core business objects. |
add-usecase <featureName> <usecaseName> [repositoryName] |
Sets up a use case within the specified feature, focusing on specific business logic. |
add-page <featureName> [pageName] |
Adds a page template within the specified feature for user interfaces. |
add-bloc <featureName> <blocName> |
Generates a Bloc within the specified feature to handle state management. |
add-widget <featureName> <widgetName> |
Adds a reusable widget within the specified feature for UI components. |
help [command] |
Display help for a specific command. |
Here are some examples of how you can use fca-cli to generate various components:
-
Add a Feature:
fca-cli add-feature Authentication
or using
npx:npx fca-cli@latest add-feature Authentication
-
Add a Repository:
fca-cli add-repository Authentication Auth
or using
npx:npx fca-cli@latest add-repository Authentication Auth
-
Add a Local Data Source:
fca-cli add-data-source -local Authentication Auth
or using
npx:npx fca-cli@latest add-data-source -local Authentication Auth
-
Add a Model:
fca-cli add-model Authentication User
or using
npx:npx fca-cli@latest add-model Authentication User
-
Add an Entity:
fca-cli add-entity Authentication User
or using
npx:npx fca-cli@latest add-entity Authentication User
-
Add a Use Case:
fca-cli add-use-case Authentication Login
or using
npx:npx fca-cli@latest add-use-case Authentication Login
-
Add a Page:
fca-cli add-page Authentication Login or using `npx`: ```bash npx fca-cli@latest add-page Authentication Login
-
Add a Bloc:
fca-cli add-bloc Authentication Login
or using
npx:npx fca-cli@latest add-bloc Authentication Login
-
Add a Widget:
fca-cli add-widget Authentication LoginButton
or using
npx:npx fca-cli@latest add-widget Authentication LoginButton
For help on a specific command, use:
fca-cli help <command>Example:
fca-cli help add-modelor using npx:
npx fca-cli@latest help add-modelThis project is licensed under the MIT License.