r/FlutterDev • u/Yezan_350 • 5d ago
Discussion Simple architecture for big apps
Working on a large app that includes features like an AI assistant and offline sync and device integrations and a big content library and payments and more.
Leaning towards a simple feature-first structure to keep the codebase clean and easy to maintain without over-splitting files. Curious how other devs here organize projects like this in production
8
Upvotes
4
u/GeekyAntsBFSI 5d ago
I would go feature-first and keep each feature’s UI, state, and data together. Let one sync module own the queue and retries, while each feature handles its own conflicts. Small adapters around payment and device SDKs keep plugin quirks out of the UI.
1
u/Organic-Cap5345 5d ago
Yes keep the scope lean and clean but have a road map from day 0. That way the core parts can accommodate future changes. Else adding new features later would break many things for existing users
1
u/syedaalishan 5d ago
Feature-first is a good default here. Keep UI, state and data code inside each feature, and only move something to shared when two real features need it. I would give offline sync its own queue and conflict rules, then wrap payments and device SDKs behind small adapters so plugin changes do not spread through the app.
1
u/No_Boss_1911 4d ago
we have kinda the same mix, ai chat plus guided exercises with voice, went feature first too and its been fine. the thing that broke the clean folders for us was a hard rule that chat text never hits disk, so the offline sync queue cant just be one shared thing every feature dumps into. do you give each feature its own queue or one central sync service that features opt out of? and where does the ai assistant live if it needs stuff from the content library, separate feature or core
1
u/chemtrail-organics 4d ago
My preference is layered clean architecture with a presentation, domain, application, data and core layer. Inside each layer are feature driven folders. Dependencies only flow inward from presentation to domain
1
u/Tiny-Manufacturer187 4d ago
Use blc cubit for statement
1
u/Diana_TruthStrategy 2d ago
With riverpod 3 you should remove the application layer. Controller ask directly to Repository. 1-Notifier / AsyncNotifier already is the orchestration layer. 2-Native error & loading handling via AsyncValue.guard (no Result wrapper). 3 Reactive cross-feature sharing beats stateless services. 4- Simpler lifecycle & testing 5-No architectural ambiguity.
1
u/svprdga 5d ago
I always lean towards a strict Clean Architecture, and the more complex the code base, the more sense it makes; in my opinion.
1
u/coding_giraffe 5d ago
I like https://pub.dev/packages/flutter_modular and Bloc