Select a lot of items (checkboxes)

I'm working on a game where users can have a lot of items (50-100k). The items are stored in a database, they are all unique because they have metadata (achieved time etc.).

We would like to allow the users to have a decent overview and select items (for example to trade, gift or whatever). But rendering 50k items is undoable.

I could also remove the uniqueness of items and have a count column which stores duplicates (note I wouldn't be able to store metadata here). This way users still can have 50k items but if there are only 500 unique items I can safely render 500 since that is still doable.

Does anyone have an idea how I could realize this?

P.S. I initially asked my question on stack overflow but I was told that it was off-topic and this is a better place to ask the question (https://stackoverflow.com/questions/68305296/html-show-large-amount-of-checkboxes). Would be great to get some thoughts!