๐ฏ flutter_blueprint
Enterprise-grade Flutter app scaffolding CLI โ generates production-ready Flutter projects with 43+ professional files, complete architecture, and best practices.
๐ฑ Note: CLI runs on desktop (Windows/Linux/macOS) to generate Flutter projects that support all platforms (Android, iOS, Web, Desktop).
๐ What's New in v2.0
Major architectural improvements and production-ready features:
| Enhancement | Description |
|---|---|
| ๐ฅ Complete Features | Auth, Profile, Settings with full UI - zero placeholders |
| ๐ Smart Home Screen | API-connected with pagination, caching, pull-to-refresh |
| ๐ Full Authentication | Login, Register, Token management, Auto-login, Secure storage |
| ๐ค Profile Management | View, Edit profile, Avatar upload, Offline-first caching |
| โ๏ธ Settings System | Theme switcher, Notifications, Biometrics, Account management |
| ๐ Enterprise Security | OWASP-compliant headers, certificate pinning, SSRF prevention |
| ๐ฆ Rate Limiting | Client-side protection (60 req/min per endpoint) |
| ๐พ Smart Caching | SharedPreferences + JSON serialization with error recovery |
| ๐๏ธ Architecture Refactor | Result types, command pattern, DI container |
| โ Testing | 334 tests passing, 62.88% coverage |
See CHANGELOG.md for complete details.
๐ Quick Start
Installation
# Windows (PowerShell)
iex (irm 'https://raw.githubusercontent.com/chirag640/flutter_blueprint-Package/main/scripts/install.ps1')
# macOS / Linux
dart pub global activate flutter_blueprint
Create a Project
# Interactive wizard (recommended)
flutter_blueprint init
# Quick mode with options
flutter_blueprint init my_app --state riverpod --api --theme --tests
โจ Key Features
| Category | Features |
|---|---|
| Architecture | Clean architecture, 60+ files, feature-based structure |
| Complete Features | Home (API + pagination), Auth (login/register), Profile (view/edit), Settings (theme/prefs) |
| State Management | Provider, Riverpod, or Bloc |
| API Layer | Dio + Auth/Retry/Logger/Security/RateLimit interceptors, Universal API Configurator |
| Storage | LocalStorage + SecureStorage + Hive caching with JSON serialization |
| Security | OWASP headers, error sanitization, SSRF prevention, certificate pinning, rate limiting |
| UI Components | Theme system, reusable widgets, Material 3 |
| DevOps | GitHub Actions, GitLab CI, Azure Pipelines |
| Extras | Pagination, Analytics, Security utilities, i18n |
๐ฏ Production-Ready Features
When you generate a project with --api flag, you get complete working features with zero placeholders:
๐ Home Feature
- API Integration: Real data from JSONPlaceholder demo API
- Pagination: Load more with infinite scroll
- Caching: 1-hour TTL with offline-first pattern
- UI: Pull-to-refresh, loading states, error handling
๐ Authentication Feature (with --api)
- Login & Register: Complete forms with validation
- Token Management: JWT access + refresh tokens, secure storage
- Auto-login: Checks auth status on app startup
- UI: Beautiful login/register pages, error messages, loading states
๐ค Profile Feature (with --api)
- View Profile: Display user info with avatar
- Edit Profile: Update name, bio, phone, location
- Avatar Upload: Image picker integration (demo mode)
- Caching: Offline-first with 1-hour TTL
โ๏ธ Settings Feature (always included)
- Theme Switcher: Light, Dark, System modes
- Notifications: Toggle push notifications
- Biometrics: Enable/disable biometric login
- Account: Profile link, Logout (if auth enabled)
- About: Version, Terms, Privacy Policy
- Data Management: Clear all cached data
๐ Security Features (v2.0+)
flutter_blueprint generates enterprise-grade security out of the box:
๐ก๏ธ Security Headers
- X-Content-Type-Options: Prevents MIME-sniffing attacks
- X-Frame-Options: Clickjacking protection (DENY)
- X-XSS-Protection: Legacy XSS protection layer
- Strict-Transport-Security: Forces HTTPS (1 year + subdomains)
- Cache-Control: Prevents sensitive data caching
๐ Certificate Pinning
Prevent MITM attacks with SHA-256 fingerprint validation:
final dio = ApiClient(
baseUrl: 'https://api.example.com',
certificatePins: ['sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='],
).dio;
๐ฆ Rate Limiting
Client-side protection with 60 requests/minute per endpoint:
- Automatic retry-after calculation
- Rolling window tracking
- Prevents API abuse
๐งน Error Sanitization
Security interceptor automatically removes:
- File paths (Windows/Unix)
- IP addresses (IPv4/IPv6)
- Long tokens (32+ characters)
- SSRF prevention (blocks localhost in production)
โ Security Validation
Built-in security audit helper:
final result = SecurityConfig.checkSecurityConfiguration(dio);
print('Security checks: ${result.passed} passed, ${result.issues.length} issues');
๐ ๏ธ CLI Commands
init - Create New Project
flutter_blueprint init <app_name> [options]
| Flag | Description |
|---|---|
--state <choice> |
State management: provider, riverpod, bloc |
--platforms <list> |
Target: mobile, web, desktop, all |
--ci <provider> |
CI/CD: github, gitlab, azure |
--api |
Include API client (prompts for backend type) |
--theme |
Include theme system |
--env |
Include environment config |
--tests |
Include test scaffolding |
--hive |
Include Hive offline caching |
--pagination |
Include pagination support |
--analytics <provider> |
Analytics: firebase, sentry |
--security <level> |
Security: basic, standard, enterprise |
๐ API Backend Presets
When --api is enabled, choose from built-in presets:
- Modern REST - HTTP 200 + JSON data
- Legacy .NET - success: true/false pattern
- Laravel - data wrapper, message field
- Django REST - results array, detail errors
- Custom - manual configuration
add feature - Add Features to Existing Project
flutter_blueprint add feature <name> [--api] [--no-data] [--no-domain]
๐ Generated Structure
my_app/
โโโ lib/
โ โโโ main.dart
โ โโโ app/app.dart
โ โโโ core/
โ โ โโโ api/ # API client + interceptors
โ โ โโโ config/ # App config + env loader
โ โ โโโ errors/ # Exceptions + failures
โ โ โโโ routing/ # Router + guards
โ โ โโโ storage/ # Local + secure storage
โ โ โโโ theme/ # Colors, typography, themes
โ โ โโโ utils/ # Logger, validators, extensions
โ โ โโโ widgets/ # Reusable UI components
โ โโโ features/ # Feature modules
โโโ test/ # Test scaffolding
โโโ pubspec.yaml
๐พ Data Layer Features (v2.0+)
Smart Caching
Production-ready cache implementation with SharedPreferences:
// Auto-generated cache methods
final items = await localDataSource.getCached(); // Returns List<T> or null
await localDataSource.cache(items); // JSON serialization
await localDataSource.clearCache(); // Clear cache
- Automatic JSON serialization/deserialization
- Error recovery (auto-clears corrupted cache)
- Type-safe operations
Auth Token Management
Flexible token handling with callback-based interceptors:
final dio = ApiClient(
baseUrl: 'https://api.example.com',
getToken: () async => await storage.getToken(),
refreshToken: () async => await authService.refresh(),
).dio;
- Automatic 401 handling with token refresh
- Request retry after refresh
- Works with any auth strategy (OAuth, JWT, custom)
Offline Sync
Hive-based offline support with API synchronization:
- Queue changes while offline
- Auto-sync when connection restored
- Conflict resolution strategies
๐ค Team Collaboration
Share configurations across your team:
# Import team config
flutter_blueprint share import ./company_standard.yaml
# Create project from config
flutter_blueprint init my_app --from-config company_standard
๐ Documentation
- Architecture Guide - Deep dive into v2.0 architecture
- Example Usage - Programmatic API examples
- Contributing Guide - How to contribute
- Changelog - Version history
๐ License
MIT License - see LICENSE
๐ฌ Support
- ๐ง Email: chaudharychirag640@gmail.com
- ๐ GitHub Issues
- ๐ฌ Discussions
Made with โค๏ธ for the Flutter community โญ