flutter create gives you a skeleton, not an architecture. The first decision that outlives every other one is how you organize your folders. There are two common answers.
Layer-first: group by technical role
lib/
models/
user.dart
order.dart
views/
login_page.dart
orders_page.dart
controllers/
auth_controller.dart
orders_controller.dart
Everything of one kind lives together. It feels tidy with five screens.
Feature-first: group by what the app does
lib/
features/
authentication/
data/
state/
ui/
user_profile/
data/
state/
ui/
orders/
data/
state/
ui/
shared/
Each folder under features/ holds the UI, state and repository for one feature.
Why feature-first scales better
For large production apps, organizing by feature scales better than organizing by technical function. Three reasons from the source article:
- It isolates domain logic. The code for one feature sits together, so it is easier to test and refactor.
-
Parallel work is easier. You can assign a feature to one developer or one pod without both editing the same
models/folder. - Onboarding is faster. A new developer knows where to find the UI, state and repository for any feature. That lowers the cognitive load of joining an existing codebase.
The problem it prevents: architecture drift
Without something enforcing the rules, patterns get applied inconsistently across modules. A project that starts as Clean Architecture can slide into a tightly coupled mess as deadlines loom. Relying on individual discipline for structural consistency is fragile, because the foundation depends on one person's mood and experience.
You can't make a folder layout enforce itself, but you can add a house rule that is easy to check in code review:
A feature may import from its own folder and from
shared/. It may not import from another feature'sui/orstate/.
If two features need the same thing, move it to shared/. That one rule is what keeps feature folders independent.
Decisions to make before you start
A manual setup also means choosing everything else the folder structure touches:
- State management. Riverpod is often picked for compile-time safety and easy provider overriding in tests. BLoC is often mandated in strict enterprise settings because it forces a separation of concerns through event streams. Provider covers basic dependency injection.
- Backend adapters. Firebase gives a NoSQL document store that is fast but awkward to query across related data. Supabase gives a managed PostgreSQL backend with relational schemas, joins and row-level security.
- Routing. AutoRoute versus GoRouter, plus route guards for authenticated screens.
- Design system. Material 3 or Cupertino.
Wiring these by hand is where the hours go. The source article puts manual project setup at 4 to 12 hours of high-concentration engineering time. Whatever you choose, write the choices down once and reuse them, so every new project starts from the same line.
The generated-code trade-off
Project generators and templates can start you at the same place every time, and the output is predictable. But you inherit and maintain every line they generate from day one. If a bug sits in a generated network interceptor, you have to be able to trace it. Prefer starting points built on documented, standard pub.dev packages rather than hidden wrappers, so the learning curve stays the same as regular Flutter.
What to do today
- Pick feature-first for anything you expect to grow past a handful of screens.
- Give each feature
data,stateanduifolders, and keep oneshared/for cross-feature code. - Write the one-line import rule in your README.
- Choose state management, backend, routing and design system once, and record them.
Further reading: FlutterSeed vs manual setup: a practical comparison
How is your current Flutter project organized, and would you change it if you started again?
Top comments (0)