The origin of the parties actually comes from the federalist and anti-federalist movements and the emphasis of the discussion, with Hamilton, John Jay and Jefferson on the side of Federalism. Federalism was the most influential political movement arising out of discontent with the Articles of Confederation, which focused on limiting the authority of the federal government. For example, the Articles allowed the Continental Congress the power to sign treaties or declare war, but it was essentially powerless to do so because all major decisions required a unanimous vote. The problems of the Articles of Confederation accounted for the changes effected in the Constitution. Those opposed to the new Constitution became known as the "Anti-Federalists". They generally were local rather than cosmopolitan in perspective, oriented to plantations and farms rather than commerce or finance, and wanted strong state governments and a weak national government. The Anti-Federalist critique soon centered on the absence of a Bill of Rights, which Federalists promised to provide. The rights of individuals became important to preserve, and a great compromise was struck, and the parties disbanded. The Federalist party arose almost immediately. This party was based on the policies of Alexander Hamilton and his allies for a stronger national government, a loose construction of the Constitution, and a mercantile (rather than agricultural) economy. As time progressed, the factions which adhered to these policies organized themselves into the nation's first political party, the Federalist Party, and the movement's focus and fortunes began to track those of the party it spawned. The Democratic-Republican Party, the opposition to the Federalist Party, emphasized the fear that a strong national government was a threat to the liberties of the people. They stressed that the national debt created by the new government would bankrupt the country, and that federal bondholders were paid from taxes paid by honest farmers and workingmen. This party later morphed into the Democrat party, and the Republican party formed during the push toward emancipation and the election of Abraham Lincoln. For more information, see here: http://en.m.wikipedia.org/wiki/Federalism_in_the_United_States#section_5
The parties have almost nothing to do with the meanings of the words anymore. I'll answer based on the meanings of the words. A republic is a government in which representatives vote on issues. A democracy is a government in which every citizen votes on the issues. The US is a democratic republic in which citizens vote to elect representatives to vote on issues.