I tried various things over the years - access database, spreadsheet, text files. In the end I just wrote an app to do the job and everything goes into that - spare parts and whole computers complete with photos, etc. Spare expansion boards/motherboards/drives go into an antistatic bag with is sealed shut with a label that has a database reference on it and some basic information while PSUs just get a label slapped on them somewhere:
The attachment PXL_20240827_223144142.jpg is no longer available
The attachment Screenshot 2025-07-21 212621.png is no longer available
For whole computers, a label with a database reference usually goes on the back somewhere and its database entry lists all the bits that are in it along with last test date, last battery change & type, last checked for leaking capacitors, photos, history, etc. I generally aim for enough detail/photos that I don't need to find the physical machine to answer a question about it. Some also get a webpage with more details (example), though I'm somewhat behind on adding complete PCs to the database as its a fairly time consuming process.
Currently I inventory: Displays, expansion boards, motherboards, PSUs, drives, cases and whole computers. RAM and CPUs aren't tracked individually and only have an identity for as long as they're installed in a computer/motherboard - I don't have enough loose CPUs to bother tracking, and I probably have more spare RAM than RAM slots for it to go into so its just sorted into anti-static bags by type/speed/capacity.