The other answers don't address the basic question of whether the Federation is a democracy, so I just wanted to point out that in the TOS episode "Errand of Mercy", we do get confirmation that it is, in the following exchange between Captain Kirk and Klingon Commander Kor:
KIRK: Something was destroyed? Nothing inconsequential, I hope.
KOR: Hardly. They were quite important to us, but they can be replaced. You of the Federation, you are much like us.
KIRK: We're nothing like you. We're a democratic body.
And in the Deep Space Nine episode "Once More Unto The Breach", we meet with an aged Kor, who tells Worf "Worf, you've been living among this democratic rabble for too long", which seems to indicate the Federation is still democratic in this period.
In addition, we know from Star Trek IV: The Voyage Home that the Federation had a deliberative body called the "Federation Council":
The Memory Alpha article mentions a number of episodes that have referenced this Council. In the Deep Space Nine episode "Homefront" it was confirmed that the Federation President at the time, Jaresh-Inyo, had been elected to the position:
JARESH-INYO: I never sought this job. I was content to simply represent my people on the Federation Council. When they asked me to submit my name for election, I almost said no. Today I wish I had.
And in the Deep Space Nine episode "Paradise Lost" when Admiral Leyton hoped to oust Jaresh-Inyo and give Starfleet direct command of the Federation, Sisko objected that this would make the Federation into a military dictatorship, which seems to indicate that under the existing system Starfleet was under the command of elected leaders:
SISKO: Admiral, do you realise what's going on here? Even if you win, even if you do manage to oust Jaresh-Inyo, you still lose. We all lose.
LEYTON: I can't say I agree with you.
SISKO: Do you think other Federation worlds are going to sit back and let their President be replaced by a military dictatorship?
LEYTON: Hardly a dictatorship, Ben.
SISKO: Overthrowing a legitimately elected President and giving Starfleet direct control over the government? It sounds like a dictatorship to me, and I'm sure I'm not the only one who thinks so.
The Next Generation episode "The Perfect Mate" also gives onscreen confirmation that the Federation is a constitutional democracy, with provisions for the "fundamental rights" of individuals, which precluded treating sentient beings as property:
RIKER: You mean you're using this ship to transport a sentient being as property?
BRIAM: Not as property, as a gift, and I was concerned that you might not entirely understand.
PICARD: Your concern was justified, Ambassador.
KAMALA: You're angry. Why?
PICARD: There is a provision in the Federation Constitution that protects an individual's fundamental rights.
In the TNG episode "The Drumhead" we learn that another "fundamental principle" of the Constitution was the "Seventh Guarantee", which apparently dealt with the right to refuse to answer certain questions in court:
WORF: But we know there is a traitor here. J'Dan has admitted his guilt.
PICARD: That's true, and he will stand for his crimes.
WORF: Tarses has all but done the same.
WORF: He refused to answer the question about his Romulan grandfather.
PICARD: That is not a crime, Worf. Nor can we infer his guilt because he didn't respond.
WORF: Sir, if a man were not afraid of the truth, he would answer.
PICARD: Oh, no. We cannot allow ourselves think that. The Seventh Guarantee is one of the most important rights granted by the Federation. We cannot take a fundamental principle of the Constitution and turn it against a citizen.
When the Federation was first founded in 2161, a document called the Charter of the United Federation of Planets was ratified (not to be confused with the Starfleet Charter, since as noted above they are distinct organizations). The Memory Alpha article comments on the uncertain relation between the Charter and the Constitution:
The relationship between the Constitution of the United Federation of Planets and the Federation Charter is unclear. Both contain rights for individuals; as Sisko put it in DS9: "Accession": "caste-based discrimination goes against the Federation Charter". It is most likely that the Charter describes the requirements for entry of a planet into the Federation (e.g., no entry if caste-based discrimination is in place), while the Constitution describes the principles, governing structure, and citizen rights once becoming a member (e.g., rights against self-incrimination).
Part of the Charter was visible in the Voyager episode "The Void", and the Memory Alpha article notes that it's a rewording of the United Nations charter (as are the "Articles of Federation" from the non-canon-but-influential Star Fleet Technical Manual quoted in @Valorum's answer):
CHARTER OF THE UNITED FEDERATION OF PLANETS
"We the lifeforms of the United Federation of Planets determined to save succeeding generations from the scourge of war, and to reaffirm faith in the fundamental rights of sentient beings, in the dignity and worth of all lifeforms, in the equal rights of members of planetary systems large and small, and to establish conditions under which justice and respect for the obligations arising from treaties and other sources of interstellar law can be maintained, and to promote social progress and better standards of living on all worlds..."