Regions with lots of free, mercantile cities like Italy and the Low Countries tended to have pretty tough and confident citizen militias too. Plus well fortified cities on the side - I understand the burghers regarded being able to fight in defense of their homes and shops something of a privilege and a matter of fierce pride, and not in the least (and quite correctly) as an important symbol of their relative freedom from the feudal order. City walls were something of a prestige item besides a practical defensive measure - you weren't a proper freetown if your city walls weren't as formidable as the budget allowed.

That said, they tended to have the funds to be able to hire mercenaries as needed too, and to act as cadres and standing garrisons in peacetime.

'Course, even the free cities were usually at least theoretically subject to one feudal lord or another, and were obliged to pay for their privileges with funds and usually also at least limited military service when needed; in practice the barons tended to have to deal with them more or less as equals, not in the least as trying to press matters by force against the wealthy, proud and well fortified towns wasn't the most prudent internal policy available...