A production-ready Flutter app template following 2026 enterprise architecture principles with clean code, modular design system, and scalable structure. Perfect for starting new projects or learning best practices.
- ποΈ Clean Architecture - Domain-driven design with clear separation of concerns
- π¨ Design System - Token-based design with atoms, molecules, and organisms
- π± Responsive - Mobile, tablet, and desktop layouts out of the box
- π― Type-Safe - Result types for robust error handling
- β‘ Performance - Optimized with Flutter best practices
- π§ͺ Testable - Every layer independently testable
- π Well Documented - Comprehensive guides and examples
- π§ Production Ready - Battle-tested architecture patterns
- Startups building scalable Flutter apps
- Enterprise teams needing maintainable architecture
- Solo developers wanting best practices
- Students learning Flutter architecture
- Teams requiring consistent code structure
lib/
βββ core/ # Core infrastructure
β βββ base/ # Base classes (UseCase, etc.)
β βββ errors/ # Failure types
β βββ network/ # Result type, network utilities
β βββ constants/ # App-wide constants
β
βββ design_system/ # Design tokens & components
β βββ tokens/ # Colors, typography, spacing, breakpoints
β βββ theme/ # Theme configuration
β βββ atoms/ # Basic UI components (buttons, inputs)
β βββ molecules/ # Composite components
β βββ organisms/ # Complex components
β βββ layouts/ # Layout components (responsive)
β
βββ shared/ # Shared across features
β βββ extensions/ # Context, String extensions
β βββ helpers/ # Snackbar, dialog helpers
β βββ widgets/ # Reusable widgets
β
βββ features/ # Feature modules
β βββ home/
β βββ data/ # Data sources, DTOs, repositories
β βββ domain/ # Entities, use cases, contracts
β βββ presentation/ # Screens, widgets, providers
β
βββ app/ # App configuration
βββ app.dart # Root app widget
Click the "Use this template" button at the top of this repository, or:
# Clone the repository
git clone https://github.com/divijsahu/flutter-app-template.git your-app-name
cd your-app-name
# Remove git history and start fresh
rm -rf .git
git init
git add .
git commit -m "Initial commit from template"# Install dependencies
flutter pub get
# Run the app
flutter run
# Run tests
flutter test
# Check for issues
flutter analyze- Update app name in
pubspec.yaml - Change package name:
flutter pub run change_app_package_name:main com.yourcompany.yourapp - Update constants in
lib/core/constants/app_constants.dart - Customize theme in
lib/design_system/tokens/ - Add your features in
lib/features/
- Architecture Guide - Detailed architecture breakdown
- Design System Guide - Using design tokens and components
- Feature Development - Adding new features
- Testing Guide - Writing tests
- Enterprise Architecture - Full enterprise patterns
- Best Practices - Coding standards and conventions
// Colors
Container(color: AppColors.primary)
// Spacing
Padding(padding: AppSpacing.pagePadding)
// Typography
Text('Hello', style: AppTypography.headlineMedium)
// Breakpoints
if (MediaQuery.of(context).size.width >= AppBreakpoints.tablet) {
// Tablet layout
}// Primary Button
PrimaryButton(
label: 'Submit',
onPressed: () {},
isLoading: false,
)
// Responsive Layout
ResponsiveLayout(
mobile: MobileWidget(),
tablet: TabletWidget(),
desktop: DesktopWidget(),
)// Access theme
context.colors.primary
context.textTheme.bodyLarge
// Check device type
if (context.isMobile) { }
if (context.isTablet) { }
if (context.isDesktop) { }Each feature is self-contained with its own data, domain, and presentation layers.
Presentation β Domain β Data
Domain knows nothing about other layers.
Use Result<T> for error handling:
Future<Result<User>> login(String email, String password) async {
try {
final user = await api.login(email, password);
return Success(user);
} catch (e) {
return Failure(NetworkFailure());
}
}Business logic lives in use cases:
class LoginUseCase extends BaseUseCase<User, LoginParams> {
@override
Future<Result<User>> execute(LoginParams params) {
// Business logic here
}
}# Create feature structure
mkdir -p lib/features/your_feature/{data,domain,presentation}/{datasources,models,repositories,entities,usecases,screens,widgets,providers}Follow the clean architecture pattern:
- Domain: Define entities and use cases
- Data: Implement repositories and data sources
- Presentation: Build UI with screens and widgets
See Feature Development Guide for detailed steps.
dependencies:
# State Management
flutter_riverpod: ^2.5.0
# Networking
dio: ^5.4.0
# Local Storage
shared_preferences: ^2.2.0
hive_flutter: ^1.1.0
# Routing
go_router: ^13.0.0
# Code Generation
freezed: ^2.4.0
json_serializable: ^6.7.0# Run all tests
flutter test
# Run with coverage
flutter test --coverage
# Generate coverage report
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html- Use design tokens for all visual properties
- Follow clean architecture layers
- Use Result type for error handling
- Keep features isolated
- Use context extensions for common operations
- Make layouts responsive
- Write tests for business logic
- Hardcode colors, spacing, or text
- Import from other features
- Throw exceptions in repositories
- Skip error handling
- Assume screen size
- Put business logic in widgets
- Repeat code across features
- β Base classes for UseCase and Repository
- β Result type for error handling
- β Failure types (Network, Server, Validation, etc.)
- β App constants and configuration
- β Design tokens (colors, typography, spacing, breakpoints)
- β Light and dark themes
- β Atomic components (buttons, inputs, text)
- β Responsive layouts
- β Context extensions
- β Home feature with clean architecture
- β Responsive home screen
- β Example of proper layer separation
- β Architecture guide
- β Design system guide
- β Feature development guide
- β Testing guide
- β Best practices
This template is actively maintained. To get updates:
# Add template as upstream
git remote add template https://github.com/divijsahu/flutter-app-template.git
# Fetch updates
git fetch template
# Merge updates (resolve conflicts if any)
git merge template/main --allow-unrelated-historiesContributions are welcome! Please read our Contributing Guide first.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flutter team for the amazing framework
- Clean Architecture by Robert C. Martin
- Atomic Design by Brad Frost
- Flutter community for best practices
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: your.email@example.com
- Add authentication feature example
- Add API integration example
- Add state management examples (Riverpod, Bloc)
- Add routing example with GoRouter
- Add form validation examples
- Add animation examples
- Add testing examples for all layers
- Add CI/CD workflow examples
Built with β€οΈ using Flutter and 2026 Enterprise Architecture principles.
Star β this repo if you find it helpful!