| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A production-ready Flutter starter kit implementing Clean Architecture with Riverpod, GoRouter, Dio, and best-in-class patterns for scalable cross-platform development. Built for teams who need architecture that scales beyond a prototype, enforces type-safety, and makes testing a first-class citizen.
The project strictly follows the Dependency Rule: Source code dependencies must point inward. The Domain layer knows nothing of Flutter, Dio, or Riverpod.
graph TD
UI[Presentation / UI] -->|Watches| Provider[Riverpod Provider]
Provider -->|Calls| UseCase[Domain UseCase]
UseCase -->|Calls| RepoInterface[Domain Repository Interface]
RepoInterface -.->|Implemented by| RepoImpl[Data Repository Impl]
RepoImpl -->|Calls| Datasource[Data Datasource]
Datasource -->|Uses| ApiClient[Dio ApiClient]
Datasource -->|Uses| Storage[SecureStorage/Cache]
##📁 Folder Structure
lib/
├── core/ # Shared infrastructure & utilities
│ ├── config/ # Environment & app configuration
│ ├── di/ # Dependency injection (Riverpod composition root)
│ ├── error/ # Failure hierarchy & error mapping
│ ├── network/ # Dio client, interceptors, API response models
│ ├── router/ # GoRouter configuration & route guards
│ ├── storage/ # Local & secure storage abstractions
│ ├── theme/ # Material 3 theme, colors, typography, spacing
│ ├── utils/ # Validators, loggers, extensions
│ └── widgets/ # Reusable UI components (AppButton, AppLoader, etc.)
├── features/ # Feature-first modules
│ └── auth/ # Authentication feature
│ ├── data/ # DTOs, datasources, repository implementations
│ ├── domain/ # Entities, repository interfaces, use cases
│ └── presentation/ # Riverpod providers, pages, widgets
└── main.dart # App entry point with flavor support
git clone https://github.com/amjadlabdev/flutter_architecture_kit.git
cd flutter_architecture_kit
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs # Generate Freezed/Riverpod code
flutter run# Development (default)
flutter run --dart-define=APP_ENV=development
# Staging
flutter run --dart-define=APP_ENV=staging
# Production
flutter run --dart-define=APP_ENV=productionFollow this exact sequence to maintain the Dependency Rule:
Domain Layer (features/{feature}/domain/):
Data Layer (features/{feature}/data/):
Presentation Layer (features/{feature}/presentation/):
DI (core/di/injection.dart):
Routing (core/router/):
##🧠 State Management: Why Riverpod?
Riverpod was chosen over BLoC and Provider for production apps because:
Provider Hierarchy:
We use dartz's Either<Failure, T> instead of try/catch at the Domain layer.
Why? Exceptions are invisible in function signatures. You don't know a function can fail until it crashes at runtime. Either forces the caller to handle both Left (failure) and Right (success) at compile time.
Flow:
Declarative routing tied to Riverpod state prevents manual Navigator.push bugs.
Run tests:
flutter testMocking Strategy:
Amjad Ali — Senior Software Engineer & Solution Architect
Built with ❤️ and Clean Architecture principles.
| Back | FazBrowse Home | New Git URL |