Docs
Skip to content

Self-hosting

Databases_

Configure the database backend for your self-hosted Appwrite instance. Learn about the supported database options and their configuration.

2 min read

Raw

Appwrite supports PostgreSQL, MariaDB, and MongoDB as database backends. You select the database during installation via the setup wizard and cannot change it after installation.

Regardless of which database you choose, the Appwrite API remains the same. Only the underlying storage engine differs.

CLI installation

If you prefer to skip the setup wizard, you can set the database directly using the --database flag:

Accepted values are postgresql, mariadb, and mongodb.

Supported databases

PostgreSQL

PostgreSQL is a relational SQL database and the default option for new Appwrite installations.

  • Docker image: appwrite/postgres:0.1.0
  • Container name: appwrite-postgresql
  • Default port: 5432

MariaDB

MariaDB is a relational SQL database. It was the default database in Appwrite versions prior to 1.9.0.

  • Docker image: mariadb:10.11
  • Container name: appwrite-mariadb
  • Default port: 3306

MongoDB

MongoDB is a document-based database and was the default in Appwrite 1.9. The installer configures it as a replica set (rs0) and places two helper files that the container needs next to docker-compose.yml: mongo-init.js and mongo-entrypoint.sh.

  • Docker image: mongo:8.2.5
  • Container name: appwrite-mongodb
  • Default port: 27017

Environment variables

All database backends use the same environment variables. The values differ depending on which database you selected during installation.

VariableDescriptionPostgreSQL defaultMariaDB defaultMongoDB default
_APP_DB_ADAPTERDatabase adapter typepostgresqlmariadbmongodb
_APP_DB_HOSTDatabase server hostnamepostgresqlmariadbmongodb
_APP_DB_PORTDatabase server port5432330627017
_APP_DB_SCHEMADatabase nameappwriteappwriteappwrite
_APP_DB_USERDatabase useruseruseruser
_APP_DB_PASSDatabase user passwordpasswordpasswordpassword
_APP_DB_ROOT_PASSDatabase root passwordrootsecretpasswordrootsecretpasswordrootsecretpassword

The installer writes only the selected database's service into your docker-compose.yml, so the other database containers never run.

Backups

For database backup procedures, see the Backups guide.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.