How to Install Appwrite on VPS with Docker: A Complete Backend Without Writing Your Own Server
A web app usually needs more than a front page: user login, a database, file storage, and maybe email for account verification. Building each piece from scratch means writing your own authentication, designing table schemas, and handling file uploads — work that repeats in almost every project. Appwrite packs all of that into one backend platform you run on your own VPS, with a web console to manage it.
Unlike a backend service that asks you to hand your data to someone else's servers, Appwrite runs as a set of Docker containers on your machine. This guide installs it with the project's official installer, opens the console through a secure SSH tunnel, and creates a first project with its API key.
Before you start: what you need
- A VPS with Docker and Docker Compose v2 already installed.
- SSH access to that VPS.
- Free ports
80and443if you plan to use your own domain with HTTPS later. - Enough disk space for the Appwrite images and their companion services; the installer pulls several images at once, so the first run takes longer than a single-container install.
Check Docker and Compose:
docker --version docker compose versionExpected result: both commands print a version number with no error message.
Step 1: run the official installer
Appwrite is not installed by hand-writing a Compose file from scratch. The project ships an installer that generates the Compose file and its environment variables for you. Create a working folder, then run installer version 2.7.2:
mkdir -p ~/appwrite-install cd ~/appwrite-install docker run -it --rm \ --publish 127.0.0.1:20080:20080 \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ appwrite/appwrite:2.7.2Note that the wizard is now published on localhost only, and the installer prints a one-time secret to the terminal — open the printed URL to finish the wizard; for a remote host, the SSH tunnel to 127.0.0.1:20080 is still the right way in.
Note the two volume mappings in that command. Mapping /var/run/docker.sock gives the installer access to the host Docker daemon so it can start the Appwrite stack; run this only on a server you control. The second mapping stores the installation output in the appwrite folder inside your working directory.
The installer runs interactively: it asks for the HTTP and HTTPS ports and the hostname Appwrite should use. Enter your domain if you already have one, for example backend.example.com, or leave it for an initial setup if you only want to try it on the server's own network for now. After you answer, the installer pulls the required images and brings up its Compose stack. Wait for this to finish; pulling many images over a slow connection can take several minutes.
Expected result: no error at the end of the run, and the appwrite folder now contains a generated docker-compose.yml plus a .env file.
Step 2: open the console through an SSH tunnel
According to the official announcement for version 1.9.6, after a first install you finish the setup wizard at http://localhost:20080. On a VPS, do not open that port to the internet. Create an SSH tunnel from your own computer:
ssh -L 20080:localhost:20080 root@YOUR-VPS-IPWhile the tunnel is active, open http://localhost:20080 in your computer's browser and follow the setup wizard to create the first admin account. Use an email address you actually use and a long password, because this account holds full control over the whole installation.
Expected result: the Appwrite console opens and shows the main page where you can create a project. If the page does not open, first check whether the SSH tunnel is still running, then check the stack status from inside the installation folder:
cd ~/appwrite-install/appwrite docker compose ps docker compose logs appwriteExpected result: the Appwrite containers show as running, and the appwrite container's log shows no repeating error.
The diagram above sums up the architecture: your app talks to a single Appwrite endpoint, and behind it Appwrite runs authentication, databases, file storage, and serverless functions as separate services wired together.
Step 3: create your first project and its API key
In the console, create a new project and name it after your app, for example my-app. Each Appwrite project has its own project ID and API endpoint, so one installation can serve several apps without mixing their data.
Once the project exists, open its settings and note two values:
- Project ID — the identifier your app uses when it contacts Appwrite.
- API Endpoint — the base API address, which on this installation points to your domain or server address.
Next, create one API key from the project settings for server-side use, for example for administrative operations from your backend code. Give that key only the permissions it actually needs: a full-access key leaked into a public repository is as dangerous as a leaked admin password. Store the key in your app's environment variables, not in source code.
For client-side apps, the usual pattern is: the app calls the Appwrite endpoint with the project ID, users sign in through the Auth service, and data lives in Databases with per-collection permission rules. You do not need to write your own authentication server for this flow; Appwrite handles sessions, email verification, and per-document access rules.
Appwrite API documentation: using your backend from code
By now Appwrite is running and your first project exists. The part people usually skip: everything you click in the console is really an API call. Once you see the pattern, any app can talk to Appwrite without opening the console at all.
Your installation's API endpoint is the domain you entered during setup, plus /v1. If your domain is backend.example.com, the endpoint is https://backend.example.com/v1. Every service — Auth, TablesDB, Storage, Functions — is available over REST and GraphQL on that same endpoint; GraphQL is served at /v1/graphql. The full reference for each endpoint lives at https://appwrite.io/docs/references.
Three headers decide whether your call gets through:
| Header | Required? | What it does |
|---|---|---|
X-Appwrite-Project | Yes | The ID of the project you are calling |
Content-Type: application/json | Yes | The format of the request body |
X-Appwrite-Key | For server-side calls | The API key for server authentication — a secret, never to be used in client-side apps |
Create the key in the console under Overview → Integrations → API keys, and grant only the scopes it needs. Creating a database requires the databases.write scope.
The quickest first test is creating one database with curl:
curl -X POST https://backend.example.com/v1/tablesdb \
-H "Content-Type: application/json" \
-H "X-Appwrite-Project: YOUR-PROJECT-ID" \
-H "X-Appwrite-Key: YOUR-API-KEY" \
-d '{"databaseId": "unique()", "name": "example"}'Expected result: an HTTP 201 response containing the newly created database object, including its ID. The "unique()" string in databaseId asks Appwrite to generate a random ID — the same thing SDKs do through ID.unique(). Replace backend.example.com, YOUR-PROJECT-ID, and YOUR-API-KEY with your own installation's values.
Two things worth knowing before you write more code:
- The old
POST /v1/databasesendpoint has been deprecated since Appwrite 1.8.0. To create a database, usePOST /v1/tablesdbas in the example above. - If you would rather not write raw HTTP calls, use an official SDK (Web, Node.js, Python, PHP, Flutter, and more — the full list with versions is at https://appwrite.io/docs/sdks). SDKs wrap the same endpoints, so the header and scope pattern above still applies underneath.
Step 4: secure the console and manage the stack
The Appwrite console is the most sensitive panel in this installation. A few hardening steps worth doing from day one:
- Do not publish the console over plain HTTP with no extra authentication. If you place it behind a reverse proxy such as Nginx Proxy Manager, protect it with HTTPS and make sure only you can reach the panel.
- Close port
20080to public access once the wizard is done; that port is only needed during initial setup. - Back up the
appwritefolder regularly, since that is where the Compose file, environment variables, and data volume references for your installation live. A simple backup command:
cd ~/appwrite-install cp -r appwrite appwrite.backupFor day-to-day operations, every Compose command runs from inside the installation folder:
cd ~/appwrite-install/appwrite docker compose ps docker compose up -d docker compose downdocker compose up -d brings the stack back after a server reboot or a configuration change, while docker compose down stops it. Expected result after up -d: every container returns to running.
Updating Appwrite
The current stable version is 2.7.2, and upgrading straight from 1.9.6 to 2.7.2 is supported in a single step — run the upgrade command with the 2.7.2 tag, then the migration. Back up the installation folder first, and read the release notes of any versions you are skipping if the installation has not been updated in a while. If you would rather stay on the 1.9 line, move to at least 1.9.10, which fixes the Brotli decoder vulnerability CVE-2026-111497.
cd ~/appwrite-install docker run -it --rm \ --publish 127.0.0.1:20080:20080 \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="upgrade" \ appwrite/appwrite:2.7.2After the upgrade finishes, run the migration from inside the installation folder:
cd appwrite/ docker compose exec appwrite migrateExpected result: the migration command finishes without error, and the console opens again. Do not skip the migration step after an upgrade, because Appwrite's internal database schema can lag behind the new code version.
Common errors and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| Installer stops midway through pulling images | Slow connection or disk full | Check disk space with df -h, free space if needed, then run the installer again |
Wizard on port 20080 does not open | SSH tunnel not active, or stack not finished starting | Make sure the ssh -L command is still running, wait a few minutes, then check docker compose ps |
| Containers restarting in a loop | One companion service failing to start | Check docker compose logs for the failing container name and its last error message |
| Console login fails after install | Admin credentials mistyped during the wizard | Retry with the correct email and password; if the account was never created, check the appwrite container log |
| App cannot reach the endpoint | Wrong project ID, or domain not pointing at the VPS | Verify the project ID in project settings and your domain's DNS record |
| API key rejected | Key permissions do not cover the requested operation | Create a new key with the matching permission scope, and check your app's environment variables |
Summary
| Item | Value used |
|---|---|
| Installer image | appwrite/appwrite:2.7.2 |
| API endpoint | https://your-domain/v1 |
| GraphQL | /v1/graphql |
| API reference | https://appwrite.io/docs/references |
| Install command | docker run with the install entrypoint |
| Installation volume | $(pwd)/appwrite:/usr/src/code/appwrite:rw |
| Setup wizard port | 20080 (through an SSH tunnel) |
| Stack folder | ~/appwrite-install/appwrite |
| Status command | docker compose ps from the stack folder |
| Upgrade command | docker run with the upgrade entrypoint |
| Migration command | docker compose exec appwrite migrate |
| Main hardening | SSH tunnel, HTTPS on the reverse proxy, installation folder backup |
Final checklist
- [ ] Installer finished without error and the
appwritefolder exists. - [ ] Setup wizard opened through the SSH tunnel and the admin account is created.
- [ ] First project created and its project ID noted.
- [ ] API key created with minimal permissions and stored in environment variables.
- [ ] A test call to
POST /v1/tablesdbreturns HTTP201and the new database shows up in the console. - [ ] Port
20080not exposed to the internet after setup finished. - [ ] Installation folder backed up before the next update.
Which Appwrite feature do you need first — user login, databases, or file storage — and what app will use your first project? Tell us in the comments, because the answer decides which collections and permission rules are worth setting up next.
Read also: the Rnevio article "How to Install PocketBase on a VPS with Docker: A Complete Backend in a Single Binary" compares a far lighter self-hosted backend approach, while the companion guide in this batch is available in the Directus guide to a headless CMS with the Data Studio panel.


Diskusi
Ada pertanyaan atau pengalaman yang ingin dibagikan?
Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.
Tulis komentar