+++
title = "Backup and Restore"
weight = 10
+++

Meshy can back up your device configuration, contacts, channels, messages, and more to a human-readable JSON file. Backups are accessible from the **Settings** screen in the sidebar under **Backup & Restore**.

## What Can Be Backed Up

The backup dialog lets you choose which sections to include:

- **Device Identity** -- the device's private key (opt-in, unchecked by default for security). Requires fetching the key from the companion device at export time.
- **Settings** -- device settings (radio parameters, location, advert policy), local settings (default flood scope), and regions.
- **Contacts** -- your contact list and discovered contacts from adverts.
- **Channels** -- channel names and pre-shared keys (PSKs).
- **Messages and Routing** -- direct messages, channel messages, room/repeater passwords, per-channel notification levels, and smart route history.

## Manual Backup

Click **Backup → Manual** in the sidebar. A dialog lets you select which sections to include. Click **Export** to save a JSON file. The filename includes the device name and a timestamp, e.g. `MyNode_meshcore_config_2026-07-03-143000.json`.

## Automatic Backup

Click **Backup → Automatic** to configure daily backups. When enabled, Meshy creates a backup after each sync with the device. Auto-backups are stored locally and the last 7 days are kept -- older backups are pruned automatically. Device identity is never included in automatic backups.

Auto-backup files are stored in:
```
~/.var/app/page.codeberg.sesivany.Meshy/data/meshy/backups/
```
For native builds: `~/.local/share/meshy/backups/`.

## Restore from File

Click **Restore → From File** in the sidebar. After selecting a JSON backup file, a preview dialog shows the source device name and lets you choose which sections to restore. Sections not present in the backup file are greyed out.

## Restore from Auto Backup

Click **Restore → From Auto Backup** to see a list of automatic backups for the currently connected device, sorted by date. Select one and click **Restore** to open the same section picker as manual restore.

## How Restore Works

- **Contacts** are sent to the device via ADD_UPDATE_CONTACT commands. Contacts already present on the device (matched by public key) are skipped.
- **Channels** are pushed via SET_CHANNEL commands into the first available slots. Channels with a matching PSK are skipped.
- **Device settings** (radio parameters, location, advert policy, auto-add configuration) are applied as individual commands to the companion.
- **Device identity** imports the private key to the companion device. This effectively replaces the device's identity.
- **Messages** are imported into the local database. Duplicate messages (matched by contact key, timestamp, and text) are skipped.
- **Regions, discovered contacts, route history, and local settings** are restored into the local database.

After restore, Meshy re-syncs with the device to refresh the contact list, channels, and device info.

## Database Location

The SQLite database is stored at:
```
~/.var/app/page.codeberg.sesivany.Meshy/data/meshy/
```

For Flatpak installations. For native builds, check `~/.local/share/meshy/`.
