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 MongoDB and MariaDB as database backends. The database is selected during installation via the setup wizard and cannot be changed 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 mongodb and mariadb.

Supported databases

MongoDB

MongoDB is a document-based database and the default option for new Appwrite installations. It is configured as a replica set (rs0) automatically during installation.

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

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

Environment variables

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

VariableDescriptionMongoDB defaultMariaDB default
_APP_DB_ADAPTERDatabase adapter typemongodbmariadb
_APP_DB_HOSTDatabase server hostnamemongodbmariadb
_APP_DB_PORTDatabase server port270173306
_APP_DB_SCHEMADatabase nameappwriteappwrite
_APP_DB_USERDatabase useruseruser
_APP_DB_PASSDatabase user passwordpasswordpassword
_APP_DB_ROOT_PASSDatabase root passwordrootsecretpasswordrootsecretpassword

The Docker Compose profile controls which database container runs. This is set automatically by the installer:

  • COMPOSE_PROFILES=mongodb for MongoDB installations
  • COMPOSE_PROFILES=mariadb for MariaDB installations

Backups

For database backup procedures, see the Backups guide, which covers both MongoDB and MariaDB backup and restore commands.

Was this page helpful?

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