# Database

{% hint style="info" %}
This is an experimental feature, have fun, but remember it \*could\* break
{% endhint %}

### Details

The DappHero database is a super simple, in browser, end-to-end encrypted database that can be access directly from the window object in the browser.&#x20;

Each database is scoped to the `ProjectId` of your project and can be used as a fast, efficient `key:value` store.&#x20;

Users are scoped to DappHero, so a user that signs up at any DappHero site will also be a valid user on your site and vice versa. The Database however is not shared, so the data available to you will be specific to your projectId.&#x20;

The data in the database is encrypted client side in the browser for each user and is backed up to Amazon AWS in an encrypted format. DappHero can not access this data and can not retrieve user credentials, so if they lose their login- it's gone.&#x20;

All functions are async. DappHero Database is based on [UserBase](https://docs.dapphero.io/advanced/www.userbase.io).

### signUp

`window.dapphero.db.signUp({username: "my name", password: "xxxxx"})`

### signIn

`window.dapphero.db.signIn({username, password})`

### signOut

`window.dapphero.db.signOut()`

### openDatabase

`window.dapphero.db.openDatabase(callbackToReceiveDatabase)`

### insertItem

`window.dapphero.db.insertItem(item)`

### updateItem

`window.dapphero.db.updateItem(item, itemId)`

### deleteItem

`window.dapphero.db.deleteItem(itemId)`

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dapphero.io/advanced/database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
