Contents
💡 What is Appwrite?
Appwrite is an open-source backend server for web and mobile applications. It is similar to Firebase, AWS Amplify, and Supabase in terms of features and APIs, including Authentication (User management), Database Management, Storage, and Cloud Functions.
It is a self-hosted solution that provides developers with a set of easy-to-use and integrate REST APIs to manage their core backend needs.
✨ Amazing Features!
It can run on any operating system and the Console User Interface provides you with a great variety of services you can use with your project!
Database -Store, query and manage access control to your app documents
Storage - Upload, download and preview your app and users files and media
Users - Authenticate, confirm and manage your users using multiple signin methods
GEO & Localization - Detect your users location, locale and fetch GEO related data
Functions - Run your backend code in a secure and isolated environment to customize your app
Console - Track your backend API usage and manage your project resources from a modern UI
..... and others including privacy, security and many more.
🤔 Why Appwrite is better?
No Cost
Appwrite is open-source, so we can expect everything for free here. Others options by companies like Microsoft, Amazon etc. can get expensive as you scale your product up. Appwrite has an upper edge here.-
Usage Statistics
Using the usage statistics provided by AppWrite, you can easily get to know which projects -- take up the most space
- use more CPU time, You can even see
- the bandwidth usage on each project separately ..... and many more stats.
API support
Due to the amount of APIs that Appwrite provides to a user, building projects is much easier with having to do difficult task of bundling API servers together.Task Manager
Using Appwrite, you can schedule an automatic function execution using cron syntax. This function can do anything from sending newsletter emails to buying you a pizza. No limitations at all.Community Support
AppWrite has a great community support that is ready to help you all the time. If you have any doubt or query, you can have a chat in their discord server, and you will get your query resolved faster than any other forums.
📩 Installation
The easiest way to start running your Appwrite server is by running our Docker installer tool from your terminal.
Before running the installation command, make sure you have Docker CLI installed on your host machine.
For Unix
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:0.11.0
For Windows
docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:0.11.0
Note :
- Hyper-V and Containers Windows features must be enabled to run Appwrite on Windows with Docker.
- If you don't have these features available, you can install Docker Toolbox that uses Virtualbox to run Appwrite on a Virtual Machine.
💥 Lets Try it Out
Appwrite can be used for Web, Apple, Flutter, Android etc. Here we will try to understand how to use it for Web.
Appwrite is a development platform providing you easy yet powerful API and management console to get your next project up and running quickly.
We will learn how ca you start using Appwrite products and build your next project. Before starting, make sure you have followed the Appwrite installation, and you have an Appwrite server instance up and running on your host machine or server.
Step 1 : Create Your First Appwrite Project
Go to your new Appwrite console and once inside click the
'Create Project' button on your console homepage. Choose a name for your project and click create to get started.
Step 2 : Add Your Web Platform
For you to init your SDK and interact with Appwrite services you need to add a web platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before and click the 'Add Platform' button.
From the options, choose to add a web platform and add your client app hostname. By adding your hostname to your project platform you are allowing cross-domain communication between your project and the Appwrite API.
Step 3 : Get Appwrite Web SDK
NPM
Use NPM (node package manager) from your command line to add Appwrite SDK to your project.
npm install appwrite
If you're using a bundler (like Browserify or webpack), you can import the Appwrite module when you need it:
import { Appwrite } from "appwrite";
CDN
To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services:
<script src="https://cdn.jsdelivr.net/npm/appwrite@4.0.4">
</script>
Init your SDK
Initialize your SDK code with your project ID which can be found in your project settings page.
// Init your Web SDK
const appwrite = new Appwrite();
appwrite
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj') // Your project ID
;
Step 4 : Make Your First Request
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section.
// Register User
appwrite
.account.create('me@example.com', 'password', 'Jane Doe')
.then(response => {
console.log(response);
}, error => {
console.log(error);
});
Step 5 : Listen to Changes
If you want to listen to changes in realtime from Appwrite, you can subscribe to a variety of channels and receive updates within milliseconds. Full documentation for Realtime can be found here.
// Subscribe to files channel
appwrite.subscribe('files', response => {
if(response.event === 'storage.files.create') {
// Log when a new file is uploaded
console.log(response.payload);
}
});
Lets put everything together
// Init your Web SDK
const appwrite = new Appwrite();
appwrite
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint
.setProject('455x34dfkj') // Your project ID
// Register User
appwrite
.account.create('me@example.com', 'password', 'Jane Doe')
.then(response => {
console.log(response);
}, error => {
console.log(error);
});
// Subscribe to files channel
appwrite.subscribe('files', response => {
if(response.event === 'storage.files.create') {
// Log when a new file is uploaded
console.log(response.payload);
}
});
Bonus 🔥
- Resources
Appwrite | 🔗 |
---|---|
Github Repo | Visit Repo |
Documentation | Visit Docs |
Discord | Join Sever |
30 Days of Appwrite | Lets Start |
- Demos
Demo | 🔗 | 🔗 |
---|---|---|
Todo App with React JS | Visit Repo | See Live |
Todo App with Vue JS | Visit Repo | See Live |
Todo App with Angular | Visit Repo | See Live |
Todo App with Svelte | Visit Repo | See Live |
Announcing Appwrite 0.9: The open source Firebase alternative
Christy Jacob for Appwrite ・ Jul 7 '21
Authentication - Exploring Appwrite.io with React Series
Daryl Lukas ・ Jun 26 '21
Magic URL authentication with Flutter + Appwrite
Damodar Lohani for Appwrite ・ Sep 8 '21
If you got to learn something new and useful show some love by giving this post a ❤️
If you find it useful for you, save this post and share it with your programming buddies 😃
Have you tried Appwrite? Share your experience in the comment section! 💬
Top comments (7)
good to know: Appwrite is among the top open-source repo for Hacktoberfest: dev.to/taipy/top-5-open-source-pro...
Great write-up @hardikchopra242 . first time hearing about app-write, definitely going to learn more.
Incase you are on fish shell: the above command will throw errors as is, this one works though:
Thanks @ken_mwaura1 😃🙌
Thanks for the article, i'll give it a shot 😃
Thank you 😃
Great work bro, Surely gonna try Appwrite.
Thanks 😊