You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building applications with Appwrite, developers often need a way to test and debug services repeatedly over short periods. Sometimes, this can become a hassle, as Appwrite enforces strict rate limits on client apps to prevent abuse. Developers needed a way to bypass these rate limits in their test environments and CI/CD workflows to ensure the robustness of their app functionalities.
15
+
16
+
And this is the exact problem **dev keys** are here to solve!
17
+
18
+
# What are dev keys?
19
+
20
+
Dev keys are a type of secret used by Appwrite's client SDKs. They allow the developer to bypass any rate limits enforced by Appwrite and suppress any CORS errors caused by not using a configured hostname. A developer can configure the expiration date of a dev key to any of the three preset options (1 day, 7 days, or 30 days).
21
+
22
+
Dev keys should never be used in production environments, as they can make your app more susceptible to abuse and security breaches.
23
+
24
+
# Try out dev keys in an app
25
+
26
+
To test dev keys, I created a simple demo web app that sends 200 requests to create a new document in an Appwrite database. To set this app up, you must complete the following steps:
27
+
28
+
## Step 1: Setup Appwrite project
29
+
30
+
First, create an [Appwrite Cloud](https://cloud.appwrite.io) account or [self-host Appwrite 1.7](/docs/advanced/self-hosting). Create a project (which will lead you to the project overview page) and head to the **Databases** page from the left sidebar. Create a new database with the ID `testDb` and a new collection with the ID `testCollection`. Store both of these IDs for future usage. In this collection, add the following attribute:
31
+
32
+
| Name | Type | Required |
33
+
| --- | --- | --- |
34
+
| `number` | Integer | True |
35
+
36
+
Then, head to the **Settings** tab of the collection, scroll down to the **Permissions** section, and add the following permissions:
37
+
38
+
| | Create | Read | Update | Delete |
39
+
| --- | --- | --- | --- | --- |
40
+
| Any | False | False | False | False |
41
+
42
+
Lastly, return to the project overview page, head to the **Settings** page from the left sidebar, and copy your **API endpoint** and **project ID** for future usage.
43
+
44
+
## Step 2: Create web app
45
+
46
+
Next up, we'll create our test app. This will require us to create two files in our working directory:
If you open the HTML page in your browser and click on the `Add documents` button, you will notice numerous errors in the console with the HTTP code `429`, as Appwrite's rate limits allow one client to create 120 requests per minute for this API endpoint.
99
+
100
+
## Step 3: Create dev key
101
+
102
+
Head back to your Appwrite project. On the overview page, select the **Dev keys** tab under the Integrations section and create a new dev key. You can add whatever name and expiry date you like.
Copy file name to clipboardExpand all lines: src/routes/docs/products/storage/images/+page.markdoc
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ Below you can find all the different parameters offered by the preview endpoint
32
32
| opacity | Set opacity for the output image. Accepts a float value between `0-1`, where `0` makes it transparent. Only works with output formats supporting alpha channels like `png`. |
33
33
| rotation | Rotate the output image by a degree. Accepts an integer between `-360` to `360`. |
34
34
| background | Set a background-color. Accepts any valid hex color value without the leading `#`. Only works with output formats supporting alpha channels like `png`. |
35
-
| output | Set the output image format. If not provided, will use the original image's format. Supported formats are: `jpg`, `jpeg`, `png`, `gif`, and `webp` |
35
+
| output | Set the output image format. If not provided, will use the original image's format. Supported formats are: `jpg`, `jpeg`, `png`, `gif`, `webp`, `avif`, and `heic` |
36
36
37
37
# Examples {% #examples %}
38
38
Here are some examples using [Client SDKs](/docs/sdks#client).
0 commit comments