# Persistent Storage

Your app can store a user's settings in various ways. For each usecase, there's a best practice.

## Device Settings

Most likely, you'll want to store settings per-device.

For front-end, user-visible settings, use [Device Settings](/the-basics/devices/settings.md).

For back-end, persistent settings, use the Device Store. Refer to [Device.getStoreValue](https://apps-sdk-v3.developer.homey.app/Device.html#getStoreValue) and [Device.setStoreValue](https://apps-sdk-v3.developer.homey.app/Device.html#setStoreValue) for the documentation.

## App Settings

Most app-specific settings can be stored and retrieved through [ManagerSettings](https://apps-sdk-v3.developer.homey.app/ManagerSettings.html). This enabled your app to save and retrieve any value that is JSON-serializable. App Settings are saved across app restarts, and are only deleted when your app is uninstalled.

On Homey Pro, a custom App Settings can be created using HTML, CSS and JavaScript.

{% hint style="info" %}
It is generally discouraged to use custom HTML, because often app settings are better to be stored within a Device Store.
{% endhint %}

## App Userdata

For non-JSON serializable data, e.g. binary files, the `/userdata/` folder is writable on Homey Pro.

{% hint style="danger" %}
The `/userdata/` is publicly available on `http`s`://<homey>/app/your.app.id/userdata/`.

This allows for some nice usecases, but can also be a security risk! Be sure to keep your filenames unique so they cannot be guessed.

For example, when storing an image, don't name it `image1.jpg` but `a656d380-c887-4d8b-9ee5-f89de7b65d01.jpg` and keep the Image's name stored in the App Settings.
{% endhint %}


---

# 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://apps.developer.homey.app/the-basics/app/persistent-storage.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.
