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
.
Then we can navigate to the project page. Appwrite provides multiple platforms for building your app as well as integrations.
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.
Then we may create database and create collections within the database
From here we may create attributes and data in the collection.
In order to retrieve documents by attributes, we need to make corresponding indexes for each attributes.
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.
Select Appwrite
from the database 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.
- 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.
Properties | Required | Description |
---|---|---|
Name | required | The name for resource when creating actions in the ILLA. |
Host | required | The URL or IP address for your database |
Database ID | required | unique identifier assigned to each database created within Appwrite |
Project ID | required | unique identifier that represents your entire Appwrite project |
API key | required | a 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.
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.
Copy the API Key Secret
for API key
in Illa configuration. It can be copied for these two spots.
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.
The final product should look something like this.
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.
Now we have added the Appwrite server as an action to our building page.
Configure Appwrite
Overview
Method Name | Description |
---|---|
Method | Create a document, Get a document, Update a document, Delete a document, List documents |
Collection ID | a unique identifier assigned to a database collection |
Transformer | transforming data into the style you like using JavaScript |
Create a document
create a new document in a collection
Input
Properties | Required | Description |
---|---|---|
Document ID | required | a unique identifier assigned to a database collection document |
Data | optional | an 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.
Get a document
retrieve a specific document from a collection in the database
Input
Properties | Required | Description |
---|---|---|
Document ID | required | a 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
Use {{Appwrite1.data}}
to get all returned value.
Update a document
update the data of an existing document in a collection.
Input
Properties | Required | Description |
---|---|---|
Document ID | required | a unique identifier assigned to a database collection document |
Data | optional | An 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
Delete a document
delete a specific document from a collection in the database
Input
Properties | Required | Description |
---|---|---|
Document ID | required | a 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.
List document
retrieve multiple documents from a collection in the database
Input
Properties | Required | Description |
---|---|---|
Filter | optional | define conditions to filter the documents based on specific fields and values |
Order by | optional | specify the field by which the resulting documents should be sorted |
Limit | optional | restrict 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.
Use {{Appwrite1.data[0].documents}}
to get returned value.