Until the French Revolution in 1789 , Lucca was independent from Venice and Genoa . It was a city controlled by democracy or sometimes by oligarchy .
Lucca managed , at first as a democracy , and after 1628 as an oligarchy , to maintain its independence alongside of Venice and Genoa , and painted the word Libertas on its banner until the French Revolution in 1789 .