The Federation supposedly has 150 member planets.
Each of those Solar systems would probably have massive amounts of ship production facilities, and various constructs that should/could easily produce more than enough.
That assumes that all 150 members (which one might argue are only major members, and that there are others like Bajor that have a more probationary/potential status) have equal resources, and I'm not sure that would be the case. Nor am I sure they'd all have massive facilities even if they had resource equality as a benefit of membership. Different regions are going to have different specialties, and it wouldn't make as much sense outside a wartime setting for all of them to producing the same amount unless it was a necessity.
Replicators need only energy to work.
Create giant replicator-yards near a star, use the solar power for energy, and replicate away.
Automate the heck out of everything using robotics, and those highly advanced AI's (ships, shuttles, etc. can be automated completely).
No, replicators use transporter technology to alter the form
of matter. They don't simply create matter out of energy. That was one of the reasons the TNG TM talked about the idea of huge fleet scaled replicators not being practical. They would need templates to provide the matter and the energy involved presumably wouldn't be a fair trade compared to just replicating a meal. They're also stated to be unable to create substances like gold or dilithium, because those substances have very complex templates. Same reason they can't create living beings, although the aliens in "Allegiance" had replication technology that bypassed this problem.