flutter_archx 2.2.0 copy "flutter_archx: ^2.2.0" to clipboard
flutter_archx: ^2.2.0 copied to clipboard

A production-ready CLI tool to scaffold enterprise-grade Flutter projects with a scalable, clean architecture template featuring GetX state management, Dio networking, secure storage, and modular feat [...]

flutter_archx #

pub package License: MIT

A CLI that scaffolds production-ready Flutter projects with clean architecture — and asks you what you actually need first.

Pick a preset or hand-pick your screens, then pick a theme color. The routing files, pubspec.yaml, navigation drawer, and theme are all generated from that selection, so you never start by deleting code you didn't want.

Then keep using it: add feature scaffolds new screens and wires their routes in for you.

Installation #

dart pub global activate flutter_archx

Commands #

Command What it does
flutter-arch create Scaffold a new project (interactive by default)
flutter-arch add feature <name> Add a screen to an existing project and register its route

create #

flutter-arch create

Walks you through seven steps and shows a summary before writing anything:

▸ Step 1 — Project name
? Project name: my_app

▸ Step 2 — Organization
? Organization (reverse domain): (com.mycompany)

▸ Step 3 — Description
? Project description: (A new Flutter project built with enterprise architecture.)

▸ Step 4 — Template preset
? Which preset do you want to start from?
❯ ◉  Starter      Splash, onboarding, auth, home, profile, settings
  ◯  Minimal      Splash + Home only
  ◯  Enterprise   Everything: starter + tab shell + CRUD module + tooling
  ◯  Custom       Choose features and add-ons yourself

▸ Step 5 — Features        (Custom only — space to toggle, Enter to confirm)
▸ Step 6 — Add-ons         (Custom only)

▸ Step 7 — Theme color
? Which theme color should the app use?
❯ ◉  Monochrome   #111111   Black and white on a pure white background
  ◯  Blue         #2563eb   Blue with a violet secondary
  ◯  Indigo       #4f46e5   Deep indigo
  ◯  Custom…                Enter your own hex code

▸ Step 8 — Local storage
? Which package should back local storage?
❯ Hive CE    Fast pure-Dart key-value boxes (default)
  Drift      Typed SQLite ORM, ready for relational tables
  sqflite    Plain SQLite with hand-written SQL

▸ Step 9 — Extras          git init? pub get?

── Summary ─────────────────────────────
  Project       my_app
  Organization  com.mycompany
  Preset        Starter
  Initial route /splash
  Features (8)  Splash Screen, Onboarding Slides, Login, ...
  Add-ons (3)   Theme Switcher, Offline Banner, Project Documentation
  Theme color   Monochrome (#111111)
  Storage       Hive CE
────────────────────────────────────────
? Create this project? (Y/n)

Your organization, theme color, and storage backend are remembered in ~/.flutter_archx.json and pre-fill the prompts next time. Unattended runs ignore them and stay deterministic.

Non-interactive #

Any flag you pass skips its question. --yes skips all of them.

# Starter preset, no questions asked
flutter-arch create my_app --yes

# A specific preset
flutter-arch create my_app --preset enterprise --org com.mycompany --yes

# Exactly the screens you want
flutter-arch create my_app --features splash,login,home --add-ons theme_switcher --yes

# Your brand color instead of the default black and white
flutter-arch create my_app --color teal --yes
flutter-arch create my_app --color "#0f766e" --yes

# SQLite instead of the default Hive CE
flutter-arch create my_app --storage drift --yes
flutter-arch create my_app --storage sqflite --yes

# See every valid id
flutter-arch create --list

Options #

Option Description Default
--org, -o Organization identifier (reverse domain) com.example
--description, -d Project description (auto)
--preset, -p minimal, starter, enterprise, custom starter
--features, -f Comma-separated feature ids, or all from preset
--add-ons, -a Comma-separated add-on ids, all, or none from preset
--color, -c Palette name or hex code (see Theme colors) mono
--storage, -s hive_ce, drift, or sqflite (see Local storage) hive_ce
--list Print every preset, feature, add-on, and theme color, then exit —
--yes, -y Skip all prompts false
--no-git Skip git init (git runs)
--no-pub-get Skip flutter pub get (pub get runs)

Presets #

Preset Contains
minimal Splash + Home
starter Splash, onboarding, login, register, forgot password, home, profile, settings
enterprise Everything: starter + tab shell + notifications + CRUD module + all add-ons
custom Hand-pick features and add-ons

Features #

Id Screen
splash Branded launch screen that routes based on auth state
onboarding Swipeable intro pages, shown only on first launch
login Email and password sign-in with validation
register Account creation form with password confirmation
forgot_password Password reset request with success state
home Landing screen with pull-to-refresh and summary cards
main_shell Bottom-navigation shell hosting your selected tabs
notifications Notification inbox with read/unread state
profile User profile with editable fields and sign-out
settings Theme mode, language, and notification preferences
crud Full module: list, search, pagination, detail, create/edit, delete

Dependencies are resolved for you — picking register pulls in login, and picking main_shell pulls in home.

Add-ons #

Id What you get
theme_switcher Light/dark toggle persisted across restarts
localization GetX translations with English + Arabic (RTL) samples
connectivity Global connectivity listener with a no-internet banner
image_cache Cached network image widget with shimmer placeholders
flavors main_dev / main_staging / main_prod + VS Code launch configs
tests Validator, repository, and mocktail-based controller tests
ci GitHub Actions running format, analyze, and test
docs README.md and docs/ARCHITECTURE.md for the generated project

Theme colors #

--color sets the palette written into lib/app/theme/app_colors.dart. The default is mono — black on a pure white background, inverting to white on near-black in dark mode.

Id Primary Look
mono #111111 Black and white on a pure white background (default)
blue #2563eb Blue with a violet secondary (the pre-2.1 default)
indigo #4f46e5 Deep indigo
teal #0d9488 Calm blue-green
green #16a34a Fresh green
purple #7c3aed Vivid violet
orange #ea580c Warm orange
red #dc2626 Bold red

Any hex code works too — --color "#0f766e", --color 0f766e, or the shorthand --color "#4af". Tints, shades, the 50–900 swatch, a hue-rotated secondary, and readable button foregrounds are all derived from it.

Only the brand colors change. success, warning, error, and info stay colorful in every palette, because a red error reads faster than a brand-tinted one. Everything lands in plain Color constants, so editing the palette by hand afterwards stays a one-file job.

Local storage #

--storage picks the package behind lib/core/storage/local_storage.dart, the wrapper used for non-sensitive data such as preferences and cached responses. Sensitive data always goes through SecureStorage (flutter_secure_storage).

Id Package Notes
hive_ce hive_ce Default. Pure-Dart key-value box, no native setup
drift drift SQLite ORM. Ships a hand-written key-value table, so no build_runner step before the first build
sqflite sqflite Plain SQLite with hand-written SQL

Every backend generates the same LocalStorage API — read<T>(), write(), remove(), clearAll(), hasKey() — so the rest of the project doesn't change with the choice. bootstrap() awaits LocalStorage.init() before the first frame. The SQL backends load their table into memory there, which keeps read synchronous. LocalStorage.database gives you the underlying database when you want your own tables.

add feature #

Adding a screen normally means creating five files and hand-editing app_routes.dart and app_pages.dart. This does all of it:

cd my_app
flutter-arch add feature reports
🧩 Adding feature "reports" to my_app

✓ lib/features/reports (5 files)
✓ Route /reports registered in app_routes.dart and app_pages.dart

   Navigate to it with:
   Get.toNamed(AppRoutes.reports);

What it creates and edits:

lib/features/reports/
├── bindings/reports_binding.dart      created
├── controllers/reports_controller.dart created
├── views/reports_view.dart             created
├── models/                             created
└── widgets/                            created

lib/app/routes/app_routes.dart          + static const String reports = '/reports';
lib/app/routes/app_pages.dart           + imports and the GetPage entry

Names are normalised for you — flutter-arch add feature "Audit Log" produces the folder audit_log, the route /audit-log, and the class AuditLogView.

Imports are inserted in alphabetical order so directives_ordering stays quiet. If the routing files have been restructured and the anchors can't be found, they are left untouched and the exact snippet to paste is printed instead.

Options #

Option Description Default
--no-route Create the files only, skip route registration (route is registered)
--path Route path to register, e.g. --path /admin/reports /<feature-name>

Generated architecture #

lib/
├── main.dart              # calls bootstrap(Flavor.dev)
├── bootstrap.dart         # single startup path for every entry point
├── app/
│   ├── app.dart
│   ├── routes/            # generated from your selection — no dead routes
│   ├── bindings/
│   ├── config/            # environment, flavors, runtime config
│   └── theme/             # colors, typography, dimensions
├── core/
│   ├── constants/  enums/  errors/  exceptions/
│   ├── extensions/  helpers/  utils/  validators/
│   ├── network/           # Dio client, interceptors, endpoints
│   ├── storage/           # secure + local storage wrappers
│   └── services/          # auth, logging, notifications
├── data/                  # models, datasources, repository impls
├── domain/                # entities, repository contracts, usecases
├── features/              # one folder per selected screen
└── shared/                # widgets, components, dialogs, layouts

Each feature folder follows the same shape:

lib/features/<name>/
├── bindings/      # registers the controller with GetX
├── controllers/   # state and behaviour (GetxController)
├── models/        # feature-local data shapes
├── views/         # screens (GetView<Controller>)
└── widgets/       # widgets used only by this feature

Stack #

  • GetX — state management, routing, dependency injection
  • Dio — HTTP client with auth, retry, and logging interceptors
  • Hive CE (or Drift / sqflite) + FlutterSecureStorage — local and secure persistence
  • Clean Architecture — app, core, data, domain, features, shared

Requirements #

  • Dart SDK >=3.5.0
  • Flutter SDK installed and available in PATH

Contributing #

Contributions are welcome! Please open an issue or submit a pull request.

License #

MIT License — see LICENSE for details.

1
likes
140
points
385
downloads

Documentation

API reference

Publisher

verified publisherineelakandan.in

Weekly Downloads

A production-ready CLI tool to scaffold enterprise-grade Flutter projects with a scalable, clean architecture template featuring GetX state management, Dio networking, secure storage, and modular feature-based structure.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

args, mason_logger, path

More

Packages that depend on flutter_archx