zuraffa 3.20.0 copy "zuraffa: ^3.20.0" to clipboard
zuraffa: ^3.20.0 copied to clipboard

AI first Flutter Clean Architecture Framework and CLI with Result types, UseCase patterns, Dependency Injection and MCP server for building type-safe, scalable apps with AI agents.

πŸ¦’ Zuraffa #

Pub Version License: MIT Documentation

The AI-First Clean Architecture Framework for Flutter.

Zuraffa is a comprehensive toolkit designed to streamline Flutter development by enforcing Clean Architecture principles, ensuring type safety, and integrating seamlessly with modern AI coding assistants via MCP.


πŸ¦„ Why Zuraffa? #

  • πŸ€– AI-Native (MCP): The first Flutter framework with a built-in Model Context Protocol server. AI agents (Trae, Cursor, Windsurf) can understand, generate, and refactor your code with 100% precision.
  • πŸ—οΈ Clean Architecture by Default: Strict separation of Domain, Data, and Presentation layers. No more spaghetti code.
  • πŸ›‘οΈ Type-Safe Everything: Uses Result<T, AppFailure> for error handling. Stop catching exceptions; start matching results.
  • ⚑ Zero Boilerplate: The zfa CLI handles the heavy liftingβ€”UseCases, Repositories, VPCs (View-Presenter-Controller), and Tests are generated in seconds.
  • 🧩 Smart Caching & Sync: Built-in patterns for offline-first apps with configurable cache policies and automatic sync.
  • πŸ§ͺ Mock-Ready: Instant mock data generation for rapid prototyping without a backend.

πŸ€– The AI Advantage (MCP) #

Zuraffa exposes your project structure to AI agents through its MCP Server. This allows AI to:

  • Contextual Generation: "Add a 'PlaceOrder' usecase to the existing 'Cart' domain."
  • Smart Refactoring: "Rename this entity field and update all related layers."
  • Automated Diagnostics: AI can run zfa doctor and fix architectural violations automatically.

To enable, just install Zuraffa. Compatible IDEs will detect the server automatically.


πŸ“¦ Installation #

Add Zuraffa to your pubspec.yaml:

dependencies:
  zuraffa: ^3.19.0

dev_dependencies:
  zuraffa: ^3.19.0
  build_runner: ^2.4.0
  zorphy_annotation: ^1.6.0 # Required for supercharged entities

Activate the CLI globally:

dart pub global activate zuraffa

⚑ Quick Start #

1. Initialize #

zfa init

2. Define an Entity #

Zuraffa uses Zorphy for immutable, type-safe entities.

zfa entity create -n Product --field name:String --field price:double --field stock:int

3. Generate a Feature #

Generate the full stack (Domain, Data, Presentation, Tests) in one go:

# Using Repository/DataSource (Default)
zfa feature scaffold Product --methods=get,getList,create --mock --vpcs --state --test

# Using Service/Provider (Alternative)
zfa feature scaffold Product --methods=get,getList --use-service --mock --vpcs --state --test

4. Granular Control (Make) #

Need just a specific part? Use zfa make:

zfa make Search usecase --domain=search --params=SearchRequest --returns=Listing

5. Build #

zfa build

πŸ› οΈ CLI Power Commands #

Command Description
zfa feature High-level command to generate full feature slices.
zfa make Low-level command for granular generation (UseCases, Mocks, DI, etc.).
zfa entity Create and manage Zorphy entities with field validation.
zfa doctor Lints your architecture and suggests fixes.
zfa build Optimized wrapper for build_runner.

πŸ”„ Revert & Negation #

Smart Revert #

Accidentally added a method or plugin? Use --revert to undo the change. Zuraffa's AST-aware reverter will remove only the specific code added, preserving your manual changes.

zfa make Product usecase --methods=watch --revert

Negatable Flags #

Every boolean flag has a --no- counterpart to explicitly disable features.

zfa feature Product --data --no-zorphy # Generate data layer but skip Zorphy

πŸ“‚ Project Layout #

lib/src/
β”œβ”€β”€ data/           # Models, DataSources, Repository Impls
β”œβ”€β”€ domain/         # Entities, Repository Interfaces, UseCases
β”œβ”€β”€ presentation/   # VPC (View, Presenter, Controller, State)
└── di/             # Automated Dependency Injection (GetIt)

🌐 Learn More #

Made with πŸ¦’ and ⚑️ by Arrrrny.

2
likes
50
points
605
downloads

Documentation

Documentation

Publisher

verified publisherzuzu.dev

Weekly Downloads

AI first Flutter Clean Architecture Framework and CLI with Result types, UseCase patterns, Dependency Injection and MCP server for building type-safe, scalable apps with AI agents.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#clean-architecture #state-management #dependency-injection #architecture #code-generation

License

MIT (license)

Dependencies

analyzer, args, code_builder, dart_style, flutter, get, get_it, glob, go_router, hive_ce_generator, http, json_annotation, json_serializable, logging, meta, opentelemetry, path, provider, responsive_builder, uuid, zorphy, zorphy_annotation

More

Packages that depend on zuraffa