This question about whether clone armies existed prior to the Clone Wars made me wonder if the Galactic Republic in the Star Wars galaxy have any military forces before the Clone Wars. That question is specifically about clone armies by anyone, while mine is about any military force specifically for defending the Republic.
We know its laws did not prevail in Outer Rim systems during the prequel trilogy. Long ago, two separate Sith empires (original and resurgent empires) from the Outer Rim attacked the Republic. The fact that the Republic did not control the entire galaxy and that empires arose multiple times from outside its control should have prompted it to create a defense force. If not, how did it enforce its borders?
The meteoric rise of the Confederacy of Independent Systems showed how vulnerable the Republic was to attack from without and dissension from within. Corporations such as the Trade Federation had their own militaries which they used to flout Republic law. They probably would not be so bold if the Republic had a military or police force to enforce its laws. During the Clone Wars, these corporations sided with the CIS and turned their droid armies against the Republic.
How would the Republic defend itself against rebellions (such as from the CIS) or invasions (such as from Sith empires)?
Answers from EU, Legends, G-canon, or D-canon are acceptable.