Republics, like Venice and San Marino (oldest Republic still in existence), endured for a millennia.
I'll accept they don't have a good track record for defending themselves from hereditary monarchies. e.g. Nizny Novgorod to Muscovy, Polish-Lithuanian Commonwealth (technically elected monarchy) to Prussia-Russia-Austria.