> ## Documentation Index
> Fetch the complete documentation index at: https://docs.azvian.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Backups

> Create, download and automate database backups from Settings → Backups

> [!NOTE]
>
> The Backups tab arrived in version **0.3.5**.

A backup is a copy of your **database**: affiliates, referrals, commissions, payouts, settings and your team. It is the part of Affiliate Manager that cannot be re-downloaded, so it is the part worth protecting. Open **Settings → Backups** (administrators only).

## Create a backup

Press **Create a backup now**. It takes a few seconds, longer for a very large database. The backup appears under **Your backups** with when it was made, its type and its size.

| Your database | What you get |
| - | - |
| MySQL or MariaDB | A standard **SQL dump** (`.sql.gz`) |
| SQLite | A copy of the **database file** (`.sqlite.gz`), or a SQL dump (`.sql.gz`) on the rare hosting whose SQLite cannot copy its file |

Press **Download** to save a backup to your computer, or **Delete** to remove it from the server.

> [!WARNING]
>
> **A backup on the same server does not protect you if the server is lost.** Download the backups you care about and keep a copy somewhere else. Backups contain personal data (affiliates' names, emails and payout details), so keep them private.

Backups are stored in `storage/app/backups`, outside the public web folder, and only administrators can list, download or delete them.

## Automatic nightly backups

Under **Automatic backups**, tick **Back up automatically every night** and choose how many to **Keep** (1 to 60, default 7). A backup is made at about 02:30 every night, and older ones beyond that number are deleted afterwards, manual ones included.

This needs the [cron job](https://docs.azvian.com/affiliate-manager/installation.md#after-installing) to be running. If a nightly backup fails (for example the disk is full), the dashboard says so and the Backups page shows why.

## What a backup does not contain

* **Your `.env` file.** It holds the app key that unlocks everything stored encrypted: affiliates' payout details, your SMTP password and your license key. A database backup restored without the same app key cannot read those fields, so **keep your own copy of `.env`** somewhere safe. It is deliberately left out of backups so that it never travels inside a downloadable file.
* **The program files.** They come from the release zip.
* **Your uploaded logo.** Upload it again after a restore.

## Restoring a backup

> [tab] MySQL or MariaDB
>
> In phpMyAdmin (or your host's database tool), choose your database, open **Import**, and select the downloaded `.sql.gz` file as it is. It replaces the tables in that database. From a terminal:
>
> ```bash theme={null}
> gunzip -c backup-20261021-024500-ab12.sql.gz | mysql -u USER -p DATABASE
> ```
>
> Restore into the **same version** of Affiliate Manager that made the backup, then, if you are on a newer version, open the site so the database upgrades itself.

> [tab] SQLite
>
> Unzip the download, then replace your database file with it. The path is the `DB_DATABASE` line in your `.env`. Reload the site. If you received a `.sql.gz` file instead, run `sqlite3 NEW-DATABASE-FILE < the-unzipped-file.sql`.

## Before an update

The [Updates tab](https://docs.azvian.com/affiliate-manager/updating.md) links here and shows when your last backup was made. Make one before you update.

## Large databases

Backups are made in one request. For a database of many hundreds of megabytes, or on hosting with a very short time limit, use phpMyAdmin or your host's own backup tool instead.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.