# Running on your device

Your backend runs where you run `ownbackend serve`: Linux, macOS or Windows,
on x86 or ARM. It keeps its files in a hidden `.ownbackend/` folder there:
`data/` (the database, uploaded files, backups and this device's link; it's
git-ignored, never commit it), and `migrations/` and `hooks/`, which belong
with your app's code.

## Staying online

Your app is online while the device runs `ownbackend serve` and has
internet. No router setup is needed: the device connects out to the relay.

- **In the background:** `ownbackend service install` runs it as a service
  that starts when you log in (on Linux, also at boot after
  `loginctl enable-linger $USER`) and restarts after a crash.
  `ownbackend service status`, `stop`, `start` and `uninstall` manage it.
- **Sleep:** while plugged in, ownbackend keeps the computer from going to
  sleep when idle. Closing a laptop's lid still puts it to sleep, and your
  app goes offline until it wakes.
- **Alerts:** when your app has been offline for 3 minutes, we email you,
  and again when it's back. In the dashboard you can mute them per backend
  and write the message visitors see while it's offline.
- **Warnings:** we also email you once when the battery is low and not
  charging, or when the disk is almost full.

## Backups

The device sends an encrypted backup of the whole backend to the relay every
24 hours; the relay keeps the last 7. They're encrypted on the device with
your **backup recovery code**, shown once when you connect the device.
Without it, nobody can read them, including us. Show it again with:

```sh
ownbackend backup recovery-code
```

- List backups: `ownbackend backup list`
- Restore one (stop the app first):
  `ownbackend backup restore latest --yes`. Your current data is kept first,
  as a local backup in `.ownbackend/data/backups/`.
- Back up right now: `POST /api/ownbackend/backups` on the device, as an
  admin.

## Moving to another device

Install ownbackend on the new device, then in the dashboard choose **Move to
another device** on your backend for a new connect code, and run the commands
it shows (or run `ownbackend serve --relay wss://app.ownbackend.com` on the new device and
pick your existing backend when you approve). The old device is disconnected. To bring your data along:

```sh
ownbackend backup restore latest --yes --recoveryCode <your code>
```

## Admin access

There's no admin dashboard: your AI agent manages the data and its rules
through the [MCP server](/docs/mcp.md), on the device. Admin access never
works through the public address.
