First, we need to address the sizes.
All ship types except for exotic and Shuttles have 3 different sizes as a subtype, which are Small, Medium and Large, shuttles only have small and medium.
You may think, well, if there's only 2, then isn't that small and large? but the files actually have a small medium and large set up for the shuttles, but you can only obtain the small and medium in game.
These sub-types each have their own ranges and pool of parts that can be combined to make that ship model.
For example, if you see a much sought after Hauler type with the large ball cargo pods, you can be pretty sure, that that ship is a Large hauler type, as those ball Cargo pods mostly appear on large haulers.
These parts are most easily identified as the wings.
Though, with the advent of being able to even more easily scan a ship for all of the information you need, you can ascertain a ship's size by scanning and seeing how many slots it has, as those slots will fall within the range of that ship size.
For the actual numbers here.
Small - 18-23 Cargo/3-6 Technology
Medium - 19-28 Cargo/5-8 Technology
Small - 15-19 Cargo/3-5 Technology
Medium - 20-29 Cargo/5-8 Technology
Large - 30-38 Cargo/8-12 Technology
Small - 15-19 Cargo/2-4 Technology
Medium - 20-29 Cargo/3-5 Technology
Large - 30-38 Cargo/5-12 Technology
Small - 25-31 Cargo/2-4 Technology
Medium - 32-39 Cargo/4-6 Technology
Large - 40-48 Cargo/6-8 Technology
And finally Exotic ships only have a single size, in-game anyway, in the files they have a small medium and large, but only the medium is available in-game:, and that has between 15 and 20 main slots with 4-6 tech slots.
Medium - 15-20 Cargo/4-6 Technology
So in summary, the largest a Shuttle can be is 28 slots, the largest an Explorer or Fighter can be is 38 slots, largest a Hauler can be is 48 slots and the largest an Exotic ship can be is 20.
It's also very important to know that Class plays a role here, in that if it is an S Class ship for all but Exotic, it will always have the maximum main and tech slots for that type and size, so an S class medium fighter will always have 29 slots in it's main and 5 slots in its tech, whereas a large S class fighter, will always have 38 slots in it's main and 12 slots in its technology.