My husband and I have an incredibly good relationship, what it took was understanding each other and having open communication. The problem is, not everyone is good at it. It definitely took us a good 3 years living together before we got it down, and we knew each other for nearly 10 years before that as teens. (Funnily enough, we also met online. Not dating, just a random encounter on omegle before usernames were a thing. I don't remember the exact date so I'm rounding)
I think the hardest thing was figuring out when and where it was okay to bring up gripes and frustrations. Now, we do it before it becomes much of an issue, but before, we were waaaay too scared to bring it up. It's also a careful balancing act of knowing when to give in in an arguement, and let's be real, average person also isn't good at it, we sure as fuck weren't.
What I think helped the most was that we were best friends first and a relationship second. Even now, I will say he's both my soul mate and best friend. We're nearing 10 years married and known each other for 20 or so.
Relationships are a lot of work, both sides need to be willing to do a lot. Both of us want to be a better version of ourselves for the other and be willing to help each other.