Create table
In Appwrite, data is stored as a table of rows. Create a table inside a database in the Appwrite Console to store our ideas.
Create the following columns within the table:
| Field | Type | Size | Required |
|---|---|---|---|
| userId | Varchar | 36 | Yes |
| title | Varchar | 128 | Yes |
| description | Text | - | No |
For this tutorial, we'll also set the permissions to allow any users to read and write to the table. In a real-world scenario, you would probably want to restrict access to a certain group of users.
Managing ideas
Now that you have a table to hold ideas, we can read and write to it from our app.
Let's create some methods to manage ideas in our app.
Create a new file src/lib/ideas.js and add the following code:
Remember to use a store to hold data returned from Appwrite Databases, so your components can be updated when the data changes.