Skip to main content

Appwrite

Appwrite in Illa is a database integration that allows you to connect and interact with a Appwrite database. Appwrite is a popular open-source relational database management system that is known for its speed, reliability, and ease of use.

With the Appwrite integration in Illa, you can query, insert, update, and delete data from a Appwrite database using SQL commands. You can also create custom SQL queries and run them within Illa. This makes it easy to build data-driven applications and dashboards that display real-time data from a Appwrite database.

This tutorial outlines the process of creating an Admin Panel using ILLA Builder and Appwrite in a few simple steps. ILLA is a low-code platform for developers that enables the rapid development and deployment of internal tools. It allows for creating pages by dragging and dropping UI components, connecting to any database or API, and writing JavaScript. To learn more about Appwrite, visit their website at https://Appwrite.io/ Let’s begin!

Set up your Back end on Appwrite

After signing into your Appwrite account, on the Appwrite dashboard, click Create project and set the name to First Project.

app_create_project

Then we can navigate to the project page. Appwrite provides multiple platforms for building your app as well as integrations.

app_platforms

Here we choose Web App as an example.

After creating our Web app project, we may go to the database page since we only use Appwrite as a database integration so far.

app_dashboard

Then we may create database and create collections within the database

app_create_database From here we may create attributes and data in the collection.

app_create_data

In order to retrieve documents by attributes, we need to make corresponding indexes for each attributes.

app_create_index

This database is now ready for you to integrate with Illa.

Create Appwrite

There are two ways to create a resource in Illa after signing into your Illa account.

  • Create in Resources

Sign into your Illa account, select Resources on the top of the page, and click Create New button.

external_resource

Select Appwrite from the database list.

action_list

Connect to the database with the required parameters described in Connection Settings below.

Click Test Connection to see if we can successfully connect to the database. If yes, click Save Resources, else, double check the hostname, port, username, and password is correct.

After creating a resource, the ready Appwrite will display as shown.

app_ex_ready

  • Create in Builder

Sign into your Illa account, create a project in Illa Builder in the App page, and navigate to the Action List at the bottom of the page. Click new, then select Appwrite from the database list. Then, connect to the database with required parameters described in Connection Settings below.

Click Test Connection to see if we can successfully connect to the database. If yes, click Save Resources, else, double check the hostname, port, username, and password is correct.

Connection Settings

Here we need to provide information for connecting to Appwrite database.

app_config

PropertiesRequiredDescription
NamerequiredThe name for resource when creating actions in the ILLA.
HostrequiredThe URL or IP address for your database
Database IDrequiredunique identifier assigned to each database created within Appwrite
Project IDrequiredunique identifier that represents your entire Appwrite project
API keyrequireda secret token that serves as a form of authentication when making API requests to the Appwrite server

To find the required Host, Database ID, Project ID, and API key in Appwrite, we first go to the setting button at the bottom left corner of the project page.

Copying the project ID for project ID and API Endpoint for Host in the Appwrite configuration in Illa.

app_setting

Then we may click the View API Keys button on the same page. If you have not created an API for this project, click Create API Key button and select only Database folder since that’s what we will be using from Appwrite.

app_api_key

Copy the API Key Secret for API key in Illa configuration. It can be copied for these two spots.

app_key_secret

What we have left is the Database ID which we can find in the Database Page. Copying it and paste it at the Appwrite Configuration in Illa.

app_database

The final product should look something like this.

app_final_config

Create Actions

We have created a Appwrite resource, we can add the action by selecting Appwrite from action list and choosing the Create action button.

app_resource_list

Now we have added the Appwrite server as an action to our building page.

app

Configure Appwrite

Overview

Method NameDescription
MethodCreate a document, Get a document, Update a document, Delete a document, List documents
Collection IDa unique identifier assigned to a database collection
Transformertransforming data into the style you like using JavaScript

Create a document

create a new document in a collection

Input

PropertiesRequiredDescription
Document IDrequireda unique identifier assigned to a database collection document
Dataoptionalan object containing the fields and values of the new document.

For example, to create a new document in a collection with two fields - name and age, you can use 1 as document ID and {{ {"Name": "David", "Age": 18}}} for data.

Output

a response object that includes the ID of the newly created document, as well as additional metadata such as the date and time of creation.

app_create_code

Get a document

retrieve a specific document from a collection in the database

Input

PropertiesRequiredDescription
Document IDrequireda unique identifier assigned to a database collection document

For example, we can get the document with id 1.

Output

a response object that includes the data of the requested document

app_get_data

Use {{Appwrite1.data}} to get all returned value.

app_get_code

Update a document

update the data of an existing document in a collection.

Input

PropertiesRequiredDescription
Document IDrequireda unique identifier assigned to a database collection document
DataoptionalAn object containing the updated fields and values that you want to assign to the document.

For example, to update a document in a collection using the updateDocument method, you can put 1 for document id and {{{"Name":"Fred"}}} for data.

Output

a response object that includes the data of the requested document

app_update)data

Delete a document

delete a specific document from a collection in the database

Input

PropertiesRequiredDescription
Document IDrequireda unique identifier assigned to a database collection document

For example, we can delete the document with id 1.

Output

a response object that confirms the successful deletion of the document.

app_delete_data

List document

retrieve multiple documents from a collection in the database

Input

PropertiesRequiredDescription
Filteroptionaldefine conditions to filter the documents based on specific fields and values
Order byoptionalspecify the field by which the resulting documents should be sorted
Limitoptionalrestrict the number of documents returned in the result set

For example, to list all the documents with Name = James.

Output

An array of documents that satisfy the filter.

app_list_data

Use {{Appwrite1.data[0].documents}} to get returned value.

app_list_code