Back to blog

Pinata’s KV Store - A File-Centric Database

Pinata’s KV Store - A File-Centric Database

Justin Hunter

A key-value database (KV store) is one of the simplest to use but most powerful databases a developer can reach for. Associating arbitrary pieces of data with meaningful keys makes querying easy and efficient. But when you combine a KV store with file storage, you get superpowers.

This might take reframing your perspective on how key-value databases work. Normally, you will create keys and associate those keys with values that map to something. In the case of file storage, you would map to the stored file’s URL or some identifier. To create that key-value pair, you would need to upload the file, then you would need to create the key-value entry. That’s multiple network requests. But then you’re faced with the problem of associating other data with the file. Let’s say you want to associate a user identifier and a category name with a single file. You would need multiple key-value entries that point to the same file mapping.

This is inefficient and, frankly, annoying.

With Pinata, we streamline key-value stores by tying them directly to file uploads. Let’s take a look at this in practice.

We are uploading a file, associating an environment indicator and a user id to the file. That means we can later query for all the files that match the environment, all the files that match the user id, or all the files that match both.

It’s as simple as this:

Pinata’s KV Store allows you to build powerful and complex applications without having to spin up a separate service for your key-value needs. Imagine building an application that stored signed documents. With Pinata, you could store each PDF and map it to specific users using key-value metadata. When the user logs in, they would only get access to their signed PDFs.

The things you can build with Pinata’s KV Store are limitless, but the key is understanding that the file comes first. You are mapping pieces of data to individual files so that you can query that data later and list or retrieve files that match whatever queries you provide. By starting from the file, you start to free yourself to build increasingly complex apps without any of the overhead. The developer experience remains incredibly simple.

Pinata’s KV Store is available on all plans, so you can start using it now to supercharge your applications!

Subscribe to paid plan image

Share this post:

Stay up to date

Join our newsletter for the latest stories & product updates from the Pinata community.