Medieval Europe was well on the way there from the 12th century onwards.
Communalist movements established autonomous municipal political bodies with their own sets of (often regionally co-ordinated or at least overlapping) laws, and their liberties were enshrined by increasingly impotent monarchs as "city rights" - or, in other places, they were fully independent with no power above them.
The epicentre of this medieval revolution was the Holy Roman Empire, where central power progressively decayed, and within the HRE, Northern Italy was a forerunner. But the wave transformed parts of France and Spain, the Low Countries, the Alpine regions, and various (other) German-speaking regions.
By the 14th and 15th centuries, there were two competing models on the threshold of modern statehood:
the one we're used to now, because it emerged victorious: territorial monarchies with centralising administrations,
and another one, which had emerged from the association of "free cities", and which took the form of leagues of city states or similar small communal republics: the Hanseatic League and the Old Swiss Confederacy are ones which everybody knows, but there were countless other such leagues all over the place, from the Swabian League to various Iberian "hermandades".
The two models inevitably came to loggerheads, and the struggle had to be decided in one direction or the other, for both models rivalled for control in the same spaces and frameworks. The struggle was ultimately mostly decided in favour of the absolute territorial monarchies who undermined the autonomy of their municipalities step by step and accumulated such immense powers that no league of cities was able to contend with. When the French Revolution and bourgeois nation-states came around, they only kicked in the crumbling facades of a few left-over municipal autonomies in the name of clearing away "feudalist relics". The communalist movement had, of course, not been entirely defeated: local assemblies and elected mayors overseeing municipal self-organisation have persisted in much of Europe and been exported, in the overall "modern territorial state package", to much of the rest of the world. But its model was subordinated to the other, territorial one.
If you want the city state / city league model to prevail, you need to look at a few pivotal points in the 15th and 16th centuries: the final decades of the Hundred Years War for France, but most of all the discovery and subjugation of much of the Americas by two centralising monarchies (four, if you count the late comers England/Britain and France, too).
Of course city states and their leagues would have to adapt profoundly in that TL, just like territorial monarchies did in ours, and ultimately even morphed into territorial republics, at least many of them. But that would be an interesting TL to explore. Its sheer amplour is incredible, which is why it's probably never getting written. I remember reading a TL about defiant Spanish cities preventing a centralisation of power in the Castilian-Leonese crown, that was fairly thrilling, but I don't remember the name anymore.