Read the Making of Star Trek. Starfleet was based on the Hornblower novels, and the situation (out of contact with home base, etc) was modeled on the 18th century Royal Navy. However, to make it more accessible to audiences, he used the then-current US Navy structure, ranks, etc., rather than using the tradition Nelson matured and died under, so we didn't get to see Kirk's First Lieutenant Spock, or Midshipman Chekov. It also avoided having audiences puzzle out Kirk bellowing "wear ship!"
I've read it. It says that the captain is based on Hornblower, whose career as a captain, of course, was in the 19th century. If we are looking for a real-world parallel, the 1800s RN, with a larger British Empire, a more extensive network of bases, coaling stations etc. and lack of a looming battle fleet threat, seems a better fit the the 18th century RN.