Starfleet's official mission is exploration: "To seek out new life and new civilizations -- to boldly go where no one has gone before." Consequently, Starfleet vessels carry large quantities of scientific equipment, and large portions of their crews are researchers.
Despite its stated mission, however, Starfleet is also solely responsible for the defense of the Federation. In addition to science equipment, Starfleet vessels are heavily armed and shielded, making them formidable opponents for the other Alpha Quadrant powers.
In the new Star Trek movie, Captain Pike describes Starfleet as a "humanitarian and peacekeeping armada". Having peacekeeping as a primary function helps to explain the heavy armament of the Federation's starships.
Despite access to some of the most powerful combat ships in the Alpha Quadrant, the Federation remains poorly prepared for a military emergency. While powerful individually, their fleet assets are so few and so scattered that they frequently have few or no ships in position to respond to a military emergency, even direct threats to the Federation capital on Earth. Worsening the situation, Starfleet command generally sees defense as a secondary function at best, so they require no military exercises to maintain the combat skills of their crews.
Worse still, as the Federation's only defense organization, Starfleet is responsible for ground combat operations as well, and the preparedness of their ground troops is even more obviously inadequate. Since at least smaller starships are capable of atmospheric flight and combat, it is possible that Starfleet sees heavy ground equipment (tanks, artillery, etc.) as both vulnerable and unnecessary.
Some trektards insist that the "NCC" hull numbers on starships are indicative of the number of vessels in active service, which would mean Starfleet numbers roughly 50,000 ships. In real-life navies, however, new hull numbers are created as new ships are built, instead of old numbers being reassigned to newly built vessels. Therefore, smaller numbers are more reasonable. Furthermore, Starfleet also numbers small craft like Runabouts, further limiting the number of capital ships that hull numbers might indicate.
With three years to prepare for the Dominion threat, Starfleet fielded thousands of vessels during the Dominion War, including individual fleets numbering hundreds of vessels. On other occasions, Starfleet has had severe difficulty mustering more than a few dozen ships in response to an unexpected military emergency (TNG "The Best of Both Worlds", TNG "Redemption").
In the new Star Trek movie, the bulk of the Federation's fleet (an unspecified number of starships) is deployed to the Laurentian system, leaving only seven -- largely uncrewed -- starships at Earth. Starfleet is forced to crew the ships with cadets in order to send them out in response to a disaster report from Vulcan.