Menu

Project Structure

Relevant source files

This document outlines the organization of the Flutter Mobile Project Template repository. It provides a comprehensive overview of the directory structure, explains the relationships between different packages, and describes the roles of each component. For information about how to get started with development, see Getting Started.

Repository Organization

The repository is organized into several main directories that serve distinct purposes:

Sources: pubspec.yaml5-26 docs/ARCHITECTURE.md10-24

Apps Directory

The apps directory contains standalone applications:

  1. Main App (apps/app): The primary mobile application intended for end-users. It imports and uses functionality from the core and feature packages.

  2. UI Catalog (apps/catalog): A dedicated application for showcasing and previewing UI components from the cores and features packages. This app is primarily used by developers and designers to visualize components in isolation.

Sources: apps/app/pubspec.yaml1-66 apps/catalog/pubspec.yaml1-33 apps/catalog/README.md1-31

Packages Directory

The packages directory is organized into three main categories:

Core Packages (packages/cores/)

Core packages provide fundamental capabilities used throughout the application. They implement base functionality that feature packages can build upon.

PackageDescription
coreFoundation features for the app, including basic utilities and common functionality
dataData access layer with repositories and network clients
designsystemStyle definitions, themes, and design tokens
modelData model classes used across the application
uiShared UI components built on top of the design system

Feature Packages (packages/features/)

Feature packages implement specific user-facing functionality. Each feature package is self-contained with its own UI, data access, and business logic.

PackageDescription
debug_modeDeveloper tools and debugging features
force_updateFunctionality to manage app version updates
maintainMaintenance mode implementation
settingApplication settings and configuration
webviewWebView functionality for rendering web content

Utility Packages (packages/utils/)

Utility packages provide reusable functionality that doesn't fit into core or feature categories.

PackageDescription
paginationUtilities for handling paginated data

Sources: pubspec.yaml10-26 packages/cores/data/pubspec.yaml1-30 packages/cores/designsystem/pubspec.yaml1-35 packages/cores/model/pubspec.yaml1-18 packages/cores/ui/pubspec.yaml1-29 packages/features/debug_mode/pubspec.yaml1-41 packages/features/force_update/pubspec.yaml1-36 packages/features/maintain/pubspec.yaml1-44 packages/features/setting/pubspec.yaml1-48 packages/utils/pagination/pubspec.yaml1-24

Feature Package Structure

Each feature package follows a consistent internal structure to maintain organization and separation of concerns:

Sources: packages/features/setting/pubspec.yaml1-48 packages/features/debug_mode/pubspec.yaml1-41 packages/features/maintain/pubspec.yaml1-44

Dependency Hierarchy

The project follows a structured dependency hierarchy to maintain proper architectural boundaries:

Key dependency rules:

  1. App modules can depend on both core and feature packages
  2. Feature packages can only depend on core packages
  3. Core packages can depend on other core packages
  4. Core packages cannot depend on feature packages

This hierarchy prevents circular dependencies and ensures proper separation of concerns.

Sources: docs/ARCHITECTURE.md26-41 apps/app/pubspec.yaml13-30 packages/features/debug_mode/pubspec.yaml12-35 packages/features/setting/pubspec.yaml12-28 packages/features/force_update/pubspec.yaml12-24 packages/features/maintain/pubspec.yaml12-31

Tools Directory

The tools directory contains development tools and code generation resources:

The tools directory includes:

  1. Bricks: Mason templates for generating new code components like feature packages
  2. Generation Scripts: Scripts for automating code generation tasks

Sources: pubspec.yaml28-30 tools/bricks/cores_package_dart/__brick__/packages/cores/{{package_name.snakeCase()}}/README.md1-40

Workspace Configuration

The project uses Melos for managing the monorepo workspace. The workspace configuration is defined in the root pubspec.yaml file:

Key aspects of the workspace configuration:

  1. Workspace Definition: Lists all the packages in the monorepo
  2. Bootstrap Process: Sets up dependencies across all packages
  3. Development Scripts: Provides standardized commands for common tasks
  4. Environment Configuration: Specifies the SDK and Flutter versions

Sources: pubspec.yaml4-26 pubspec.yaml40-226

Environment Configuration

The application supports multiple environments, each with its own set of configurations:

EnvironmentPurposeApp ID Example
DevDevelopment environment for ongoing developmentjp.co.yumemi.template.dev
StgStaging environment for pre-release testingjp.co.yumemi.template.stg
PrdProduction environment for end usersjp.co.yumemi.template

Each environment has its own configuration for app name, app ID, and other environment-specific variables.

Sources: apps/app/README.md7-31

Conclusion

The Flutter Mobile Project Template follows a carefully structured approach to organizing code, with clear separation between apps, core packages, feature packages, and utilities. This structure promotes:

  1. Modularity: Each package has a focused responsibility
  2. Reusability: Core components can be shared across features
  3. Testability: Clear boundaries make testing easier
  4. Maintainability: Organized structure simplifies navigation and understanding
  5. Scalability: Easy to add new features without modifying existing code

This organization reflects modern architectural principles for mobile app development, ensuring the codebase remains manageable as the application grows in complexity.