Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 12, 2022 06:13 pm GMT

A Guide On Appwrite

Introduction

How does it feel to have a fully secured, open-source, and self-hosted backend platform? that can be deployed on your preferred cloud tools and easily integrated with any frontend framework? That sounds fantastic, doesn't it? Well, don't worry because Appwrite is here to save the day. So, what exactly is Appwrite?
Appwrite is a self-hosted Backend-as-a-Service (BaaS) platform that gives you all of the core APIs, tools, and management console UI you need to build your application faster and more securely. Appwrite is compatible with any operating system, programming language, framework, or platform. This guide will walk you through the Appwrite installation process, its services, its competitors, and why you should use Appwrite.

Installation

Appwrite can be installed in two ways. You can use the one-click installation method to get Appwrite up and running on DigitalOcean or Gitpod pretty quickly. If you want to use this method of installation, you can learn more about it Here.
You will be installing Appwrite using Docker in this guide; if you do not already have Docker installed on your system, please click Here to download and install it.

You can now install Appwrite. To achieve this:

  • Confirm that you have installed Docker and that it is running.
  • Go to Appwrite.io.
  • Click on the Get Started button.
  • Copy the following command(Appwrite server is stored as a Docker container, which you can quickly set up from your terminal using the docker-compose command).
docker run -it --rm \    --volume /var/run/docker.sock:/var/run/docker.sock \    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \    --entrypoint="install" \    appwrite/appwrite:1.0.3
  • Open your terminal and paste it there.
  • Press the enter key.
  • During installation, you will be asked where you want to run your HTTP port, as shown below.

Image description

  • You can make port80your default.- You will then be asked to select a secret API, which can be your name, as shown below.

Image description

  • You will be prompted to enter your Appwrite hostname, which should be the local host.
  • You will be prompted to enter your DNS record; continue to use the hostname for this.
  • Press the enter key and wait for it to be fully installed; you should see the message Appwrite installed successfully once the installation is complete.

Image description

If you go to your Docker, you should see your Appwrite container running, which has 20 other containers, as shown below.

Image description
To sign in to Appwrite, open your browser and type

localhost:80


Then enter your information as shown below.

Image description
If you do not already have an Appwrite account, you should create one before you can log in. After signing into Appwrite, you'll be able to see your dashboard and create a new project, as shown below.

Image description

Appwrite services

These are the Appwrite services; the team service will be covered in detail later.

Users API

The user service is used to manage the users in your project. It is used to search for and block users, as well as to view your user information, current section, and most recent activity. You can also update your user's preferences and personal information through your user service.

Image description

Databases API

This service enables you to create structured document collections, query and filter document lists, and manage an advanced set of read and write access permissions.

Image description

Storage API

This service enables you to manage your project files by uploading, viewing, downloading, and querying all of your project files. Files are managed in this service using buckets. Collections in the databases service are similar to storage buckets. The difference is that buckets have more power to decide what types of files and sizes you want to allow in that bucket, as well as whether or not to encrypt the files, use antivirus, and much more.

Image description

Localization API

This service enables you to modify your app dashboard based on the location of your users. You can get your user's location, IP address, list of countries and continent names, phone codes, currencies, and more by using this service.

Functions API

This service aids in the discovery of custom behavior that can be triggered by any supported Appwrite system event or a predefined schedule.

Image description

Avatars API

The service aims to help you complete your daily tasks that are related to your app image, icons, and avatars.

Health API

You can use this service to validate and monitor your Appwrite server instance, ensuring that all of its internal components are up and running and responsive.

Account API

You can use this service to manage and authenticate a user account. It is also used to update user information, retrieve user sections across multiple devices, and retrieve user security logs containing recent activity. You can use the account service to register new user accounts,using the Create Account,Create Magic URL session, or Create Phone session endpoint. You can authenticate the user account using any of the available signing methods. Once a user has been authenticated, a new session object is created to allow the user access to his or her private data and settings.
One of the account service's fantastic features is the multiple sign-in methods, which allow you to authenticate a user. Following authentication, a new session object will be created to allow the user access to his or her private data or settings.

Teams API

The team service enables you to group project users and give them read and write access to project resources such as database documents or storage files.
When a user creates a team, he or she becomes the team owner and can exercise ownership by inviting a new team member. Only team owners can invite users.
You will go through a series of team service sessions that will help you create a team in Appwrite.

Create Team

When a user creates a team, he or she becomes the team owner, and only the owner can invite new members, add new owners, update the team, and delete the team.
Here's an example of how to use the Create Team Endpoint.

import { Client, Teams } from "appwrite";const client = new Client();const teams = new Teams(client);client    .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint    .setProject('5df5acd0d48c2') // Your project ID;const promise = teams.create('[TEAM_ID]', '[NAME]');promise.then(function (response) {    console.log(response); // Success}, function (error) {    console.log(error); // Failure});

Image description

Image description

List Teams

This endpoint returns a list of all the teams that the current user is a member of. You can use the parameters to select your results. It also returns a list of all the latest project teams.
The List Team Endpoint is demonstrated in the code below.

import { Client, Teams } from "appwrite";const client = new Client();const teams = new Teams(client);client    .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint    .setProject('5df5acd0d48c2') // Your project ID;const promise = teams.list();promise.then(function (response) {    console.log(response); // Success}, function (error) {    console.log(error); // Failure});
Get Team

You can get a team by its ID using this Endpoint. This resource is accessible for all team members to read.
The Get Team Endpoint is demonstrated in the code below.

import { Client, Teams } from "appwrite";const client = new Client();const teams = new Teams(client);client    .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint    .setProject('5df5acd0d48c2') // Your project ID;const promise = teams.get('[TEAM_ID]');promise.then(function (response) {    console.log(response); // Success}, function (error) {    console.log(error); // Failure});
Update Team

You can use this endpoint to update a team using its ID, and the update can be performed by members who have the owner role.
The Update Team Endpoint is demonstrated in the code below.

import { Client, Teams } from "appwrite";const client = new Client();const teams = new Teams(client);client    .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint    .setProject('5df5acd0d48c2') // Your project ID;const promise = teams.update('[TEAM_ID]', '[NAME]');promise.then(function (response) {    console.log(response); // Success}, function (error) {    console.log(error); // Failure});

Image description

Delete Team

You can use this endpoint to delete a team using its ID, and the update can be performed by members who have the owner role.
The Delete Team Endpoint is demonstrated in the code below.

import { Client, Teams } from "appwrite";const client = new Client();const teams = new Teams(client);client    .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint    .setProject('5df5acd0d48c2') // Your project ID;const promise = teams.delete('[TEAM_ID]');promise.then(function (response) {    console.log(response); // Success}, function (error) {    console.log(error); // Failure});

Image description

Why Appwrite

There are numerous reasons why you should use Appwrite,

  • one of which is that it is self-hosted.
  • Appwrite was designed with scalability in mind.
  • Appwrite can scale both horizontally and vertically, using a small number of containers to run where each container has its own job.
  • It is fast and secure.
  • It can handle access control.
  • Appwrite has a completely stateless architecture.
  • It supports multi-tenancy, which means that a single Appwrite instance can support an unlimited number of accounts and projects.
  • It has pre-built images that you can launch with a single click of the Do button.
  • It was created to work alongside the stack you are currently using.
  • It works fine with your current backend.
  • It supports Cloud functions and has over 15 runtimes, making it simple to implement any custom logic.

Appwrite vs Competitors

Supabase

Both Supabase and Appwrite are fantastic products, but Appwrite focuses on ease of use and increased productivity. This is done by maintaining a positive developer experience.

Image description

Firebase

Appwrite has a beautiful user interface, is simple to set up, and is consistent across platforms. Firebase is expensive, has limited scalability, is not open source, relies on a third party, cannot filter queries, and is not flexible.

Image description

Parse

Appwrite was created to work in a Docker-oriented environment, making it simple to deploy an infrastructure that already relies on Docker, is security-focused, and includes many security-driven features.

Image description

Conclusion

You should now have a good understanding of how Appwrite works, its features, and services. You can join Appwrite's Discord community here. to learn more about it. You can also visit its webpage. or repository .for additional information and resources.


Original Link: https://dev.to/puenehfaith/a-guide-on-appwrite-2lee

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To