Skip to content

Start with Databases

1

Head to your Appwrite Console and create a database and name it Oscar. Optionally, add a custom database ID.

2

Create a table and name it My books. Optionally, add a custom table ID.

Navigate to Columns and create columns by clicking Create column and select String. Columns define the structure of your table's rows. Enter Column key and Size. For example, title and 100.

Navigate to Settings > Permissions and add a new role Any. Check the CREATE and READ permissions, so anyone can create and read rows.

3

To create a row use the createRow method.

In the Settings menu, find your project ID and replace <PROJECT_ID> in the example.

Navigate to the Oscar database, copy the database ID, and replace <DATABASE_ID>. Then, in the My books table, copy the table ID, and replace <TABLE_ID>.

The response should look similar to this.

JSON
{
    "title": "Hamlet",
    "$id": "65013138dcd8618e80c4",
    "$permissions": [],
    "$createdAt": "2023-09-13T03:49:12.905+00:00",
    "$updatedAt": "2023-09-13T03:49:12.905+00:00",
    "$databaseId": "650125c64b3c25ce4bc4",
    "$tableId": "650125cff227cf9f95ad"
}
4

To read and query data from your table, use the listRows endpoint.

Like the previous step, replace <PROJECT_ID>, <DATABASE_ID>, and <TABLE_ID> with their respective IDs.

5

For added type safety and better development experience, mobile and native SDKs support custom model types with the nestedType parameter.

Define a data class or model that matches your table structure:

Automatic type generation

You can automatically generate type definitions for your tables using the Appwrite CLI type generation feature. Run appwrite types collection to generate models for your collections.

Model methods

Models returned by native SDKs include helpful methods for data manipulation: