Appwrite secure open-source backend server for Flutter example app
Tags: Appwrite, Flutter
Published: 2020-05-28 17:31:52

Appwrite is an opensource backend that can use as web and mobile backend since it's already packed with developer must-use features e.g. account, database, object store which enough to develop an application for these days. 


{% youtube LxaAJtaPgKA %}

The first step installs the Appwrite backend ...
```
docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/install/appwrite:rw \
    -e version=0.6.1 \
    appwrite/install 
```

After docker running, open the Appwrite url http://localhost .

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8vkwn23gngy2w0r9ku1c.png)

Signup user for console access(need to restrict when using in production).
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/13k68ewnog79g95nu4na.png)

Login to admin console for backend management http://localhost/console .
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cxzd2day29nsl89t6p4b.png)

Since Appwrite supported multiple projects so we create one for our testing.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f4zgsq1dzqg80qds5m6f.png)

Then we can access to project's console 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bk64t0aqjdenxt71t2as.png)

Next, we will enable the project's mobile SDK, this example will use Flutter for example.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kb8q4q1akjlj1vdvzcgr.png)

Add more app's package information.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4o5zhx6wadv9xcaxb4ua.png)

Create new user for our example app testing (I've created the user with user: test01@test.com and password: 123456).
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1e6a8cndos83hpn5t66t.png)

After added project and SDK information, we will create a database.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/yzhmwzdcztao77yd6q6j.png)

Add new database field's rule. This example model the data for note application.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/lb4tpr4ida5gemjyzwpj.png)

An important part of the database is the collection's permission setting. This example will use '*' for 'read access' and leave 'write access' as empty to grant only collection's owner to update the collection's rule for example.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g15p6320pab0lua41k70.png)

Next for the example application, I've pushed source code to github if you need to see source code.

{% github netfirms/appnote %}

For Flutter, first, add Appwrite flutter package to project with [official Appwrite document](https://appwrite.io/docs/getting-started-for-flutter)

The example application will have 4 functions
- Login
- List note
- Create note
- Edit note
- Delete note

To play around with app, you login with user you created in admin console.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vbwl9or9jv2y83z3f2i2.png)

Once login completed you will see app page with blank note.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2k6o2uhpv6im2ds9o8wc.png)

So let create one for example.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/668oc1tekllfkjhdam3i.png)

After added note's list state will be reloaded (since we use provider state management).
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s6mnbqgcl074a4txx6xf.png)

Then we checked in our Appwrite's database we can see the new note's data was added.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nxhsu55ov9xqe78rx6ep.png)


This Flutter app is just an example to show how easy that mobile and web developers. can take advantage of Appwrite and able to save more backend development time and paying more to the business and innovation. 

More information about Appwrite available at [https://appwrite.io/](https://appwrite.io/)