I would suggest going for a 24 bay 4U rack mount server.
Here’s a link to my build:
Supermicro makes good storage chassis cases, and if you go with one of those, best to get the sas expander backplane.
SAS Expansers are a little bit like Ethernet switches… so you can connect you CPU to sas or sata drives via an HBA… which may support 8 or 16 internal drives (8i or 16i) etc, or you can use an expander, and that might have 8 lanes of bandwidth to your hba… but then have hundreds of downstream drives… or in this case… 24
The number of PCIe slots (or more technically lanes) is dependent on the CPU.
Consumer grade CPUs only have 20-28 lanes, which is only enough for a couple of slots.
Older server CPUs (Xeon E5 etc) used to support about 44 lanes.
These days, smaller workstation/server CPUs support 64-96 lanes and the big ones support 128.
A good approach is to gwork out how many lanes you want (think about future NVMe flash devices you want) and the pick a CPU and board which supports that.
ECC and IPMI are features you should consider.