A scalable Flutter project structured using MVVM (Model - View - ViewModel) with GetX for state management, routing, and dependency injection.
This repository serves as a standard architecture blueprint for building consistent, maintainable, and production-ready Flutter applications.
This project is designed with:
- MVVM architecture pattern
- Feature-based modular structure
- Repository pattern
- Clear separation of concerns
View (UI)
↓
ViewModel (GetX Controller)
↓
Repository
↓
Provider (API Layer)
↓
API
lib/
├── core/
│ ├── constants/ # App-wide constants
│ ├── localization/ # Language support
│ ├── network/ # API client & interceptors
│ ├── services/ # Shared services
│ ├── storage/ # Local storage handling
│ ├── theme/ # Styling & themes
│ ├── utils/ # Helpers & extensions
│ └── widgets/ # Reusable UI components
│
├── data/
│ ├── models/ # API response models
│ ├── providers/ # API calls
│ └── repositories/ # Repository implementations
│
├── domain/
│ ├── entities/ # Business models
│ └── repositories/ # Abstract contracts
│
├── modules/ # Feature-based modules
│ ├── auth/
│ ├── home/
│ └── profile/
│
├── routes/
│ ├── app_pages.dart # Route definitions
│ └── app_routes.dart # Route names
│
└── main.dart
- UI components and screens
- Observes state from ViewModel
- Contains no business logic
- Manages UI state
- Handles user interactions
- Communicates with repositories
- Defines business rules
- Contains pure entities
- Declares repository contracts
- Handles API communication
- Implements repository logic
- Transforms models into entities
- Shared utilities and services
- Includes network, storage, theming, and helpers
View → ViewModel → Repository → Provider → API
Response handling:
API → Model → Repository → Entity → ViewModel → View
- User triggers an action from UI
- View calls ViewModel
- ViewModel invokes Repository
- Repository fetches data via Provider
- Provider calls API
- Response is mapped to Entity
- ViewModel updates state
- UI reacts to state change
- Flutter
- GetX (State Management, Routing, Dependency Injection)
- Dio / http (Networking)
Install dependencies:
flutter pub get
Run the project:
flutter run
- Keep ViewModels focused and minimal
- Use repositories for all data operations
- Maintain clear separation between layers
- Keep UI free from business logic
- Direct API calls in ViewModel
- Business logic inside UI
- Large and tightly coupled controllers
- Overuse of global state
- Standardize project architecture
- Improve maintainability and readability
- Enable scalable development
- Provide a reusable project foundation
- Testing support
- Offline-first capability
- Caching strategies
- Modular package separation
This project serves as a reference architecture. Contributions and improvements are welcome.
This project is licensed under the Apache-2.0 License.