Skip to content

📁 Folder Structure ​

Guidelines for organizing mobile application code structure.

Clean Architecture ​

The folder structure should be organized based on the following rules:

  1. lib/features/: This folder contains the features of the application. Each feature should be a folder with clean architecture layers, in case of a nested feature, the folder structure should be feature_name/sub_feature_name/.
  2. lib/shared/: This folder contains the shared code of the application.
  3. lib/generated/: Make the i18n generated files in this folder.

Features Folder Structure ​

Each feature should be a folder with clean architecture layers.

  1. feature_name/data/: The data layer that is responsible for handling the data of the feature either from the network or from the local storage.
  2. feature_name/domain/: The domain layer that is responsible for holding the business logic of the feature, in case of a simple CRUD feature; we can make this folder optional for less poilerplate code.
  3. feature_name/presentation/: The presentation layer that is responsible for displaying the data to the user and handling the user interactions and state management.

Shared Folder Structure ​

This folder contains the shared code of the application.

  1. components/: This folder contains reusable UI components. and includes multiple sub-directories (see components standards for more details).
  2. core/: This folder contains core usage files and base clases, These files will be inherited throughout the entire project to ensure consistent structure and standardization across all files.
  3. data/: This folder contains shared data-related classes, failures, local data sources, and network api handling files like: Api Response , Netowrk interceptors, etc.
  4. di/: Dependency injection and initialization related files should be added here.
  5. enums/: Enums used throughout the application should be added here, you can create sub folders for categorizing enums.
  6. layout/: Layout-related code, such as the bottom navigation bar and root scaffold, should be added here.
  7. resources/: App icons and images should be added here.
  8. routing/: Routing-related code should be added here, routes, route paths , navigation observers, etc.
  9. theme/: App themes and colors should be added here.
  10. utils/: Utility functions and classes , helper files, extension files, etc. should be added here.