r/FlutterDev • • 4d ago

Discussion How do you finally settle on a project architecture?

I've spent over 120 hours this month working on my project architecture, creating around 200 different drafts. I understand the concepts, but I keep doubting my decisions and worrying that I've missed something important.

I'd really appreciate advice from experienced developers. How do you know when it's time to commit and stop second-guessing?

5 Upvotes

10 comments sorted by

6

u/surrealdente 4d ago

There’s no “best” - you just need to find a balance that works for you. Ideally a directory carries files specific to its features when possible. The moment a feature touches multiple directories you will have to make compromises.

1

u/SuEzAl 1d ago

He is right OP. and remember there is always some trade-off with any architecture.

1

u/davidbalbino 4d ago

tbh 200 drafts means the problem is not the architecture anymore, it's that no real code is pushing back on it. pick the simplest thing that works (feature folders + riverpod + go_router is totally fine) and build 2 or 3 real features with it. the stuff you're worried you missed only shows up when you actually ship, not on paper. and it's ok to refactor later, every project I've worked in 16 years ended up changing its structure at some point lol

1

u/kuarasoft 4d ago

200 drafts in 120 hours means the drafts have stopped teaching you anything, because a structure only gets tested once real screens, state and API calls have to live in it. I'd pick the simplest version you have, build one feature fully end to end, and refactor only when something actually hurts, like a small change that makes you touch five files. Moving folders and splitting layers is cheap this early, so a wrong call now costs you an afternoon later, while another week of drafting costs you the whole week.

1

u/Academic_Crab_8401 4d ago

Easy to change is always better than looks solid from the beginning. You go with one that doesn't lock you in and require least amount of effort to change. So naturally a leaner dependency is also good.

1

u/ug00gu 3d ago

Feature folders with one rule: a feature never imports another feature's internals. If two features need the same thing, it moves up to a shared folder. You only find out what's shared by building, so I wouldn't try to decide it up front.

1

u/GeekyAntsBFSI 1d ago

Pick the simplest draft and build one real Flutter feature with an API call, loading and error states, and a test. If you can follow the data flow and change the feature without touching half the app, stick with it. A second feature will tell you more than another architecture draft.

0

u/VisualRope8367 4d ago

Riverpod and go router does most of things