๐ŸŽฏ flutter_blueprint

Enterprise-grade Flutter app scaffolding CLI โ€” generates production-ready Flutter projects with 43+ professional files, complete architecture, and best practices.

Pub Version Pub Points Pub Likes License: MIT Flutter 3.38+ Dart 3.5+

๐Ÿ“ฑ 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

๐Ÿ“„ License

MIT License - see LICENSE

๐Ÿ’ฌ Support


Made with โค๏ธ for the Flutter community โญ

Libraries

flutter_blueprint