<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 0xsapphir3</title>
    <description>The latest articles on DEV Community by 0xsapphir3 (@asiancat54x).</description>
    <link>https://dev.to/asiancat54x</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F730974%2F4b6e5898-afb3-489b-beb2-5bed1a19659f.jpeg</url>
      <title>DEV Community: 0xsapphir3</title>
      <link>https://dev.to/asiancat54x</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/asiancat54x"/>
    <language>en</language>
    <item>
      <title>Best thing about Symbl.ai Docs</title>
      <dc:creator>0xsapphir3</dc:creator>
      <pubDate>Sat, 27 Nov 2021 17:20:28 +0000</pubDate>
      <link>https://dev.to/asiancat54x/best-thing-about-symblai-docs-43em</link>
      <guid>https://dev.to/asiancat54x/best-thing-about-symblai-docs-43em</guid>
      <description>&lt;p&gt;Hi, as you have probably known symbl.ai, it is a very powerful tool that you can use for conversation intellisence.&lt;/p&gt;

&lt;p&gt;The thing I loved is how they added different requests methods which can be very helpful for other devs.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>symbl</category>
      <category>buildwithsymbl</category>
    </item>
    <item>
      <title>Deploying Amplication Server To Digital Ocean </title>
      <dc:creator>0xsapphir3</dc:creator>
      <pubDate>Tue, 26 Oct 2021 16:21:51 +0000</pubDate>
      <link>https://dev.to/asiancat54x/deploying-amplication-app-to-digital-ocean-5d7k</link>
      <guid>https://dev.to/asiancat54x/deploying-amplication-app-to-digital-ocean-5d7k</guid>
      <description>&lt;p&gt;Hi there! This post teaches you how you can deploy your Amplication Server to Digital Ocean. You can request to the api, create or delete data, get data and so on. &lt;/p&gt;



&lt;h2&gt;
  
  
  Setting up Digital Ocean droplet
&lt;/h2&gt;

&lt;p&gt;Now, in order to run our server, we will need to have a virtual machine, which Digital Ocean provides. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move to the digital ocean's cloud &lt;a href="https://cloud.digitalocean.com/projects"&gt;website&lt;/a&gt;. 
Click the create dropdown in topbar and click Droplets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w0ri9BWM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aroxnxnl1c8q4q0hstv4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w0ri9BWM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aroxnxnl1c8q4q0hstv4.png" alt="Dropdown"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the specifications for your droplet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aaiBxvd9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iahhs9yedgsj0ruhc2y1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aaiBxvd9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iahhs9yedgsj0ruhc2y1.png" alt="Specifications 1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will use Ubuntu as our disk image. Then, choose a plan according to your requirement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QNd_hyys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wjkg81qok020dd4hl2xn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QNd_hyys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wjkg81qok020dd4hl2xn.png" alt="Specifications 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, choose the data center. I would recommend you to choose the center nearest to you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jFbDHZxP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1oapck9uqc1gqjm8ca5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jFbDHZxP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1oapck9uqc1gqjm8ca5i.png" alt="Specifications 3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I would always recommend you to use SSH Key Authentication. It is secure and better than Password Authentication&lt;/p&gt;

&lt;p&gt;Lastly, click the Create button to create the droplet. It may take 30 sec to 1 min for the droplet to become ready. &lt;/p&gt;



&lt;h2&gt;
  
  
  Setting up the droplet
&lt;/h2&gt;

&lt;p&gt;Now that your droplet is created, we need to install required packages. The steps for setting up the droplet is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open a terminal &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run &lt;code&gt;ssh root@&amp;lt;host&amp;gt;&lt;/code&gt; where host is the ipv4 of your droplet. You can get this IP from your droplet by going to the droplet menu. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you should see that we have successfully connected to the droplet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Curl the latest version of node - &lt;code&gt;curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install nodejs by running this command - &lt;code&gt;sudo apt-get install -y nodejs&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install docker compose with the following command: &lt;code&gt;apt install docker-compose&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install pm2 - &lt;code&gt;npm install -g pm2&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;
  
  
  Setting up the project
&lt;/h2&gt;

&lt;p&gt;Now that you have installed nodejs, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Clone your repository - Clone your repository using git at the home directory or any other directory - &lt;code&gt;git clone &amp;lt;repository_url&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change directory to the directory where your source code is - &lt;code&gt;cd &amp;lt;folder_name&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optional: You can actually delete the admin ui folder because we are just deploying our server. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change directory to the server folder - &lt;code&gt;cd server&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install the required dependencies - &lt;code&gt;npm install&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wait for the installation to complete&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generate prisma client - &lt;code&gt;npm run prisma:generate&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the database - &lt;code&gt;npm run docker:db&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Initialize the database - &lt;code&gt;npm run db:init&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now change the port from 3000 to 80. You must be wondering why to do this? Well, we should not allow users to go to specific post to access the api. Since the default port of the browser is 80, we changed the port. This way, the user has to go to &lt;code&gt;http://&amp;lt;host&amp;gt;/&lt;/code&gt; instead of going to &lt;code&gt;http://&amp;lt;host&amp;gt;:3000/&lt;/code&gt;. I hope this makes sense.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open up the nano editor by running &lt;code&gt;nano src/main.ts&lt;/code&gt; (make sure that you are at server/ directory). You must find a line with this content - &lt;code&gt;const { PORT = 3000 } = process.env;&lt;/code&gt;. Change this to &lt;code&gt;const { PORT = 80 } = process.env;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;code&gt;Ctrl + X&lt;/code&gt; then &lt;code&gt;Y&lt;/code&gt; then &lt;code&gt;Enter&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lastly build the application for the production use - &lt;code&gt;npm run build&lt;/code&gt;. This should create a folder &lt;code&gt;dist&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can actually test if your server is working fine. Run &lt;code&gt;node dist/main.js&lt;/code&gt; and go to this website - &lt;code&gt;http://&amp;lt;host&amp;gt;/graphql&lt;/code&gt;, where the host is the ipv4 of your droplet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If you terminate your running code, you will see that the site hangs, keeps on loading and you get this error - &lt;code&gt;&amp;lt;url&amp;gt; took too long to respond&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now, to run this code in background, use this command - &lt;code&gt;pm2 start dist/main.js&lt;/code&gt;. Now, if you again go ahead to the site, you should see it rendering. Amazing!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;h2&gt;
  
  
  Creating a domain
&lt;/h2&gt;

&lt;p&gt;Now, of course you will not provide access to the API through the IP address of the droplet. So, we use domains. Go ahead and buy a domain (I buyed the domain for free from the site &lt;code&gt;https://www.freenom.com/en/index.html&lt;/code&gt;).&lt;/p&gt;


 
&lt;h2&gt;
  
  
  Setting up the domain
&lt;/h2&gt;

&lt;p&gt;Follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the domains option in left bar of Digital Ocean's Home&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OlxZrRBq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9tryby1te75f69sdjyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OlxZrRBq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9tryby1te75f69sdjyk.png" alt="Domains"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next, you should see a input box saying "Enter Domain". Enter the domain there.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pHR2W0Yo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfv52ob2qi426ywx2366.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pHR2W0Yo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfv52ob2qi426ywx2366.png" alt="Domain Enter"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click "Add Domain"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create records&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, click on the &lt;em&gt;A&lt;/em&gt; button in the menu under "Create new record"&lt;/p&gt;

&lt;p&gt;You can create a subdomain which represents what that domain does. Like we are deploying the api, we can use api.ecommerce.ml. Use "@" if you dont want to create subdomains. Next, Under "Will Redirect To", choose your droplet. The click "Create Record"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ai5Firdf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ygqxlus7euqz8tm5m9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ai5Firdf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ygqxlus7euqz8tm5m9v.png" alt="a"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add NameServers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, different domain providers have different locations for setting up the name servers. Under "DNS Records, you will wind three nameservers (It would be in a &lt;code&gt;ns&amp;lt;number&amp;gt;.digitalocean.com&lt;/code&gt;). Copy them and add to the servers (You can find out how to do so by following tutorial on that specific domain provider).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding CNAME&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Move to CNAME option in the menu. Enter the host name as &lt;code&gt;www&lt;/code&gt; and &lt;code&gt;@&lt;/code&gt; under the "Is An Alias of". Then click "Create Record"&lt;/p&gt;

&lt;p&gt;Note: It may take some time for your droplet to start on the domain.&lt;/p&gt;




&lt;p&gt;Done! You have successfully deployed your server to Digital Ocean!&lt;/p&gt;



&lt;h2&gt;
  
  
  Testing Our API
&lt;/h2&gt;

&lt;p&gt;Now that we have successfully deployed our server, its time to test the server. We will make some requests, and check the output.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple GET request for users
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import fetch from "node-fetch"

fetch("http://&amp;lt;your_website&amp;gt;/api/users" , {
    method: "GET",
    headers: {
        "Authorization": "Basic YWRtaW46YWRtaW4="
    }
}).then((res) =&amp;gt; res.json())
.then((data) =&amp;gt; console.log(data))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you run the above code, you should see the list of users available.&lt;/p&gt;



&lt;h2&gt;
  
  
  Ending
&lt;/h2&gt;

&lt;p&gt;I hope that you have understood how you can deploy your app server to Digital Ocean.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I, not only want to thanks &lt;a href="https://github.com/yuval-hazaz"&gt;Yuval Hazaz&lt;/a&gt; for this amazing project, but also for helping me to make this tutorial.&lt;/p&gt;




&lt;p&gt;My &lt;a href="https://github.com/AsianCat54x"&gt;github profile&lt;/a&gt;&lt;/p&gt;

</description>
      <category>digitalocean</category>
      <category>amplication</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Deno + Appwrite</title>
      <dc:creator>0xsapphir3</dc:creator>
      <pubDate>Fri, 22 Oct 2021 17:03:01 +0000</pubDate>
      <link>https://dev.to/asiancat54x/deno-appwrite-5271</link>
      <guid>https://dev.to/asiancat54x/deno-appwrite-5271</guid>
      <description>&lt;p&gt;Hi there!&lt;/p&gt;

&lt;p&gt;This post teaches you how you can use Appwrites Deno SDK to write Appwrite Functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0wr2afc1svawv8j5s68.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0wr2afc1svawv8j5s68.png" alt="Deno + Appwrite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up
&lt;/h2&gt;

&lt;p&gt;You should have cli version of deno installed.&lt;/p&gt;




&lt;p&gt;Let's start learning!&lt;/p&gt;
&lt;h2&gt;
  
  
  Importing module and setting up the function API
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Appwrite has the sdk for deno published to deno land. We can import easily with the help of the package's url:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as sdk from "https://deno.land/x/appwrite/mod.ts";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Create a Appwrite client
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;const client = new sdk.Client()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set apiEndpoint , apiKey and projectID&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Next, we will require the above mentioned data and set it to the client&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;client.setProject(projectId)
      .setEndpoint(endPoint)
      .setKey(apiKey

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a instance of the Function class
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const functions = new sdk.Functions(client)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have imported the import, we will start interacting with the Appwrite's functions API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating function
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fje2iib1733h885cre29q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fje2iib1733h885cre29q.png" alt="Create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lets first get started by creating a function. Now, creating a function is pretty simple. You just need to run a method and pass all the data for your new function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.create("foo" , ["*"] , "node-16.0").then(() =&amp;gt; {
    console.log("Successfully created a new function")
})
.catch((error) =&amp;gt; {
    console.log("Error while creating a new function.")

    console.log(error)
})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Okay, lets understand the code line by line:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;functions.create("foo" , ["*"] , "node-16.0").then(() =&amp;gt; {&lt;/code&gt; - This line calls the function that creates the function. The parameters are the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Name - The first parameter states the name of the function. You can give it a name of your choice&lt;/li&gt;
&lt;li&gt;Permissions - The second parameter takes in a list of permission that you will allow your function. "*" means all the function. You can find a list of all the permission &lt;a href="https://appwrite.io/docs/permissions" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Runtime - The third parameter takes in the excecution runtime. It can be one of the following - java-16.0 (Java), python-3.9 (Python), ruby-3.0 (Ruby), php-8.0 (PHP), node-16.0 (Typescript / JavaScript)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The next line is printing to console telling that the function was created successfully.&lt;/p&gt;

&lt;p&gt;Now, run the code by running &lt;code&gt;deno run --allow-net main.js&lt;/code&gt; and then go ahead to &lt;a href="http://localhost:4003/console/functions?project=6172d13cf302d" rel="noopener noreferrer"&gt;Function tab&lt;/a&gt; in appwrite's console.&lt;/p&gt;

&lt;p&gt;You should see a new function being created!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqaomuyvyn7qmogc0ahfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqaomuyvyn7qmogc0ahfv.png" alt="Output"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h2&gt;
  
  
  Listing all the functions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fumh88d8hemhybj7ndybi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fumh88d8hemhybj7ndybi.png" alt="Listing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, at some point of time you will require to print all the available functions. Here is how to you do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.list().then((res) =&amp;gt; {
    let index = 0

    res.functions.forEach((_function) =&amp;gt; {
        console.log(`${index}: ${_function.name}`)

        index += 1
    })
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is happening here?&lt;/p&gt;

&lt;p&gt;So the first line basically fetches all the functions which are registered in our database. Next, we are iterations over all the functions. Each function object looks like &lt;a href="https://appwrite.io/docs/models/functionList" rel="noopener noreferrer"&gt;this&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Next, we are just printing the name of each of the function.&lt;/p&gt;

&lt;p&gt;Run the file by this command: &lt;code&gt;deno run --allow-net main.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This should give the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0: foo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  Getting functions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffo9jo8thu2nrf86f14bn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffo9jo8thu2nrf86f14bn.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can get the details of a function using the function's id.&lt;br&gt;
Here is how you can do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.get("6172d8bc57f89").then((res) =&amp;gt; {
    console.log(`Fetching details for function id ${res.$id}`)
    console.log(`Name - ${res.name}`)
    console.log(`Created at - ${res.dateCreated}`)
    console.log(`Status - ${res.status}`)
    console.log(`Runtime - ${res.runtime}`)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, in the first line, we are fetching the function by id. It returns a object with [these] key-value pairs. We then just print some of the properties to the console. The output is like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fetching details for function id 6172d8bc57f89
Name - foo
Created at - 1634916540
Status - disabled
Runtime - node-16.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  Updating functions
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdl4bj2ruq9swy4kckguz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdl4bj2ruq9swy4kckguz.jpg" alt="Update"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, are you stuck at the place where you want to rename your function? Its easy! Appwrite provies a function to change the function's id , name , runtime etc. Here is how you do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const newName = "Bar"

functions.update("6172d8bc57f89", newName, ["*"]).then(() =&amp;gt; {
    console.log("Successfully renamed the function!")
}).catch((err) =&amp;gt; {
    console.log(err)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, first we are initiating a variable with the new name of the function.&lt;/p&gt;

&lt;p&gt;Next, we are running the function and updating the function. The parameters are as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ID - The id of the function that we want to change&lt;/li&gt;
&lt;li&gt;Name - The new name for this function&lt;/li&gt;
&lt;li&gt;Permissions - New permissions for this function &lt;/li&gt;
&lt;li&gt;Rest - Rest args are not required, you can read those &lt;a href="https://appwrite.io/docs/server/functions#functionsUpdate" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;



&lt;h1&gt;
  
  
  Deleting functions
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb03brt7xrsg8e2ziv0fk.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb03brt7xrsg8e2ziv0fk.jpeg" alt="Delete"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Got fed up by a function and want to delete it forever, well, its easy!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.delete("6172d8bc57f89").then(() =&amp;gt; {
    console.log("Successfully deleted")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well, there isnt anything to explain here. The function name and the parameter describes it. The function delete the function from the database. The parameter is the id of the function.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Function&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5v4sk0i9bnqh9y50hfr3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5v4sk0i9bnqh9y50hfr3.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h2&gt;
  
  
  Creating tags
&lt;/h2&gt;

&lt;p&gt;Now, to create a tag, use the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.createTag("6172e57d60cc5", "foo", "somepath.tar.gz").then(() =&amp;gt; {
    console.log("Successfully created a new tag")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the first parameter takes in the id of the function (target). The second parameter takes in the name of the code extension command. The last is the path of the zipped code.&lt;/p&gt;



&lt;h2&gt;
  
  
  Updating tag id
&lt;/h2&gt;

&lt;p&gt;You can set a custom tag id and use them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.updateTag("6172e57d60cc5", "foo-tag").then(() =&amp;gt; {
    console.log("Succesfully changed the tag!")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, we call the updateTag function. It takes in two parameter - first for the function id while the last for the new name of the tag.&lt;/p&gt;



&lt;h2&gt;
  
  
  Listing tags
&lt;/h2&gt;

&lt;p&gt;Same as that for the function, we may also require to print all the tags. Here is how you can do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.listTags("6172e57d60cc5").then((res) =&amp;gt; {
    let index = 0

    for (const tag of res.tags) {
        console.log(`${index}: ${tag.$id}`)

        index += 1
    }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, we are fetching all the tags available in a function. Then we print the id of all the tags.&lt;/p&gt;



&lt;h2&gt;
  
  
  Getting tag data
&lt;/h2&gt;

&lt;p&gt;Now, we saw how to create tags, list tags, now to fetch a single one?&lt;/p&gt;

&lt;p&gt;Here is how you can do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.getTag("6172e57d60cc5", "foo-tag").then((res) =&amp;gt; {
    console.log("Tag id is", res.$id)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first param is for the function id and the second is for the tag's id. Then we just do a simple console logging.&lt;/p&gt;



&lt;h2&gt;
  
  
  Deleting tags
&lt;/h2&gt;

&lt;p&gt;Are you even fed up of the tag? Here is how you delete it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.deleteTag("6172e57d60cc5", "foo-tag").then(() =&amp;gt; {
    console.log("Successfully deleted the tag")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well, this doesnt require a explanation. &lt;/p&gt;



&lt;h2&gt;
  
  
  Creating executions
&lt;/h2&gt;

&lt;p&gt;After all the tiring work, you now want your application to execute the functions properly.&lt;/p&gt;

&lt;p&gt;Here is how you can create execution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.createExecution("6172e57d60cc5").then((res) =&amp;gt; {
    console.log("Created an excecution")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, this creates up an execution of the function with the id which is passed as an argument.&lt;/p&gt;


 
&lt;h2&gt;
  
  
  Listing executions
&lt;/h2&gt;

&lt;p&gt;Now, do you want to get all the current user function execution logs? As always, its simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.listExecutions("6172e57d60cc5").then((res) =&amp;gt; {
    let index = 0

    for (const tag of res.executions) {
        console.log(`${index}: ${tag.$id}`)

        index += 1
    }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The listExecutions function takes in the function id as a param. It returns an list of objects of the executions.&lt;br&gt;
&lt;a href="https://appwrite.io/docs/models/executionList" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is the format of the return value.&lt;/p&gt;



&lt;h2&gt;
  
  
  Getting execution
&lt;/h2&gt;

&lt;p&gt;Last but not the least, get a single execution. Here is how you can do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions.getExecution("6172e57d60cc5", "5e5ea5c16897e").then((res) =&amp;gt; {
    // Play with the execution object
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, here you run the function getExecution which takes in the function id as the first parameter and the function id as the second parameter. It returns a execution object with multiple different properties, all about that execution&lt;/p&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Thanks for reading this post. I hope that you will have understood how to use the function api with the deno sdk. &lt;/p&gt;

&lt;h2&gt;
  
  
  Github repository
&lt;/h2&gt;

&lt;p&gt;You can get the code &lt;a href="https://github.com/AsianCat54x/Deno-Appwrite" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My github account - &lt;a href="https://github.com/AsianCat54x" rel="noopener noreferrer"&gt;https://github.com/AsianCat54x&lt;/a&gt;&lt;/p&gt;

</description>
      <category>deno</category>
      <category>javascript</category>
      <category>appwrite</category>
    </item>
    <item>
      <title>Appwrite Users Services</title>
      <dc:creator>0xsapphir3</dc:creator>
      <pubDate>Fri, 22 Oct 2021 04:59:09 +0000</pubDate>
      <link>https://dev.to/asiancat54x/appwrite-users-services-4ohk</link>
      <guid>https://dev.to/asiancat54x/appwrite-users-services-4ohk</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9v7gap3s63m903rnn2o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9v7gap3s63m903rnn2o.png" alt="Appwrite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Appwrite?
&lt;/h2&gt;

&lt;p&gt;Appwrite is an end-to-end backend server for Web, Mobile, Native, or Backend apps packaged as a set of Docker microservices. Appwrite abstracts the complexity and repetitiveness required to build a modern backend API from scratch and allows you to build secure apps faster.&lt;/p&gt;



&lt;h2&gt;
  
  
  How will this post be help to you?
&lt;/h2&gt;

&lt;p&gt;This post is for the beginners who are trying to get started with Appwrite. This post teaches you how you can use Appwrite user services in your Appwrite project.&lt;/p&gt;



&lt;h2&gt;
  
  
  What are we going to use?
&lt;/h2&gt;

&lt;p&gt;We will be using:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/appwrite/appwrite" rel="noopener noreferrer"&gt;Appwrite&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/electron/electron" rel="noopener noreferrer"&gt;Electron&lt;/a&gt; as frontend&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/caroso1222/notyf" rel="noopener noreferrer"&gt;Notyf&lt;/a&gt; for displaying toast messages&lt;/li&gt;
&lt;/ol&gt;



&lt;h2&gt;
  
  
  What we will do
&lt;/h2&gt;

&lt;p&gt;We will be creating a simple login / signup form using Appwrite's users services. The registered user can see other users who are registered and check their username , email verification status , registeration date etc.&lt;/p&gt;



&lt;h2&gt;
  
  
  Installing dependencies
&lt;/h2&gt;

&lt;p&gt;Now we will install all the required dependencies for out project&lt;/p&gt;

&lt;p&gt;package.json should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "appwrite-toturial",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "electron ."
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "appwrite": "^4.0.4",
    "dotenv": "^10.0.0",
    "electron": "^15.3.0",
    "moment": "^2.29.1",
    "node-appwrite": "^2.5.1"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run &lt;code&gt;npm install&lt;/code&gt; to install the dependencies!&lt;/p&gt;

&lt;h2&gt;
  
  
  Template
&lt;/h2&gt;

&lt;p&gt;Create three files - index.html , styles.css and app.js&lt;/p&gt;

&lt;p&gt;The code for the frontend (html and css) in the github repository.&lt;/p&gt;

&lt;p&gt;app.js should be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const notyf = new Notyf()

const loginText = document.querySelector(".title-text .login");
const loginForm = document.querySelector("form.login");
const loginBtn = document.querySelector("label.login");
const signupBtn = document.querySelector("label.signup");
const signupLink = document.querySelector("form .signup-link a");

signupBtn.onclick = ((e) =&amp;gt; {
    loginForm.style.marginLeft = "-50%";

    loginText.style.marginLeft = "-50%";
});

loginBtn.onclick = (() =&amp;gt; {
    loginForm.style.marginLeft = "0%";

    loginText.style.marginLeft = "0%";
});

signupLink.onclick = (() =&amp;gt; {
    signupBtn.click();

    return false;
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;index.js:&lt;/p&gt;

&lt;p&gt;This file will be our entrypoint for this application. We will initialize electron here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { app , BrowserWindow } = require("electron")
const path = require("path")

app.on("ready", () =&amp;gt; {
    const window = new BrowserWindow({
        "width": 500,
        "height": 500,
        "webPreferences": {
            "nodeIntegration": true,
            "contextIsolation": false,
        }
    })

    window.loadFile(path.join(__dirname, "index.html"))
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run &lt;code&gt;npm run start&lt;/code&gt; and you should see a login / signup form.&lt;/p&gt;



&lt;h2&gt;
  
  
  Starting the application
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Gather all the input and buttons for getting the data from user&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We will use JavaScript's &lt;code&gt;.querySelector&lt;/code&gt; method for selecting both the buttons and listen for each of them&lt;/p&gt;

&lt;p&gt;In app.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const loginText = document.querySelector(".title-text .login");
const loginForm = document.querySelector("form.login");
const loginBtn = document.querySelector("label.login");
const signupBtn = document.querySelector("label.signup");
const signupLink = document.querySelector("form .signup-link a");

signupBtn.onclick = (() =&amp;gt; {
    loginForm.style.marginLeft = "-50%";

    loginText.style.marginLeft = "-50%";

    signUp()
});

loginBtn.onclick = (() =&amp;gt; {
    loginForm.style.marginLeft = "0%";

    loginText.style.marginLeft = "0%";

    signIn()
});

signupLink.onclick = (() =&amp;gt; {
    signupBtn.click();

    return false;
});

document.addEventListener("keydown" , (e) =&amp;gt; {
    if(e.keyCode === 27){
        const target = document.querySelector(".userInfo")

        if(target.style.opacity == 1){
            target.classList.add("fade")

            target.style.display = "block"

            setTimeout(() =&amp;gt; {
                target.classList.remove("fade")

                target.style.opacity = 0

                target.style.display = "none"
            } , 599)

            notyf.success("Press ESC to close")
        }
    }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we will first start by creating a new user.&lt;/p&gt;

&lt;p&gt;To create a new user, firstly we will have to initialize all the required classes from appwrite.&lt;/p&gt;

&lt;p&gt;Gather projectId , endPoint and api Key from appwrite's dashboard and use them here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sdk = require("node-appwrite")

const client = new sdk.Client()

client.setEndpoint(apiEndPoint)
      .setProject(projectId)
      .setKey(projectAPiKey)

const users = new sdk.Users(client)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we will listen for the click and add user to database&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.querySelector(".signUp_button").addEventListener("click" , (e) =&amp;gt; {
    e.preventDefault()

    const username = document.querySelector(".sign_up_username").value

    const email = document.querySelector(".sign_up_email").value

    const password = document.querySelector(".sign_up_password").value

    if(password.length &amp;lt; 6){
        notyf.error("Password must be at least 6 characters")

        return
    }

    users.create(email , password , username).then((res) =&amp;gt; {
        notyf.success("Successfully Created A New User!")
    })
    .catch((err) =&amp;gt; {
        console.error(err)

        notyf.error("Error while creating a new user!")
    })
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, this is the function which will run on click of the sign up button&lt;/p&gt;

&lt;p&gt;The first line is pretty simple, it prevents the default behaviour. The next three lines are for the user's credentials. Next, we are checking if the length of the password is not less than 6. &lt;code&gt;Note: Appwrite raises an error if the password length is less that 6&lt;/code&gt;. Finally, creating users is pretty simple. The User class which we initiated, will be used to create the user. Now run the file and enter username , email address and password.&lt;/p&gt;

&lt;p&gt;Now, move to the appwrite's dashboard and click the Users button under Develop in left panel. &lt;/p&gt;

&lt;p&gt;Now, you will see that a new user is created and it should look somewhat like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnzmzlicydyv85vqabtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqnzmzlicydyv85vqabtw.png" alt="Demo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Great! We have successfully created sign up form!&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Making login form&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, making login form is as simple as creating user. Instead, it is done using a different module named &lt;code&gt;appwrite&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is how you would do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Import the appwrite module
const { Appwrite } = require("appwrite")
const server = new Appwrite()

server.setEndpoint(endPoint)
      .setProject(projectID)

document.querySelector(".login_button").addEventListener("click" , (e) =&amp;gt; {
    e.preventDefault()

    const email = document.querySelector(".signin_email").value;

    const password = document.querySelector(".signin_password").value

    server.account.createSession(email, password).then((res) =&amp;gt; {
        notyf.success("Successfully logged in!")
    })
    .catch((err) =&amp;gt; {
        notyf.error("Username or password is incorrect!")
    })
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, firstly we are listening for the click. On click, we are gathering username and password from input element in DOM. Next, we are creating a session for the user login. This session can be used for the next time whenever the users opens the app (The session is stored inside of the user's system and can be retrived any time). It would directly take them to dashboard instead to again doing login. So, if the account email and password are correct, we would send a message saying that there was a successful login. If the login email / password is incorrect, we will display invalid credentials message.&lt;/p&gt;

&lt;p&gt;Now, we have successfully created a working login / signup system!&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0h7xrfbmia86v5wt78h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0h7xrfbmia86v5wt78h.jpg" alt="Meme"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;h2&gt;
  
  
  Showing a list of users available
&lt;/h2&gt;

&lt;p&gt;Now that our login / signup system is complete, we will show the users, the names of all the other users registered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
users.list().then((users) =&amp;gt; {
    const parent = document.querySelector(".users")

    for(let user of users.users) {
        const card = document.createElement("div");

        card.addEventListener("click" , parseFunction(showUser , [user["$id"]]));

        card.classList.add("user-card")

        card.innerHTML = user.name;

        parent.appendChild(card);
    }
})
.catch((err) =&amp;gt; {})

const parseFunction = (name , args) =&amp;gt; {
    return () =&amp;gt; name(...args)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, here, firstly, we are requesting to the appwrite to send a list of all the users registered. &lt;code&gt;users.list&lt;/code&gt; returns a object with the list of users. &lt;code&gt;name&lt;/code&gt; gives the name of that specific user. There are other properties too which can be used. You can see them &lt;a href="https://appwrite.io/docs/models/userList" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you run this function, you will see a list of users logged in (even though at first, you will see your own username if you are the only one registered, you can try to sign up with multiple emails and test that out). &lt;/p&gt;

&lt;p&gt;Next, we are just creating a card for showing the user's name.&lt;/p&gt;



&lt;h2&gt;
  
  
  Show user's profile
&lt;/h2&gt;

&lt;p&gt;So, when we will click on a specific user's card, we should see his/her name, when they signed up , and their status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const showUser = (userId) =&amp;gt; {
    users.get(userId).then((user) =&amp;gt; {
        document.querySelector(".userName").innerHTML = "Username: " + user.name
        document.querySelector(".userVerified").innerHTML = "Email Verified: " + (user.emailVerification ? "Verified" : "Not verified")
        document.querySelector(".userRegistration").innerHTML = "Registration: " + moment(user.registration).format("DD/MM/YYYY")
        document.querySelector(".userStatus").innerHTML = "Status: " + (user.status === 0 ? "Unactivated" : user.status === 1 ? "Activated" : "Blocked")

        const target = document.querySelector(".userInfo")

        if(target.style.opacity == 0){
            target.classList.add("unfade")

            target.style.display = "block"

            setTimeout(() =&amp;gt; {
                target.classList.remove("unfade")

                target.style.opacity = 1
            } , 599)

            notyf.success("Press ESC to close")
        }
    })
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, this function fetchs the user according to the user id. Then, we can use the data to show the user's name , whether their email is verified , the date when they registered and their status (whether thay are active, inactive or blocked). &lt;a href="https://appwrite.io/docs/models/user" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is the list of the data that appwrite returns. Next lines are for animation. The block appears with a unfading animation.&lt;/p&gt;



&lt;h2&gt;
  
  
  Updating user's credentials
&lt;/h2&gt;

&lt;p&gt;Now that we have created a system for user sign up, we should also allow users to edit their crendentials.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
document.querySelector(".update").addEventListener("click", (e) =&amp;gt; {
    e.stopImmediatePropagation()

    var f = false

    users.updateEmail(currentUserId , document.querySelector(".editEmail").value).then((res) =&amp;gt; {})
        .catch((err) =&amp;gt; {
            notyf.error("Invalid email")

            f = true
        })

    if(f){
        return
    }

    f = false

    users.updateName(currentUserId , document.querySelector(".editName").value).then((res) =&amp;gt; {})
        .catch((err) =&amp;gt; {
            notyf.error("Invalid email")

            f = true
        })

    if(f){
        return
    }

    f = false

    users.updatePassword(currentUserId , document.querySelector(".editPassword").value).then((res) =&amp;gt; {})
        .catch((err) =&amp;gt; {
            notyf.error("Invalid email")

            f = true
        })

    if(f){
        return
    }

    notyf.success("Successfully changed the credentials")
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, here firstly we are listening for the update button click. On click, we would do the following things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update the email - Get the new email from the input and check if there wasnt any error while updating. If there was, send a toast notification&lt;/li&gt;
&lt;li&gt;Update the username - Get the new username from the input and check if there wasnt any error while updating. If there was, send a toast notification&lt;/li&gt;
&lt;li&gt;Update the password - Get the new password from the input and check if there wasnt any error while updating. If there was, send a toast notification&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Creating logouts
&lt;/h2&gt;

&lt;p&gt;Now, the user should be able to logout. This should go like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
document.querySelector(".logout").addEventListener("click", (e) =&amp;gt; {
    server.account.deleteSession("current")

    const target = document.querySelector('.wrapper')

    const secondtarget = document.querySelector(".dashboard")

    secondtarget.classList.add("fade")

    target.classList.add("unfade")

    target.style.display = "block"

    setTimeout(() =&amp;gt; {
        target.classList.remove("unfade")

        target.style.opacity = 1

        secondtarget.classList.remove("fade")

        secondtarget.style.opacity = 0
    } , 599)

    notyf.success("Successfully logged out")
})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, we are listening for the click on the logout button. Whenever the user clicks the button, we will delete the session that we have created during login. "current" deletes the current session saved in the user's system. As the session is deleted, next time we open up the app, it will redirect to the login / signup page.&lt;/p&gt;

&lt;p&gt;Next lines are for fading and unfading effect for the dashboard and authentication page, respectively. &lt;/p&gt;

&lt;h2&gt;
  
  
  Deleting account
&lt;/h2&gt;

&lt;p&gt;Now that we have created all the elements, we will now allow users to delete their account.&lt;/p&gt;

&lt;p&gt;The code should go like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.querySelector(".delete").addEventListener("click" , (e) =&amp;gt; {
    users.delete(currentUserId)

    const target = document.querySelector('.wrapper')

    const secondtarget = document.querySelector(".dashboard")

    secondtarget.classList.add("fade")

    target.classList.add("unfade")

    target.style.display = "block"

    setTimeout(() =&amp;gt; {
        target.classList.remove("unfade")

        target.style.opacity = 1

        secondtarget.classList.remove("fade")

        secondtarget.style.opacity = 0
    } , 599)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, we will listen for the click on the delete button. Whenever the user clicks it, we will run the function.&lt;/p&gt;

&lt;p&gt;The first line of the function deletes the user from the databse. The next lines are just for the animations just like we did in logout.&lt;/p&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I hope that you will have understood how to use Appwrite's Users Services. This tutorial uses all the services that appwrite provides and bundles them into a project.&lt;/p&gt;

&lt;p&gt;I found out about Appwrite from the Hacktoberfest event. I really love this project. Its simple, easy and most of all - secure and fast. It has a good UI for seeing the requests count, database collections and users. I would really recommend using Appwrite while creating a database application. &lt;/p&gt;

&lt;h2&gt;
  
  
  Github repository
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/AsianCat54x/Appwrite-Tutorial" rel="noopener noreferrer"&gt;Here&lt;/a&gt; is the full source code for this project:  &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>appwrite</category>
    </item>
  </channel>
</rss>
