It’s really just querying a database, but you need the data. When I first was experimenting, I open-sourced
a huge list of useful SQL queries, and database processors in Ruby with Postgres.
I’ve migrated to rust, but the basics are there and great for starting to explore Nostr data.