First of all,
Unless you play 10hrs a day steady It's really important to upgrade every single thing before going up a townhall.
I mean everything, including walls, troops, everything offence and defence wise.
Then, when going up a townhall it changes a bit what you do first, also depends on the amount of builders you have.
Really important to upgrade quick are your Laboratory and Army camps. Offence is 90% of this game so being up to par with new troops and levels is really important, they decide how much loot you can steal from others.
Build all the new buildings you get from your new townhall, then redesign your village to one for your new townhall.
By then you just slow and steady upgrade splash defences first throwing excess gold into walls. When splash is done go to point defences and upgrade other stuff like clan castle spell factory and depending on your level barracks.
Teslas and Air defence can be put as a last upgrade as theyre not too important early on. DO upgrade them eventually though before moving to a new townhall. They'll become one of the most important defences in the game in a later stage and having a too low leveled Air Defence will mess you up BIG time later on.
Side note, your base layout is really important as well. Saving resources if you can't spend them all is what you do every single time you close the game so protecting them is key.
Unless you're a Clash God ánd an architect don't design your own fkn base. Google around a bit or browse the clash of clans forums will give you a shit ton of awesome and well protecting bases for your exact townhall level.
Hell if you are all too lazy just name your townhall level and i'll post some good base designs here that you can all copy. They really benefit.
Good luck and have fun