We know in "Tomorrow Is Yesterday" that Kirk tells Captain Christopher regarding the Enterprise that "there are only 12 like it in the fleet".
Whether that means 12 or 13 ships like the Enterprise is up to interpretation. Some have claimed that this meant only 12 or 13 ships in the entire Starfleet but that of course is ridiculous.
For most of the last couple of decades, a captain aboard a U.S. aircraft carrier could correctly say that "there are only 12 like it in the fleet" and be completely accurate but the U.S. fleet still has hundreds of vessels.
The loss of 39 ships at Wolf-359 and Shelby's "we'll have the fleet up and running in less than a year" gives some idea about the Federations ship production capabilities in peacetime.
Assume that they can replace 39 ships in about 10 months (less than a year) then that means that Starfleet normally builds about 4 new starships a month or about one a week. This would have to be the level of peacetime production as there was no time for production to have been ramped up significantly around Wolf-359.
The huge number of Miranda and Excelsior class ships during the Dominion War gives some clues as to how the Federation operates during war time. I think that the Federation has a system similar to the old Soviet Army where they stored vast amounts of military hardware to equip reservists and others called to duty during wartime.
I suspect that huge numbers of Excelsiors and Mirandas were put into mothballs (or more likely ready reserve) and kept in combat ready condition in case of time of war, when they could be deployed quickly and manned by minimal crews.