diff --git a/packages/backend/src/apps/appwrite/assets/favicon.svg b/packages/backend/src/apps/appwrite/assets/favicon.svg
new file mode 100644
index 00000000..63bf0f23
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/assets/favicon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/packages/backend/src/apps/appwrite/auth/index.js b/packages/backend/src/apps/appwrite/auth/index.js
new file mode 100644
index 00000000..dfdd374b
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/auth/index.js
@@ -0,0 +1,65 @@
+import verifyCredentials from './verify-credentials.js';
+import isStillVerified from './is-still-verified.js';
+
+export default {
+ fields: [
+ {
+ key: 'screenName',
+ label: 'Screen Name',
+ type: 'string',
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description:
+ 'Screen name of your connection to be used on Automatisch UI.',
+ clickToCopy: false,
+ },
+ {
+ key: 'projectId',
+ label: 'Project ID',
+ type: 'string',
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description: 'Project ID of your Appwrite project.',
+ clickToCopy: false,
+ },
+ {
+ key: 'apiKey',
+ label: 'API Key',
+ type: 'string',
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description: 'API key of your Appwrite project.',
+ clickToCopy: false,
+ },
+ {
+ key: 'instanceUrl',
+ label: 'Appwrite instance URL',
+ type: 'string',
+ required: false,
+ readOnly: false,
+ placeholder: '',
+ description: '',
+ clickToCopy: true,
+ },
+ {
+ key: 'host',
+ label: 'Host Name',
+ type: 'string',
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description: 'Host name of your Appwrite project.',
+ clickToCopy: false,
+ },
+ ],
+
+ verifyCredentials,
+ isStillVerified,
+};
diff --git a/packages/backend/src/apps/appwrite/auth/is-still-verified.js b/packages/backend/src/apps/appwrite/auth/is-still-verified.js
new file mode 100644
index 00000000..6663679a
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/auth/is-still-verified.js
@@ -0,0 +1,8 @@
+import verifyCredentials from './verify-credentials.js';
+
+const isStillVerified = async ($) => {
+ await verifyCredentials($);
+ return true;
+};
+
+export default isStillVerified;
diff --git a/packages/backend/src/apps/appwrite/auth/verify-credentials.js b/packages/backend/src/apps/appwrite/auth/verify-credentials.js
new file mode 100644
index 00000000..3cd61698
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/auth/verify-credentials.js
@@ -0,0 +1,5 @@
+const verifyCredentials = async ($) => {
+ await $.http.get('/v1/users');
+};
+
+export default verifyCredentials;
diff --git a/packages/backend/src/apps/appwrite/common/add-auth-header.js b/packages/backend/src/apps/appwrite/common/add-auth-header.js
new file mode 100644
index 00000000..1bec6104
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/common/add-auth-header.js
@@ -0,0 +1,16 @@
+const addAuthHeader = ($, requestConfig) => {
+ requestConfig.headers['Content-Type'] = 'application/json';
+
+ if ($.auth.data?.apiKey && $.auth.data?.projectId) {
+ requestConfig.headers['X-Appwrite-Project'] = $.auth.data.projectId;
+ requestConfig.headers['X-Appwrite-Key'] = $.auth.data.apiKey;
+ }
+
+ if ($.auth.data?.host) {
+ requestConfig.headers['Host'] = $.auth.data.host;
+ }
+
+ return requestConfig;
+};
+
+export default addAuthHeader;
diff --git a/packages/backend/src/apps/appwrite/common/set-base-url.js b/packages/backend/src/apps/appwrite/common/set-base-url.js
new file mode 100644
index 00000000..35a7a957
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/common/set-base-url.js
@@ -0,0 +1,13 @@
+const setBaseUrl = ($, requestConfig) => {
+ const instanceUrl = $.auth.data.instanceUrl;
+
+ if (instanceUrl) {
+ requestConfig.baseURL = instanceUrl;
+ } else if ($.app.apiBaseUrl) {
+ requestConfig.baseURL = $.app.apiBaseUrl;
+ }
+
+ return requestConfig;
+};
+
+export default setBaseUrl;
diff --git a/packages/backend/src/apps/appwrite/index.js b/packages/backend/src/apps/appwrite/index.js
new file mode 100644
index 00000000..77dd13cb
--- /dev/null
+++ b/packages/backend/src/apps/appwrite/index.js
@@ -0,0 +1,17 @@
+import defineApp from '../../helpers/define-app.js';
+import addAuthHeader from './common/add-auth-header.js';
+import setBaseUrl from './common/set-base-url.js';
+import auth from './auth/index.js';
+
+export default defineApp({
+ name: 'Appwrite',
+ key: 'appwrite',
+ baseUrl: 'https://appwrite.io',
+ apiBaseUrl: 'https://cloud.appwrite.io',
+ iconUrl: '{BASE_URL}/apps/appwrite/assets/favicon.svg',
+ authDocUrl: 'https://automatisch.io/docs/apps/appwrite/connection',
+ primaryColor: 'FD366E',
+ supportsConnections: true,
+ beforeRequest: [setBaseUrl, addAuthHeader],
+ auth,
+});
diff --git a/packages/docs/pages/.vitepress/config.js b/packages/docs/pages/.vitepress/config.js
index 462fec41..2c1208ea 100644
--- a/packages/docs/pages/.vitepress/config.js
+++ b/packages/docs/pages/.vitepress/config.js
@@ -41,6 +41,12 @@ export default defineConfig({
{ text: 'Connection', link: '/apps/airtable/connection' },
],
},
+ {
+ text: 'Appwrite',
+ collapsible: true,
+ collapsed: true,
+ items: [{ text: 'Connection', link: '/apps/appwrite/connection' }],
+ },
{
text: 'Carbone',
collapsible: true,
diff --git a/packages/docs/pages/apps/appwrite/connection.md b/packages/docs/pages/apps/appwrite/connection.md
new file mode 100644
index 00000000..60aefe53
--- /dev/null
+++ b/packages/docs/pages/apps/appwrite/connection.md
@@ -0,0 +1,20 @@
+# Appwrite
+
+:::info
+This page explains the steps you need to follow to set up the Appwrite
+connection in Automatisch. If any of the steps are outdated, please let us know!
+:::
+
+1. Login to your Appwrite account: [https://appwrite.io/](https://appwrite.io/).
+2. Go to **Settings**.
+3. In the Settings, click on the **View API Keys** button in **API credentials** section.
+4. Click on the **Create API Key** button.
+5. Fill the name field and select **Never** for the expiration date.
+6. Click on the **Next** button.
+7. Click on the **Select all** and then click on the **Create** button.
+8. Now, copy your **API key secret** and paste the key into the **API Key** field in Automatisch.
+9. Write any screen name to be displayed in Automatisch.
+10. You can find your project ID next to your project name. Paste the id into **Project ID** field in Automatsich.
+11. If you are using self-hosted Appwrite project, you can paste the instace url into **Appwrite instance URL** field in Automatisch.
+12. Fill the host name field.
+13. Start using Appwrite integration with Automatisch!
diff --git a/packages/docs/pages/public/favicons/appwrite.svg b/packages/docs/pages/public/favicons/appwrite.svg
new file mode 100644
index 00000000..63bf0f23
--- /dev/null
+++ b/packages/docs/pages/public/favicons/appwrite.svg
@@ -0,0 +1 @@
+
\ No newline at end of file