It's a real challenge. You really just need someone to tell you "no, do this, don't do that." A lot of things are just wrong in subtle ways or invisible until you hit a certain scale, so you have no idea.
For example, I built my first production application taking a database connection from the pool in middleware and then returning it to the pool at the end of the response. My much more experienced friend looked at my code and told me that connection pools are made for taking out connections and returning them to the pool as soon as you were finished with them. And that I should use timestamptz instead of timestamp. And so much more.
It makes me cringe to think how long I would've gone without figuring out these things had it not been for someone to set me straight early on.
For example, I built my first production application taking a database connection from the pool in middleware and then returning it to the pool at the end of the response. My much more experienced friend looked at my code and told me that connection pools are made for taking out connections and returning them to the pool as soon as you were finished with them. And that I should use timestamptz instead of timestamp. And so much more.
It makes me cringe to think how long I would've gone without figuring out these things had it not been for someone to set me straight early on.