An AI-ready, enterprise-grade Flutter starter app built with Clean Architecture, Domain-Driven Design (DDD), Hexagonal Architecture, and 100% test coverage.
| Feature | Description |
|---|---|
| π€ AI-Ready Architecture | 23 architecture rules for AI-assisted development |
| π§ͺ 100% Test Coverage | Comprehensive tests across all layers |
| ποΈ CQRS Pattern | Separate Commands (write) and Queries (read) |
| π Type-Safe Routing | go_router_builder with compile-time route safety |
| βοΈ Environment Config | --dart-define-from-file for secure configuration |
| π§± Mason Bricks | Code generators for consistent feature scaffolding |
| π± Adaptive UI | Material 3 canonical layouts with 5-class breakpoint system |
| π Token Refresh | Automatic 401 handling with thread-safe refresh |
| π‘οΈ Security | Secure storage, certificate pinning, code obfuscation |
| π Feature-First i18n | ARB files per feature with gen_l10n |
| βΏ Accessibility | WCAG 2.1 compliant with semantic labels |
| π Structured Logging | IAppLogger with environment-specific outputs |
This project follows Hexagonal Architecture (Ports & Adapters) with DDD tactical patterns:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PRESENTATION β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Pages β β Widgets β β BLoC β β Routes β β
β β (Views) β β (Reusable) β β (State Mgmt)β β (Type-Safe) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β APPLICATION β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Commands β β Queries β β Use Cases β β Events β β
β β (Write Ops) β β (Read Ops) β β (Orchestr.) β β (Domain) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DOMAIN β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Entities β βValue Objectsβ β Ports β β Failures β β
β β (Identity) β β(Validation) β β (Interfaces)β β (Either<>) β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β INFRASTRUCTURE β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β βRepositories β βData Sources β β Chopper β β Secure β β
β β (Adapters) β β (Remote/DB) β β (HTTP/WS) β β Storage β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Pattern | Implementation |
|---|---|
| CQRS | Commands for writes, Queries for reads |
| Railway-Oriented | Either<Failure, T> with fpdart |
| Hexagonal | Ports (interfaces) & Adapters (implementations) |
| Type-Safe Routing | @TypedGoRoute with go_router_builder |
| Interceptor Chain | Auth β Refresh β Logging β Error (Chopper) |
| Adaptive Navigation | Bottom nav, Rail, or Drawer based on screen size |
| Feature | Description |
|---|---|
| π Authentication | Login, Register, Token refresh, Logout with secure storage |
| π Dashboard | Home screen with adaptive navigation (Bar/Rail/Drawer) |
| π€ Profile | User profile management |
| π¦ Orders | Order management and history |
| βοΈ Settings | Theme & locale switching with HydratedBloc persistence |
| π© Feature Flags | Runtime feature toggles without third-party services |
| π WebSocket | Real-time communication with auto-reconnect |
| π API Client | Chopper with Auth, Refresh, Logging, Error interceptors |
- Flutter 3.41.2 (stable)
- Dart 3.11.0
- Very Good CLI:
dart pub global activate very_good_cli
# 1. Clone and install
git clone https://github.com/deveminsahin/starter_app.git
cd starter_app
very_good packages get
# 2. Run code generation
dart run build_runner build --delete-conflicting-outputs
# 3. Run tests
very_good test --coverage
# 4. Launch app
flutter run \
--flavor development \
--target lib/main_development.dart \
--dart-define-from-file=config/development.jsonThis project uses --dart-define-from-file for secure, type-safe environment configuration:
config/
βββ development.json.example # Copy and remove .example
βββ staging.json.example # Copy and remove .example
βββ production.json.example # Copy and remove .example
βββ example.json # Template reference
Important
First-time setup: Copy the .example files and remove the .example suffix:
cd config
cp development.json.example development.json
cp staging.json.example staging.json
cp production.json.example production.json# Development
flutter run \
--flavor development \
--target lib/main_development.dart \
--dart-define-from-file=config/development.json
# Staging
flutter run \
--flavor staging \
--target lib/main_staging.dart \
--dart-define-from-file=config/staging.json
# Production
flutter run \
--flavor production \
--target lib/main_production.dart \
--dart-define-from-file=config/production.jsonPre-configured in .vscode/launch.json for one-click debugging.
Routes are fully type-safe using go_router_builder:
// Navigate with compile-time safety
const AuthRoute().go(context);
const DashboardRoute().go(context);
// Route definition (features/auth/presentation/routes/auth_routes.dart)
@TypedGoRoute<AuthRoute>(
path: RouteDefinitions.authPath,
name: RouteDefinitions.authName,
)
class AuthRoute extends BaseRoute with $AuthRoute {
const AuthRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const AuthPage();
}
}- Centralized definitions:
core/navigation/route_definitions.dart - Feature-owned routes: Each feature declares its routes via
part of - Custom transitions: Shared page transitions in
base_route.dart - Adaptive navigation: Bottom nav, rail, or drawer based on screen size
100% test coverage with comprehensive tests across all layers. Uses Very Good CLI for proper coverage reporting.
# Run all tests with coverage
very_good test --coverage
# Run specific test file
very_good test test/features/auth/application/usecases/login_test.dart
# Generate HTML coverage report
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html
# Update golden files
very_good test --update-goldens| Type | Location | Purpose |
|---|---|---|
| Unit | test/ |
Domain logic, use cases, repositories |
| Widget | test/ |
UI components with pumpApp helper |
| BLoC | test/ |
State management with bloc_test |
| Golden | test/goldens/ |
Visual regression screenshots |
| Property-Based | test/ |
Fuzz testing with Glados |
| Benchmark | test/benchmarks/ |
Performance metrics |
| Integration | integration_test/ |
Full user flows |
lib/
βββ app/ # App entry point, providers
βββ core/ # Shared infrastructure
β βββ api/ # Chopper HTTP client, interceptors
β βββ application/ # Bootstrap, environment
β βββ di/ # Dependency injection (get_it + injectable)
β βββ domain/ # Base classes (Entity, ValueObject)
β βββ error/ # Failure types, exception handling
β βββ feature_flags/ # Runtime feature toggles
β βββ infrastructure/ # Base repositories, WebSocket
β βββ l10n/ # Localization (gen_l10n)
β βββ navigation/ # GoRouter, type-safe routes
β βββ presentation/ # Shared widgets, failure messages
β βββ theme/ # Material 3, flex_color_scheme
βββ features/ # Business domain features
βββ auth/ # Authentication (reference implementation)
βββ dashboard/ # Home with adaptive navigation
βββ orders/ # Order management
βββ profile/ # User profile management
βββ settings/ # Theme & locale switching
This project includes 23 architecture rule files in docs/architecture-rules/ for AI-assisted development:
| Category | Rules |
|---|---|
| Core Architecture | Project structure, layers, domain, application, infrastructure, presentation |
| Patterns | State management, error handling, DI, navigation, data modeling |
| Quality | Testing, code quality, accessibility, theming |
| Integration | API integration, i18n, security, logging, performance |
AI tools can understand and generate architecture-compliant code using these rules.
Generate architecture-compliant code with Mason:
# Install Mason CLI
dart pub global activate mason_cli
# Generate a new feature
mason make feature --feature_name payments
# Generate a use case
mason make use_case --name get_payment_history
# Available bricks: feature, use_case, bloc, entity, value_object, repositorySee MASON_GUIDE.md for detailed templates.
| Package | Purpose |
|---|---|
flutter_bloc |
State management |
go_router + go_router_builder |
Type-safe navigation |
get_it + injectable |
Dependency injection |
fpdart |
Functional error handling |
freezed |
Immutable data classes |
| Package | Purpose |
|---|---|
chopper |
HTTP client with code generation |
flutter_secure_storage |
Secure token storage |
hydrated_bloc |
Persistent state |
flex_color_scheme |
Material 3 theming |
synchronized |
Thread-safe locks (token refresh) |
| Package | Purpose |
|---|---|
very_good_analysis |
Strict linting |
bloc_test |
BLoC testing utilities |
mocktail |
Mocking framework |
glados |
Property-based testing |
| Document | Description |
|---|---|
| ARCHITECTURE.md | System design and patterns |
| CONTRIBUTING.md | Development guidelines |
| CHANGELOG.md | Version history |
| MASON_GUIDE.md | Code generation templates |
| docs/adr/ | Architecture Decision Records |
Want to test with a real backend? A companion Spring Boot server is available:
π starter_app_backend
# Option 1: Run with Docker
git clone https://github.com/deveminsahin/starter_app_backend.git
cd starter_app_backend
docker-compose up
# Option 2: Run directly (requires Java 25+)
./gradlew bootRunBackend runs at http://localhost:8080. The Flutter app is pre-configured to connect.
| Feature | Endpoint | Description |
|---|---|---|
| π Authentication | /api/v1/auth/* |
Register, Login, Refresh, Logout |
| π€ Profile | /api/v1/profiles/* |
Create, Read, Update profile |
| π WebSocket | /ws/auth |
Real-time auth state notifications |
Note
The backend uses an in-memory H2 database for development. All data resets on restart.
If you find this project useful, consider supporting its development:
See CONTRIBUTING.md for development setup, code style, and PR guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.


