Collections

collections-headline

Deta Space offers persistent data storage through Collections. An individual Collection is a group of related data.

Every app in your Space has its own Collection — App Collections. You can also create and use Collections that aren’t associated directly with any app — Headless Collections. Collections can store structured text using Deta Base and files with Deta Drive.

Like Space apps themselves, the data in Collections is yours — it comes with the benefits of end user ownership. Collections feature their own graphical user interfaces to navigate and manage your data. You can read and write data to your Collections through these user interfaces, but you can also use the Deta SDK & HTTP APIs with Data Keys.

App Collections

Every app gets its own Collection for storing app specific data in Deta Base or Deta Drive, collectively “App Collections”. App Collections are used by apps when storing and reading persistent data, with authorization automatically managed by Space. Nothing is required on your part, except using the app.

Headless Collections

Collections created independent of any app are Headless Collections. These can be useful for all sorts of reasons, usually if you want to use the data outside of a context on Deta Space (e.g. on Streamlit Cloud). Headless Collections can be created and managed using the Collections App.

The Collections App

Headless Collections can be created and managed through the Collections App, which is accessible from your Horizon.

To create a Headless Collection, open the Collections app from your Horizon and then click + New Collection. Finally, give your Collection a name to create it.

collections-1

Deta Base

Deta Base a fully-managed, fast, and secure NoSQL database. Each Collection can contain as many Bases as it needs. Individual Bases are created when they are written to; storing any data in a Base will create one, if it doesn’t already exist.

Bases in a Collection can be viewed and managed through Base UI. You can also read and write data to any Base in a Collection through the Base SDK or Base HTTP API.

Deta Drive

Deta Drive is a fully-managed, secure and scalable file storage service. Each Collection can contain as many Drives as it needs. Individual Drives are created when they are written to; storing data in a Drive will create one, if it doesn’t exist yet.

Drives in a Collection can be viewed and managed through Drive UI. You can also read and write data to any Base in a Collection through the Drive SDK or Drive HTTP API.

Data Keys

Authorization to Collections happens via Data Keys. You can create Data Keys for any Collection. These keys are passed into the SDK or HTTP APIs to authorize reading or writing data. Be careful with your Data Keys — a compromised Data Key compromises a Collection’s data.

Read more about how to use Data Keys in the Developer Documentation with the Deta SDK or HTTP API.

🗒️ Autorization to Collections is automatically managed inside of Space apps and when using the graphical user interfaces for Collection data. You don’t need a Data Key.

Data Keys for App Collections

To manage Data Keys for an app’s Collection, open the app’s Settings from its context menu.

Navigate to the Keys tab. If you have any Data Keys, they should be shown.

Creation

To create a Data Key for an app’s Collection, click the Create new data key button and give your new key a name.

Upon creation, the Data Key is displayed once, so store it somewhere safely.

Deletion

Click the trash icon next to the Data Key you want to delete. Upon confirming, the Data Key you delete is no longer valid.

Data Keys for a Headless Collection

To manage Data Keys for a Headless Collection, open a Collection from the Collections App. Click Collection Settings in the top corner.

collections-5

If you have any Data Keys for your Collection, they should be shown.

Creation

To create a Data Key, click the Create new data key button and give your new key a name.

Upon creation, the Data Key is displayed once, so store it somewhere safely.

Deletion

Click the trash icon next to the Data Key you want to delete. Upon confirming, the Data Key you delete is no longer valid.

Graphical User Interfaces

Collections feature graphical user interfaces for viewing and managing Collection data in a Base or Drive.

Read more about the Space GUIs for data here.