So, I'm an experienced dev with more than 10 years of experience. I do mostly web development.
Every once in a while, I catch myself obsessing about architecture. It usually goes like this: I got some free time, I start to think that my current code sucks and that I need to rewrite it "the proper way".
This usually means proper separation of concerns, layers, abstractions and what not. I'd go crazy with that. I get troubles sleeping, I get very stressed mainly because I want to do it quick so I could go back to actually adding features and fixing bugs.
This mainly apply to my side projects, as at work I rarely have the luxury to rewrite stuff or introduce big changes. But it's really bothering me. For example right now I have an app that makes some money and I want to scale it by adding more features. But I got caught into this architecture obsession and so I want to rewrite it because right now there are no abstractions whatsoever. HTTP requests comes in, I do raw sql queries and get shit done. But I want to make it nice, have clean architecture, onion architecture, proper domain layer. But none of this matters. It's a one man show, and it works.
And yet, I got stuck in this mode for the past couple of days, and I can't seem to get out of it. The sad thing is that I start the refactor, realize midway that I did not think it through, waste a day of my life, go to sleep, and repeat the same tomorrow thinking that I have found a "better way" to do it, just to make the same mistake again in a different place.
How do I stop being obsessed with software architecture and actually focus on getting shit done?
I found it useful to set deadlines that force me to prioritize features that add value/functionality. Since for me these are just personal projects, I try to add accountability by telling friends "hey, Monday I want to show you this really cool thing I did". This helps sharpen my focus.
Delaying critical decisions in a project is crucial to making good decisions. They'll be made both by someone more informed (after learning all the complicated corner cases of the problem domain) and by a better developer (perhaps a future version of yourself).
Therefore, my advice is to pretend you're a junior developer and do things the most naive way possible. Allow things to stink, to repeat code and to support just what's needed, as if this was the absolute final complete state of the application. This may lead to eventual refactors and this is healthy as the focus will be on correcting existing problems instead of foreseen ones.
This is when you allow your senior knowledge and experience to do what's necessary to return to a state that's comfortable for a junior. It's counterintuitive, but at the scale of a large codebase, the occasional refactors ouweights the time wasted doing preventing design at ever layer. I actually have a similar stance about defensive programming and testing.
Since this might not be enough to appease your brain, keep in mind that abstractions are generalizations trying to encompass some common 80%+ of cases, but they're usually never perfect and leave behind edge cases with additional complexity. Unfortunately, composing abstractions is multiplicative. 80%*80%=64%. Do it enough and your whole application becomes unsupported edge cases, constrainted to fit within interfaces, functions and types not able to adequetly give you the results you want and, so, you go crazy down the rabbit hole, trying to desperately break it down into even more suitable abstractions, like that's going to help.