Docs

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:

mkdir appwrite-ce && \
cd appwrite-ce && \
curl -o docker-compose.yml https://appwrite.io/docker-compose.yml && \
docker-compose up -d --remove-orphans

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. Choose a name for your app 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.

npm install appwrite

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 window.Appwrite();

appwrite
    .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution
    .setProject('455x34dfkj')
;

A Word About API Keys

Do not pass an API Key when initializing your client SDK. This will expose your users to any data your API Key has been granted access to, even if your users do not own it! The API keys are meant to be used from server-side integration only!

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('me@example.com', 'password',
    'https://example.com/success', 'https://example.com/failure');

Full Example

// Init your JS SDK
var appwrite = new window.Appwrite();

appwrite
    .setProject('455x34dfkj');

// Login User
appwrite.auth.login('me@example.com', 'password',
    'https://example.com/success', 'https://example.com/failure');

Next Steps

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.