How can I use browser storage for a lot of data and be able to query it in a nice way?

Use indexeddb. It allows far more storage beyond the 5mb limit that localstorage has.

There are some nice wrapper libraries around it

Indexeddb best practices

https://web.dev/indexeddb-best-practices/

Wrappers around indexeddb I want to try

localForage (localstorage-like API for indexeddb)

https://dexie.org/ https://rxdb.info/ https://pouchdb.com/

Further reading:

https://www.audible.com/pd/Designing-Data-Intensive-Applications-Audiobook/B08VLGDK32?qid=1675117645&sr=1-1&ref=a_search_c3_lProduct_1_1&pf_rd_p=83218cca-c308-412f-bfcf-90198b687a2f&pf_rd_r=2G3Z1RQ7SABEFP9KGV3M&pageLoadId=X1n8n2nFRqfzREfX&creativeId=0d6f6720-f41c-457e-a42b-8c8dceb62f2c