I live in an area where there are lots of real farms. Not huge agribusiness farms, but family farms. There is also a healthy level of small manufacturing/repair business nearby. We have at least 3 commercial fastener businesses within 25 miles that are not national chains (like Fastenal, which is here also, but has trouble competing against the locals), servicing those markets. I am spoiled!
For small quantities, I patronize two places. The local building supply is an Ace Hardware dealer, and has a pretty extensive fastener aisle. Like most places nowadays, this section is stocked and set up by a contractor. This is why so many of the places like this have identical displays. The store gets to choose how large the selection is, and it can be amazingly extensive. One True Value store in the nearest (15 miles) larger city has a huge selection, and is considered the "go-to" place for oddball fasteners.
The other place in town that has a good selection of nuts and bolts is the local NAPA Auto Parts store. Grade 5, 8, and metric. Not cheap, but not expensive, and very handy.
Since we have active farming, we have real farm stores. Not hobby farm stores, like Tractor Supply (although we have one of those, too) that cater to the suburban-type "farmer." They have real hardware inventories, and again, those are supplied by a vendor. Un-plated nuts and bolts are very inexpensive there, also in Grades 5 and 8, and an increasing stock of metric.
I have a rule of thumb for buying fasteners. If it is a nut, washer, or lock washer, and I need more than 10, I buy a box. If it is a bolt or screw, I consider if it is likely that I'll ever need more. Because I am a registered business, I qualify as a commercial customer at my favorite fastener source, Cascade Nut & Bolt, and they will sell me whatever quantity I want, and if I want 1 or 25 I can get that many. I often buy 20 or 25 if I need less than 10, just to keep them on hand. I have bolt bins, and keep them stocked when they run low. One nice thing about this is that they supply intermediate lengths, like 1-1/4", which are never stocked at retail stores.
I long ago discovered that it is less expensive to buy fasteners in bulk than to run around buying them one at a time. You just can't stock every length, but having a variety of thread sizes has saved my bacon over and over again. Once again, nuts, washers (USS, SAE, fender, etc.), and lock washers are something that is affordable to buy in bulk, and well worth the investment.