The Deta library is the easiest way to store and retrieve data from your Deta Base and Deta Drive in a Collection.
Currently, we support JavaScript (Node + Browser), Python 3 and Go.
You’ll first need to install and instantiate your SDK, before you can interact with Base or Drive.
Once you have, if you’re someone who learns by theory, see the reference documentation:
To start working with your Base or Drive, you need to import the Deta class and initialize it.
The SDK needs to be authenticated with Space to talk with a Base or Drive.
Once you’re authenticated, you can instantiate a subclass called Base with a database name of your choosing or Drive with a drive name of your choosing.
Deta Bases and Drives are created for you automatically when you start using them.
⚠️ Do not use the browser version of the SDK with your secret key hard coded. You are exposing your key. The browser SDK is strictly meant for use in Space Apps’ private routes.
Authentication is managed for you when developing locally with the space dev command,
when using the SDK inside a Micro,
or when using the SDK in a Space app running in the browser (the SDK will not authenticate on public micros or public routes).
Alternatively, you can authenticate with the Deta SDK by providing a Data Key in an environment variable called DETA_PROJECT_KEY.
⚠️ Your Data Key is confidential and meant to be used by you. Anyone who has your Data Key can access your database. Please, do not share it, commit it in your code, or use it in the Browser.