Getting Started 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.
This tutorial will help you start using Appwrite products and build your next project.
Set Up a Self Hosted Environment
Appwrite backend server is designed to run in a container environment. Running your server is as easy as running one command from your terminal. You can run Appwrite on your localhost using docker-compose or on any other container orchestration tool like Kubernetes, Docker Swarm or Rancher.
The easiest way to start running your Appwrite server is by running our docker-compose file. Before running the installation command make sure you have Docker installed on your machine:
Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please notice that on non-linux native hosts the server might take a few minutes to start after installation completes.
Create Your First Appwrite Project
Go to your new Appwrite console and once inside click the icon in the top navigation header or on the 'Create Project' button on your console homepage. Choose a name for your project and click create to get started.
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 project production and development domains in the form clients field. By adding your domain to your project platform you are allowing cross-domain communication between your project and Appwrite servers
Get Appwrite JS SDK
Use JS package manager, NPM from your command line to add Appwrite SDK to your project.
import * as Appwrite from "appwrite";
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:
Init your SDK
Initialize your SDK code with your project ID which can be found in your project settings page.
// Init your JS SDK var appwrite = new Appwrite(); appwrite .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution .setProject('455x34dfkj') ;
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.
// Login User appwrite.auth.login('email@example.com', 'password', 'https://example.com/success', 'https://example.com/failure');
// Init your JS SDK var appwrite = new Appwrite(); appwrite .setProject('455x34dfkj'); // Login User appwrite.auth.login('firstname.lastname@example.org', 'password', 'https://example.com/success', 'https://example.com/failure');
Appwrite has many services and tools to help improve your app and speed up your development. The best way to learn how you can take advantage of them is to explore the different API references docs.