# Data Safety

This guide covers the practical recovery tools available in Brewfather today:

* Exporting a full JSON backup
* Importing backup data safely
* Restoring from history
* Offline and connection recovery settings

## Where to find these tools

Open **Settings** and use these sections:

* **Data**
  * **Export user data to JSON**
  * **Import user data from JSON**
  * **View and restore historic data**
* **Application**
  * **Offline Support**
  * **Clear Offline Storage**
  * **Alternative connection mode**

## 1) Export a full backup (web)

Use **Settings → Data → Export user data to JSON**.

What the export includes:

* Recipes
* Batches
* Profiles (equipment, mash, fermentation, water, custom styles)
* Inventory (fermentables, hops, miscs, yeasts)
* Your current settings

Notes:

* Export is currently shown in the web app flow.
* Export is Premium-gated.
* Keep your JSON backup file in a safe place.

## 2) Import backup data (web)

Use **Settings → Data → Import user data from JSON**, then choose your backup file.

After loading a valid Brewfather backup, Brewfather lets you choose exactly what to import (recipes, batches, inventory groups, and profile groups).

Important behavior:

* Imports are Premium-gated and require an active premium state.
* Imported data can overwrite existing data.
* You do **not** have to import everything; select only what you need.

Current per-import caps in the app:

* Recipes: up to **2000**
* Batches: up to **2000**
* Each inventory/profile category: up to **1000**

## 3) Restore from History

Use **Settings → Data → History**.

History currently provides:

* Limited change history for **batches**
* **Delete history** for recipes
* Date-range filtering with **From** and **To** selectors
* Up to **250** entries for the selected date range

If you set **From** later than **To**, Brewfather automatically swaps the range before loading results.

When you open an entry, you can restore to:

* **Before** the selected change, or
* **After** the selected change

Restore safeguards:

* Restore actions are Premium-gated.
* Brewfather asks for confirmation and requires typing `CONFIRM`.
* Restoring replaces current data for that item, so newer changes to that item are lost.

## 4) Offline and connection recovery tools

### Offline Support

* This is a **device-level** setting.
* In current app behavior it is disabled by default unless you explicitly enable it.
* Turning it on/off requires a reload to fully apply.

### Clear Offline Storage

* Removes locally stored cached data on this device.
* Brewfather warns that unsynced data can be lost.

### Alternative connection mode

* Device-level fallback mode for connectivity problems.
* Brewfather warns this mode can reduce network performance.
* Use it only if you have persistent connection issues.

## Practical recovery checklist

If something looks wrong or missing:

1. Stop making edits.
2. Export your current data to JSON (web).
3. Open **History** and check whether a restore is enough.
4. If needed, import only the specific backup categories you want to recover.
5. If you are troubleshooting connectivity, try **Alternative connection mode** temporarily.
6. If local cache is corrupted/stale, use **Clear Offline Storage** and reload.

## Related docs

* [Settings](/settings.md)
* [FAQ](/faq.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.brewfather.app/data-safety.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
