Skip to content

About

Restock server: your household's own sync server for Restock. Docker or a Home Assistant app.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Restock server

Your household's own server for Restock, the local-first price tracker for Australian supermarkets, bottle shops and chemists. Run it at home on a NAS, a home server, an old laptop, a Raspberry Pi or inside Home Assistant. Your phones sync through it at home and away. It runs your shopping list with Home Assistant around the clock and keeps your household's history. Its web page looks after the phones, the data and the server's settings (and Server admin on an admin phone does the basics on the go). It can also keep each phone's backup, so a lost phone can be put back.

Works with Restock 0.20.0 to 1.0.3 on your phones (Android, iPhone and iPad).

Update every phone to Restock 0.20.0 or newer first. From server 0.20.3, a phone on an older version is turned away with "Update Restock on this phone to 0.20.0 or newer to keep syncing" (it was 0.14.0). It keeps everything it has and works on its own until it's updated. The server's Phones and admins page lists any phone that needs updating.

Local first, always. Every phone keeps its own full copy of what it shares. Your list, pantry and receipts work with no signal and with the server off; changes go up at the next sync. Only searching the shops needs the internet. The server is optional: a phone never needs it to work.

  • The server is the house. It's a member of your household that never sleeps, and its owner. It holds the household's keys, merges what the phones share (with the same code the phones use), and hands each phone its keys when you add it.
  • Sealed on the wire. Everything phones send or get is sealed and signed, even over plain http:// at home. Browsers sign in without sending your passphrase or anything reusable.
  • Readable at rest, so keep it private. To merge, keep history and run Home Assistant, the server can read what phones share with it. See what the server can read and keep its data folder private.
  • It talks to your phones, your Home Assistant and nothing else, apart from asking GitHub once a day for the newest version number (Server settings → Updates and moving can turn that off). It never contacts the shops.

The Restock server's web page: Phones and admins, with every phone, its role, when it last synced, and Activity

The pictures on this page use sample data.

Contents

  1. Start it (Docker, Compose, Dockge, Portainer, TrueNAS, or as a Home Assistant app)
  2. Log in and set up the server
  3. Add your phones

Which machine?

Anything that stays on at home works, and it needs very little: a Raspberry Pi is plenty for a household. Pick the guide for what you have, then carry on from 2. Log in and set up the server.

You have Do this
Home Assistant OS (on a Pi, mini PC, NUC or a VM) As a Home Assistant app. No Docker needed.
A Raspberry Pi 4 or 5, or a mini PC or old laptop running Linux Install Docker, then 1. Start it.
A NAS: TrueNAS, Synology, QNAP or Unraid On a NAS, using compose.yaml.
A machine that already runs Docker, Dockge or Portainer 1. Start it.

Raspberry Pi, mini PC or old laptop

  1. The operating system.
    • Raspberry Pi: a Pi 4 or 5 with Raspberry Pi OS (64-bit). Install it with Raspberry Pi Imager. The server only comes for 64-bit (arm64), so a Pi 3 or older, or the 32-bit OS, won't run it.
    • Mini PC or laptop: Ubuntu Server or Debian (64-bit) is the easiest.
  2. Install Docker. On the machine, run Docker's install script, then let your user run Docker and log out and back in:
    curl -fsSL https://get.docker.com | sh
    sudo usermod -aG docker $USER
    Check it worked with docker run --rm hello-world.
  3. Give it a fixed address, so the phones can always find it. In your router's settings, reserve the machine's current IP address for it (often called a DHCP reservation or fixed IP). To see its current address, run hostname -I on it; the first number, such as 192.168.1.20, is the one.
  4. Start the server with the second docker run command in 1. Start it, the one with --restart unless-stopped, so it starts again by itself after a power cut.
  5. If the machine has a firewall turned on (Ubuntu's ufw, say), let the phones in: sudo ufw allow 8787/tcp.

On a NAS

Use compose.yaml from this repo. Change RESTOCK_PASSWORD in it first.

  • TrueNAS SCALE (24.10 or newer): Apps → Discover Apps → ⋮ → Install via YAML, paste in compose.yaml, then Save. See below for keeping the data on a dataset.
  • Synology (DSM 7.2 or newer, on a model with Container Manager): install Container Manager from Package Center. Then Container Manager → Project → Create, give it a name and a folder, choose Create docker-compose.yml, paste in compose.yaml, and Done.
  • QNAP: install Container Station. Then Applications → Create, name it restock-server, paste in compose.yaml, and Create.
  • Unraid: install the Docker Compose Manager plugin from the Apps tab. Then Docker → Add New Stack, name it restock-server, Edit Stack → Compose File, paste in compose.yaml, Save Changes, then Compose Up.

The NAS's own address (the one you open its settings with) is the server's address, on port 8787: for example http://192.168.1.10:8787.

1. Start it

You need Docker (see Which machine? if you don't have it yet). Run this on the machine that'll be the server:

docker run -d --name restock-server -p 8787:8787 -v restock-data:/data -e RESTOCK_PASSWORD=admin ghcr.io/plentysoftware/restock-server:latest

That's it. It keeps everything in a Docker volume called restock-data. RESTOCK_PASSWORD is only for the first login; it stops working once you've set a passphrase. If other people use your network, change admin to a password of your own before you run it.

While the password is still admin (or another one anyone could guess, like the change-me-now in compose.yaml), the first login only works from your home network or Tailscale, not through Cloudflare Tunnel or anything else from the internet, and only with an address a home network has (an IP address, localhost, a .local, .lan, .home.arpa or .ts.net name, a one-word name, or your RESTOCK_HOME_URL or RESTOCK_AWAY_URL), so a web page elsewhere can't use your browser to do it. To set it up from somewhere else, start the server with your own RESTOCK_PASSWORD.

To have it start again after a restart, and locked down a bit more, use this instead:

docker run -d --name restock-server --restart unless-stopped --read-only --cap-drop ALL --security-opt no-new-privileges -p 8787:8787 -v restock-data:/data -e RESTOCK_PASSWORD=admin ghcr.io/plentysoftware/restock-server:latest

Check it's running with docker logs restock-server. You should see the address to open.

With Docker Compose, Dockge, Portainer or TrueNAS

Use compose.yaml from this repo. Change RESTOCK_PASSWORD in it first.

  • Docker Compose: put compose.yaml in a folder and run docker compose up -d there.
  • Dockge: + Compose, name it restock-server, paste in compose.yaml, then Deploy.
  • Portainer: Stacks → Add stack, paste in compose.yaml, then Deploy the stack.
  • TrueNAS SCALE (24.10 or newer): Apps → Discover Apps → ⋮ → Install via YAML, paste in compose.yaml, then Save. To keep the data on a dataset instead of a Docker volume, change restock-data:/data to your dataset's path, for example /mnt/tank/apps/restock:/data, and let the server (user 1000) write to it: sudo chown -R 1000:1000 /mnt/tank/apps/restock.

As a Home Assistant app (no Docker needed)

If you run Home Assistant OS (or a Supervised install), the server can run inside Home Assistant as an app (apps were called add-ons before Home Assistant 2026.2). Your Home Assistant backups then include it.

  1. In Home Assistant, go to Settings → Apps → App store, open the ⋮ menu, choose Repositories, and add https://github.com/plentysoftware/restock-server.
  2. Find Restock server in the App store and Install it.
  3. In its Configuration tab, set password to your own, then Save and Start.
  4. Open web UI, or go to http://<your Home Assistant's address>:8787, and carry on from step 2.

Away from home, give phones an address that reaches port 8787 on Home Assistant: Tailscale, or a Cloudflare Tunnel hostname pointing at http://<Home Assistant's address>:8787 (then set trust_proxy to cloudflare). Home Assistant Container and Core installs don't have apps: use Docker as above.

2. Log in and set up the server

  1. On a computer on the same network, open http://<the server's address>:8787, for example http://192.168.1.10:8787. (On the server itself, http://localhost:8787 works too.)
  2. Log in with admin and your RESTOCK_PASSWORD. If it says "Finish setting up Restock server from your home network first", you're coming in from outside your home network with the default admin password (or change-me-now): do this step at home (or over Tailscale), or restart the server with your own RESTOCK_PASSWORD.
  3. Choose a passphrase. Four or more random words works well, like kettle orbit lemon fence, or anything with at least 20 characters. The page won't take common passwords, the user name or "admin". From now on that's how you sign in, and the first-login password no longer works.
  4. Set up this server: give your house a name, like The Smiths. Everyone you add sees it. The server makes the household: its keys, its owner key and a recovery key.
  5. Sign in with your passphrase. Once an admin phone is on Restock 0.18.3, signing in with the passphrase also needs a yes on that phone.

Your passphrase never leaves the browser. The browser turns it into a key; the server keeps a hash of it and a key that proves you know it, and each sign-in proves that with a fresh challenge, so watching a sign-in gives nothing to replay. Keep the passphrase somewhere safe, like a password manager.

Sign in to your server: a QR code for an admin phone to scan, or the user name and passphrase

3. Add your phones

  1. On the web page, open Phones and admins and choose Add a phone or tablet. Type who it's for, like Sam's phone. A QR code appears. It works once, for 10 minutes (it still works if the server restarts, and a used or expired one says which).
  2. On a new phone, choose Join a home server on Restock's first screen; on one already set up, go to Settings → Household sync → Join your server. Scan the code. The phone says "This phone was added as Sam's phone on The Smiths".
  3. Choose what this phone shares, then do the same for each phone, with a new code each time.

The code has the server's own key in it, so the phone knows it's talking to your server and nobody else can answer in its place. Each phone gets its own key for the server (the server keeps only its public half) and gets the household's keys sealed to it.

Phones and admins shows each phone, what it shares, its Restock version and when it was last seen. Remove takes a phone off straight away and gives the household a new key, so a lost or stolen phone can't read anything changed after that. Nothing it shared is deleted. A phone can also Leave by itself.

Admin phones (0.18.0)

Each phone is a user or an admin. Phones start as users. On Phones and admins (signed in with the passphrase), Make admin turns one into an admin, or tick Make admin when you add it. An admin does from Restock on the phone what this page does: in Settings → Household sync → Restock server → Phones and tablets it adds phones and tablets (the same one-time code, for a user or an admin), renames them, makes them admins or users, and removes them. It can't remove itself (it uses Leave). The server checks every request, and an admin phone's requests and codes go sealed with the household's key. Make user takes it back. Each change is in Activity.

Since 0.18.1, every change asks Are you sure? first (adding a phone, removing one, Make admin and Make user), on the phone and here. The server's only admin phone is warned before it makes itself a user or leaves. An admin phone gets a notification when a phone joins, leaves or is removed, or becomes an admin or a user (its Settings → Notifications, on to start with), and Activity → Admin actions here shows just what admins did.

From 0.18.4, an admin phone has Server admin (Settings → Household sync → Restock server), with what's wanted on the go, a page each: Phones and tablets (add, remove, make admin or user, rename), Sign in a computer (scan the code on the sign-in page), Passphrase (change it: the phone proves the current one, and every browser is signed out), Basic settings (the household's name, the addresses, Home Assistant on or off) and Phone backups. A browser waiting for a yes shows at the top. Everything else is on the web page. The last admin phone can't be removed or made a user, from the phone or the web page: make another phone an admin first.

The web page

From 0.18.3 the web page looks after the server, and nothing else: the shopping list, the pantry and the shops are on the phones. It's small (about 1.7 MB), keeps nothing of the household in the browser, and the first time it opens in a browser it deletes the copy the page before kept there. The sidebar has:

  • Phones and admins: every phone and tablet, Add a phone or tablet (or one that replaces a lost phone), Make admin and Make user, Rename and Remove, each phone's backup (phone backups), and Activity (Everything, or just Admin actions).
  • Data: see Data.
  • Server settings, a page each:
    • Household: its name, the time zone (for Activity and the nightly tidy-up), and the oldest Restock that can join.
    • Addresses: at home and away from home (at home and away), with Test both.
    • Sign-in and security: the passphrase, the user name, the recovery key, sign in by scanning with a phone (on or off), sign out after (1 hour to 30 days), and every signed-in browser, with Sign out.
    • Home Assistant: see Home Assistant.
    • This browser: light or dark, the default theme or Simple, the text size, and the animations (the opening, the holidays, movement). Kept in that browser only.
    • Updates and moving: the version and release notes, the update check, the server's log for a bug report, Restart (in Docker), moving to a new server, and Erase this server.

Server settings → Sign-in and security: the passphrase, user name and recovery key, scanning with a phone, a yes on an admin phone, sign out after, and the signed-in browsers

Changes save as they're made; Addresses has its own Save. It fits any screen, from a phone (each table row becomes a card) to a big monitor, and works on an iPhone's home screen (Share → Add to Home Screen). This browser → Text size makes the whole page bigger or smaller.

A yes on an admin phone

Like two-factor: each risky change on the web page (how long data is kept, deleting data, showing the recovery key, changing the passphrase or user name, and erasing) needs a yes on an admin phone too, wherever you are.

Signing in with the passphrase (1.0.2) is up to you, in Server settings → Sign-in and security → A yes on an admin phone when signing in:

  • Off: the passphrase alone signs in. New servers start like this.
  • Away from home only: signing in from your home network (or Tailscale) needs just the passphrase; from anywhere else (through a Cloudflare Tunnel, say), a yes on an admin phone too. Home is worked out from where the request really comes from, every proxy header included, not from http or https.
  • Everywhere: always a yes too. A server set up before 1.0.2 keeps this, as it always worked.

Changing it needs the passphrase and a yes on an admin phone; turning it on, that yes is the test that it works (no admin phone that can say yes: it says so and nothing changes). Test, next to Risky changes, asks the admin phones for a yes at any time, changes nothing, and says which phone answered.

With more than one admin phone, every one of them shows the same number, and the first to answer counts. The others close it and say who answered (Restock 1.0.2); one that answers anyway is told it was already answered, and by whom.

  1. The page shows a two-digit number and which admin phones were asked.
  2. Open Restock on one of them. It asks Is this you?, with which browser and from where. Type the two numbers the page shows, then Yes, it's me; or No, block it (a sign-in that's said no to is signed out). 1.0.3: the phone isn't told the number (it comes from the page), and the server checks it; three wrong numbers block it. Phones on Restock 1.0.2 or older can only say no: update them. An admin phone looks every 10 seconds while Restock is open; Server admin → Look for "Is this you?" every can make that 5 or 15.
  3. The page carries on by itself.

Say yes on an admin phone: a two-digit number, which phone was asked, the time left, Cancel, and Use the recovery key

A phone can't be woken for it (iPhones don't let apps check in the background, and Android only every 15 minutes), so the phone asks when Restock is opened, and every few seconds while it's open. Every admin phone lost? The page's Use the recovery key says yes in its place. Until an admin phone is on Restock 0.18.3, the passphrase alone signs in, as before, so updating the server first doesn't shut anyone out. Scanning the sign-in code with an admin phone needs no second step.

Phone backups

New in 0.18.4. Each phone and tablet can keep its whole backup on the server: its settings, look, shops, every tab (shared or not), cards and receipts (not their photos). So when a phone is lost or broken, a new one gets everything back.

  • Turn them on once, with the passphrase: Phones and admins → Phone backups → Turn on, or Server admin → Phone backups on an admin phone. That makes the household's backup key; its private half is locked with the passphrase.
  • Then each phone backs up once a day while Restock is open on it (on unless turned off on that phone, in Settings → Household sync → Restock server → Backup, which also has Back up now). Each phone's latest one is kept, as backups/<device>.bin.
  • The server can't read them: each is sealed to the backup key, and only the passphrase opens that. Anyone with the passphrase can, so keep it as private as the server.
  • Putting a lost phone back: Add a phone or tablet and pick it under Replaces a lost or broken phone. The new phone joins with that code (as an admin if the lost one was), Restock asks for the server's passphrase, and everything comes back: settings, look, shops, cards and receipts replace the new phone's; items and prices are added to what the household's sync brought; the shopping list is the household's as it is now. The lost phone then comes off the server.
  • Downloading one: Backup… on a phone, then the passphrase (and a yes on an admin phone). It's saved as a Restock backup file (locked with a password if you give one, where the browser can) that opens in Import data on any phone.

Data

The Data page shows what the household's phones have shared with this server:

  • Space used, and each kind with how many (48,210 prices, for 412 products) and its size: price history, receipts and photos, spending records, the pantry and lists, activity and logs, and deleted files kept for 30 days. Export on a row saves that kind as a spreadsheet (.xlsx); Export everything saves the full export file (.json), an open, documented format (restock-export, see For developers). None of them has loyalty or gift card numbers or PINs, receipt text or photos, keys, passwords or the Home Assistant token, but they do have your list, pantry, prices and spending, so keep them private.
  • Import a file: add products and prices from a file (the full export file, or CSV files in a zip) on top of what's here. It never replaces or deletes anything and never touches your list or pantry. A preview shows what it will add and skip, then you confirm with your passphrase. Imported prices are marked imported. Up to 100 MB, 25,000 products and 500,000 prices a file. The format is in docs/restock-import.md. Only import prices you're allowed to use.
  • Download a backup: see Backups.
  • Your spending and price charts are on each phone, in Settings → Your data (the server works them out; the phone shows them).

The Data page: space used, each kind with how many and its size, Export on each, how long data is kept, and Delete data

Deleting data

Data → Delete some deletes by kind, or only what's older than a date, from the kinds you tick. You see exactly what goes first, then type DELETE and your passphrase (and an admin phone says yes). Delete everything takes the server back to new and empty, for everyone: type DELETE EVERYTHING. Every phone is unlinked and keeps all its own things; you can add them again.

Nothing here deletes your shopping list, your pantry, the newest price of each product, pinned receipts, or anything on the phones. Phones aren't told to delete anything.

How long data is kept

How long data is kept (on Data) deletes data older than you choose, every night at about 3 am (in the server's time zone): 3, 6 or 12 months, 2 years, or until deleted. It covers prices, receipts and their photos, the phones' moved-off history (archive/), statistics and logs, with the same things kept as above.

  • Off is the start on a new server: nothing is deleted until you delete it.
  • Turning it on, or making it shorter, deletes straight away, so it needs DELETE, your passphrase and a yes on an admin phone.
  • Each phone keeps its own price history, as long as its own setting says.

What each phone shares

Each phone chooses, in Your server → What this phone shares: Groceries (pantry, Shopping list and General list, on by default), Bottle shop and Chemist (off: everyone on the server would see what you buy there), Receipts (off) and Loyalty cards (on unless you turn them off, from Restock 0.20.0) and Gift cards (off, a switch of their own from Restock 0.20.2: with it on they travel as loyalty cards do, in the phone's sealed file, and the server's database keeps only each one's name, "Gift card: …", and expiry date, never its number, PIN or balance). Settings → Household sync → Resync… on the phone changes any of them later. What a phone doesn't share never leaves it. The server also checks: it takes from each phone only what that phone says it shares.

Turning something off stops sending it; what it already shared stays on the server, unless you tick Also take what this phone shared off the server, which deletes that phone's own shared things for that tab (other people's stay). Prices and product details found at the shops stay for the household: they're about the shops, not about you.

Extra shops and tabs (called Beta testing features before 0.20.3). Restock keeps custom tabs (Bottle shop, Chemist, Baby, Pets and your own) and every shop besides Coles, Woolworths and Aldi behind one switch on each phone, off on a new phone. Server settings → Household → Extra shops and tabs turns it on for every phone joined to the server at once (an admin phone can too, in Server admin → Basic settings), and while it's on, phones can't turn it off. It counts as on, and can't be turned off, while the household already uses a custom tab or another shop; remove those on a phone first. Copies of Restock from Google Play and the App Store don't have the switch and take no notice of it.

What searches found. A phone also sends what its searches and scans turned up: the product, the shop, its price that day, its barcode and whether it was in stock, whether or not it was added to anything. It's history about the shops, kept with the prices deleted with them by Delete some and How long data is kept, and never sent on anywhere. It's never used as a current price.

Home Assistant

In a household on the server, the shopping list syncs with Home Assistant from the server, all the time, for every phone and browser: one token. On the web page, open Server settings → Home Assistant and go down it in order (1.0.2):

  1. Connect: the address you open Home Assistant with (for example http://homeassistant.local:8123, or http://homeassistant:8123 for the Home Assistant app) and a long-lived access token (your Home Assistant profile → Security), then Test. That saves both and brings Home Assistant's lists.
  2. Your lists: pick the list from Home Assistant's own (by their names, shopping lists and to-do lists alike), then Save and turn on. It turns on by itself.
  3. Syncing: the switch (to turn it off and on again), how it's going, and Sync now. An admin phone can turn it on or off too.

It syncs every minute and a few seconds after a phone changes the list.

One list (the usual): a voice add that matches one of your items goes on that item's list (Pantry first, then Bottle shop, then Chemist). One that matches nothing goes on the General list. Goes with can instead tie it to one tab only.

More lists (1.0.2): if you keep separate lists in Home Assistant (groceries in one, Bunnings in another), Add another list pairs each with one of your tabs. Each is only that tab's list both ways: what's on it is matched to that tab's items, and what matches nothing still goes on that tab, at the bottom. The first list, sorted for you, then leaves those tabs alone. Up to six more lists; each list and each tab once.

The token is kept on the server only (in keys.json); it's never shown again, never sent to phones or browsers, and never written in the logs. Plain http:// only goes to an address at home or on Tailscale; anything else needs https://.

Sign in with a phone

On a computer you don't use often, skip the passphrase: scan the code on the sign-in page with an admin phone (Restock → Settings → Household sync → Server admin → Sign in a computer). The code lasts 2 minutes and works once, and needs no second step. Such a sign-in ends after 12 hours unused (or sooner, with Sign out after), or straight away if that phone is removed. It can see everything, but changing the server's settings or the passphrase, the recovery key, backups, removing phones and deleting data need the passphrase sign-in. Server settings → Sign-in and security can turn scanning off.

Signed in somewhere you shouldn't be? Sign-in and security lists every signed-in browser, with Sign out on each.

At home and away

Phones try the home address first, then the away address. Away from home the address has to be https://, unless it's a Tailscale address (Tailscale already encrypts the connection). Plain http:// only works on your home network. An iPhone or iPad needs https everywhere, even at home.

Set them in Server settings → Addresses (0.18.3), or on an admin phone. They go into the phones' QR code and into the household's signed record. Phones already on the server pick up a change from the server's own file at their next sync (while they can still reach it at the old address). A phone gives up on the home address after a moment and tries away; at the start of each sync it looks at home first, so back at home it goes home again. No location or Wi-Fi permission is needed.

Until you set them, the server learns them from the address its page is opened with: an address only a home network has (an IP address at home, a .local name, Tailscale) is the home one, and any other is away, always as https:// (0.18.3: through a Cloudflare tunnel it came out as http://, which phones turn down with "Restock only uses http:// for a server at home…"; a server puts a saved one right by itself). Or set them where the server runs, which wins over the page:

  • RESTOCK_HOME_URL, for example http://192.168.1.10:8787.
  • RESTOCK_AWAY_URL, for example https://restock.example.com.

Add them with -e in the docker run command (for example -e RESTOCK_HOME_URL=http://192.168.1.10:8787), or in compose.yaml.

Tailscale (the simplest): install Tailscale on the server machine and on the phones, then set RESTOCK_AWAY_URL to http://<the server's Tailscale address>:8787, for example http://100.101.5.7:8787. For an https address (needed on iPhone), run tailscale serve for an https://<name>.<tailnet>.ts.net address and use that.

Cloudflare Tunnel: point a tunnel's public hostname at the server (http://restock-server:8787 if cloudflared runs in the same Docker network, otherwise http://localhost:8787). Then set:

RESTOCK_AWAY_URL=https://restock.example.com
RESTOCK_TRUST_PROXY=cloudflare

RESTOCK_TRUST_PROXY tells the server to read the visitor's real address from Cloudflare, so the lock-out after wrong passphrases hits the person guessing, not everyone. It only believes those headers on connections from your home network or Docker (where the tunnel runs), so someone reaching the port from the internet can't make up an address (but someone on your home network can: with it set, remove the ports: lines so only the tunnel reaches the server). Don't put Cloudflare Access (a login page) in front of it: phones can't get past it.

Your own reverse proxy (Caddy, Traefik, Nginx Proxy Manager): the same, with RESTOCK_TRUST_PROXY=true. The proxy must set X-Forwarded-For and X-Forwarded-Proto. Serve it at the root of its own hostname (like restock.example.com, not example.com/restock).

Whatever you use, don't forward port 8787 on your router. Away access should go through Tailscale or https.

Over plain http:// the server also serves the web page's own code, so someone who can change traffic on your network could change the page. Phones are fine over plain http at home (everything they send is sealed and signed, and they know the server's key), but for the web page, use https or Tailscale if you don't trust your network.

Backups

Download a backup on the web page makes one encrypted file of everything the server keeps (the household, its keys, every phone's files and photos, the history and the logs). It's on Data → Download a backup. You type a backup passphrase for it when you download; the file is useless without it, so keep the two apart. To restore, into a new, empty data folder:

node scripts/restore.mjs restock-server-2026-11-10.rsb ./restored-data

(In Docker: docker run --rm -it -v "$PWD":/backup -v restock-data:/data ghcr.io/plentysoftware/restock-server:latest node scripts/restore.mjs /backup/restock-server-2026-11-10.rsb /data into an empty volume.) Then start the server with that folder. Phones carry on as before.

Moving to a new server

Server settings → Updates and moving → How to move has the steps: if the new server has other addresses, set them in Addresses first and give the phones a day to sync; download a backup; restore it on the new machine as above; start the new server and stop this one.

You can also copy the whole restock-data volume (stop the server first so the database is consistent):

docker stop restock-server
docker run --rm -v restock-data:/data:ro -v "$PWD":/backup alpine tar czf /backup/restock-data.tgz -C /data .
docker start restock-server

A copy like that is not encrypted: it can be read like the server itself. Keep it as private as the server's data folder. Your phones have their own copy of what they share anyway.

The Data page's exports (.xlsx and the full export file) are for reading your data and moving it, not for restoring a server. Use the encrypted backup for that.

The recovery key

Server settings → Sign-in and security → Recovery key shows the household's recovery key (with the passphrase, and a yes on an admin phone). It's also what says yes when every admin phone is lost. Save it somewhere safe. If the server is ever lost, a phone can take the household back with it (Restock's Take over), and the household carries on without a server. A server that sees the household was taken back stops acting as its owner and its web page offers to start afresh.

Forgot your passphrase?

Reset it where the server runs (it can't be done from the web page or a phone).

Docker (with sudo in front if your machine needs it for Docker):

docker exec restock-server touch /data/reset-passphrase
docker restart restock-server

Home Assistant app: in the app's Configuration tab turn on reset_passphrase, Save, then Restart the app. Turn it off again afterwards (it only resets once, however long it's left on).

Then open the web page, log in with your user name (admin unless you changed it) and your RESTOCK_PASSWORD (the app's password option) again, and choose a new passphrase. Every browser is signed out; your household, phones and files are kept. If phone backups were on, the ones on the server were locked with the old passphrase: make new ones. The sign-in page's Forgot your passphrase? says the same.

Recovering deleted files

Phones move older prices and receipt photos to the server and then delete their own copy, so the server's archive/ and photos/ files may be the only ones. They're never simply deleted: when a phone deletes one (or another phone replaces it with something different), or How long data is kept or Delete some removes one, the old copy goes to trash/<when>/ in the data volume, with the same name it had under files/, for 30 days. The trash is emptied of anything older once a day and when the server starts (or straight away if you delete the deleted files kept for 30 days on Data). It counts towards RESTOCK_MAX_TOTAL_MB, and phones never see it. The Activity page lists each trashed file and where it went.

To put one back, stop the server, move it back under files/, and start it again:

docker stop restock-server
docker run --rm -v restock-data:/data alpine sh -c "ls -R /data/trash"
docker run --rm -v restock-data:/data alpine sh -c "mkdir -p /data/files/photos && mv /data/trash/2026-11-09T22-56-00.123Z/photos/<sha256>.bin /data/files/photos/ && chown -R 1000:1000 /data/files"
docker start restock-server

(Use the folder and name ls showed; an archive goes back to /data/files/archive/<phone>/.) The phones see it again at their next sync.

Who can delete what: a phone only its own archive/<phone>/ files, and a photo only if it's the phone that put it on the server (another phone may use the same photo: when it asks, the photo stays). The web page only through Delete some, Delete everything and How long data is kept, with their checks.

Updating

docker pull ghcr.io/plentysoftware/restock-server:latest
docker rm -f restock-server

Then run the same docker run command as before. Your data stays in the volume.

  • Docker Compose: docker compose pull && docker compose up -d.
  • Dockge: open the stack, then Update.
  • Portainer: open the stack, then Pull and redeploy.
  • TrueNAS: Apps, select it, then Update (or Edit → Save to pull again).
  • Home Assistant app: Settings → Apps, open Restock server, then Update.

Each version is also tagged by number (for example ghcr.io/plentysoftware/restock-server:0.15.0) if you'd rather choose when to update. It needs Node 22.13 or newer if you run it without Docker (it says so and stops otherwise).

A household made on phones

If your phones already share a household over Wi-Fi or a cloud drive folder: on a new server, scan the first Add a phone code with the household's owner phone, and choose Bring onto . The other phones see the change and offer to connect themselves. A phone that isn't in a household, or is in another one, joins and its things on the tabs it shares go up.

What the server can read

The server can read what phones share with it: the shopping lists and pantry, Bottle shop and Chemist if shared, receipts and their photos if shared, prices including years of history, what's been ticked off (for spending), the household record, each phone's settings summary, the Home Assistant token, and the activity log and logs. It needs to, to merge, keep history and statistics, run Home Assistant and show the web page. Loyalty card numbers are blanked before they reach its database (a phone that shares cards still puts them in its sealed file, which the server can open).

It never has: anything a phone doesn't share, your passphrase, or the phones' private keys. A phone's backup (0.18.4) is sealed to a key only the passphrase opens: the server keeps it, but can't read it.

It never talks to the shops. Once a day it asks GitHub for the newest version number, unless that's turned off.

Phones can read the statistics. A phone in the household can read the statistics (spending, top items, price series and storage) for its Settings → Your data, signed as that phone. It can't export, delete or change anything there. A phone can also add the spending it worked out before it joined (POST /api/v3/data/spend, up to 5,000 lines a time, signed as that phone), unless Share my spending with the server is off on it. It can only add, never change or delete. From 0.10.1 both are sealed with the household's server key (the phone asks with X-Restock-Seal: rsf1), so they're as private on the network as sync; 0.9.14 and 0.10.0 phones still get them as before until they update.

Anyone with a copy of the data folder can read all of the above. So:

  • keep the data folder private (don't share the volume or dataset, and keep its backups as private as the server);
  • put it on an encrypted disk if you can (an encrypted TrueNAS dataset, LUKS, FileVault, BitLocker);
  • use the encrypted backup for copies that leave the machine, and keep the Data page's exports private too;
  • run the server yourself, from this image, on a machine you trust: it also serves the web page to your browser.

On the network everything stays sealed: phone traffic always, browser traffic too (with the plain-http caveat above). The makers of Restock never see any of it.

Settings

Variable Default What it does
RESTOCK_PASSWORD admin The first-login password. Only works until a passphrase is set. While it's admin, change-me-now or a few others anyone would try, only from your home network or Tailscale
RESTOCK_USER admin The user name. It's fixed when you set the passphrase
RESTOCK_HOME_URL the address you open the web page with The address phones use at home (goes in the phones' QR code and the household's record)
RESTOCK_AWAY_URL none The address away from home: https://, or a Tailscale 100.x address
RESTOCK_TRUST_PROXY off cloudflare behind Cloudflare Tunnel; true behind your own reverse proxy
RESTOCK_MAX_FILE_MB 32 The biggest single file the server takes
RESTOCK_MAX_TOTAL_MB 2048 The most the server keeps in all
PORT 8787 The port inside the container
RESTOCK_QUIET off true to hide error details in the logs
RESTOCK_UPDATE_CHECK on off: never ask GitHub for the newest version (Server settings → Updates and moving can turn it off too)
TZ UTC in Docker Your time zone, for example Australia/Brisbane or Australia/Sydney. Activity's times, and the nightly tidy-up at 3 am, use it, unless the time zone is set on Server settings → Household. Set yours (the Home Assistant app uses Home Assistant's)

How long data is kept, the addresses, the time zone (over TZ), sign-in and Home Assistant are set on the web page (Server settings), not here.

What's in the data volume

/data
├── state.json          the mode, the server's id, the house's name, the web user (salt, scrypt hash
│                       and sign-in key), each phone (name, label, public keys, status), browser
│                       sign-ins (with their session keys), who last wrote each file, and the
│                       server's own settings (how long data is kept, the addresses, sign-in, the time zone)
├── keys.json           (0600) the server's own key, the household's keys and owner key, the phones'
│                       recovery secrets, the recovery key, Home Assistant's address and token
├── household.db        (0600) the household itself (SQLite, Restock's own layout): what phones share,
│                       price history, receipts, what was ticked off (srv_spend), the log (srv_log)
├── files/              the phones' files, as they sent them (sealed)
│   ├── restock-sync-<phone>.bin        each phone's (and each browser's) changes
│   ├── restock-sync-srv-<id>.bin       the server's own file, for the phones
│   ├── keys/<phone>.bin                a new household key after a Remove, sealed to that phone
│   ├── archive/<phone>/<yyyy-mm>.bin   older prices and receipts a phone moved off itself
│   └── photos/<sha256>.bin             receipt and product photos
├── trash/<when>/       deleted or replaced archive/ and photos/ files, kept 30 days
├── tmp/                half-written uploads (cleared at start)
└── reset-passphrase    only if you create it (see above)

Writes are atomic: a crash leaves the old file or the new one, never half of each.

Problems?

  • The server won't start, or a phone can't sync with it: open an issue here, in restock-server's issues. docker logs restock-server (or the Home Assistant app's Log tab) usually shows why.
  • Something in the app on your phone: open it in Restock's issues.
  • A security problem: report it privately, from the Security tab of Restock.

Leave out your passphrase, recovery key, backup files, export files, addresses and anything else personal. Crop screenshots if you need to.

For developers

The protocol is in the Restock repo: docs/server-protocol.md (the parts still served are "v3", Data and the restock-export format) and the design, docs/server-v3-design.md. A data folder that still holds a household from Restock 0.9.3 or older isn't served: the server answers every request with old-household (start a new household on an empty data folder; the phones bring their own copies). The account routes (the setup page's first sign-in, the passphrase) moved to /api/v3/account/ in 0.15.1; only GET /api/v2/health is left of v2. v3, in short:

Method and path Who
GET /api/v3/health anyone: { ok, app, version, api: 3, mode, house?, core }
GET /api/v3/login/challenge?user=, POST /api/v3/login anyone (challenge, then proof; the answer is sealed with the new session's key)
POST /api/v3/logout, GET /api/v3/session, GET /api/v3/browsers, DELETE /api/v3/browsers/<id> session
POST /api/v3/setup passphrase session, mode new
POST /api/v3/join invite holder, or a household member (its signature)
DELETE /api/v3/devices/<me> phone (Leave)
GET /api/v3/files, GET/PUT/DELETE /api/v3/files/<name> phone or session (keys/<phone>.bin: that phone only)
POST /api/v3/qrlogin, GET /api/v3/qrlogin/<id> / POST /api/v3/qrlogin/<id> anyone / phone
GET/POST /api/v3/phones, PATCH/DELETE /api/v3/phones/<d> session (Remove: passphrase session)
GET/PUT /api/v3/settings, POST /api/v3/prune session (changes: passphrase session)
POST /api/v3/passphrase, GET /api/v3/recovery, POST /api/v3/backup passphrase session (bodies sealed)
GET /api/v3/activity, GET /api/v3/logs session
GET/PUT /api/v3/homeassistant, POST …/test, POST …/sync session (changes: passphrase session; the token only sealed, never answered)
POST /api/v3/addresses/test session (0.19.0: do the home and away addresses answer, as this server?)
GET/PUT /api/v3/backupkey, GET/POST /api/v3/restore, POST/GET /api/v3/phone-backup/<d> phone or session (0.18.4, see Phone backups)
GET /api/v3/data/summary, …/stats, …/top, …/series, …/export, …/export/prices, …/export/ticked, GET /api/v3/data/autodelete session
POST /api/v3/data/delete, …/delete-everything, PUT /api/v3/data/autodelete, POST /api/v3/data/resend, …/recount passphrase session; deletes need the typed word and a fresh passphrase proof

Browsers sign every request (Authorization: RestockWeb3 s=, t=, n=, m=, an HMAC with the session key) and every answer with household data is sealed (Content-Type: application/x-restock-sealed). There are no cookies in v3, so another site can't use a session. Phones sign as in v2 (Restock2). Errors are { "error": "<code>", "message": "<something to show people>" }; v3 adds mode, released, update (403, with api: 3), done, handover, member, device-taken, challenge, current, weak, core, confirm and typed.

Limits: 10 wrong sign-ins (or made-up invites, or bad member signatures) from one address lock it out for 15 minutes; 1,200 requests a minute per address; 30 sign-in challenges a minute per address; 10 sign-in codes per 10 minutes per address; sessions end after 30 days unused (12 hours for a phone sign-in); Ask phones to resend once a day.

The server has no npm packages. It runs the Restock core (core/restock-core.mjs: the merge engine, crypto, household settings, and Home Assistant's sync, the same code as the phones), built from a Restock checkout:

RESTOCK_DIR=../Restock npm test       # builds core/ from Restock (default: the parent folder if it's a Restock checkout), then all the tests
DATA_DIR=./data npm start             # http://localhost:8787
node test/e2e-server.mjs              # a throwaway server on a temp folder; prints its URL and port
node test/e2e-server.mjs --ready      # ...with a passphrase set, a session and a phone invite

test/client.mjs has browsers and phones for tests against a real server; test/fake-ha.mjs is a pretend Home Assistant.

Build the image yourself: docker build -t restock-server . fetches Restock at the tag in the Dockerfile (RESTOCK_REF) and builds the web page and the core. To build without fetching, run npm run build:server-web and npm run build:server-core in a Restock checkout, copy its server/public/app/ and server/core/ here, and run docker build --build-arg WEB=local -t restock-server .. Without the web page, the server still syncs phones and shows a short "not built" page; without the core it can't keep a household.

Releases: bump version in package.json, restock/config.yaml and restock/Dockerfile, and RESTOCK_REF in the Dockerfile, then publish a GitHub release tagged v<version>. The image workflow checks they agree, builds for amd64 and arm64 and pushes ghcr.io/plentysoftware/restock-server:<version> and :latest.

Licence

GPL-3.0, like Restock. See LICENSE.

About

Restock server: your household's own sync server for Restock. Docker or a Home Assistant app.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages