Short answer: As continuously existing modern-ish republics, with elements of direct democracy, many Swiss cantons are arguably a few hundred years older than San Marino.
Long Answer: It would depend how you define republic, for one. I wouldn’t count Athens because it was quite literally not a republic, and Plato conceptualized his republic of philosopher-king rulers as a reaction to Athens. Being based on the notional Roman republic is another extreme, leaving you with notionally few republics today. The modern definition seems to have settled on something including but not entirely ruled by direct democracy, and lacking de jure hereditary rule – which is fine, but then you must consider Great Britain is not a republic, while Iran is.
I think San Marino’s republican government could only have said to have fully come into existence in the 16th century or so.
Italian city-states and maybe some chartered German city-states are also older, but that uses a more broad definition of republic that maybe isn’t quite what people mean these days. They tended to be more authoritarian, ruled by privileged elites, even if those elites were sometimes burgers (cf. bourgeois, the “free” urban dwelling “middle class”) rather than aristocracy.