Start with Databases_
Get started with Appwrite Databases. Follow a step-by-step guide to create your first database, define tables, and perform basic data operations.
2 min read
1. Create database
Head to your Appwrite Console and create a database and name it Oscar. Optionally, add a custom database ID.
2. Create table
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. Create rows
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.
{ "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. List rows
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. Type safety with models
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:
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:
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.