No description
  • Rust 98.6%
  • Shell 1.2%
  • Dockerfile 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Fabian Stamm a2c3f1dd13
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/tag/mcp-release Pipeline was successful
ci/woodpecker/tag/android Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/tag/arch-release Pipeline was successful
Update to deltaui 0.6.2; page header actions wrap below the title on narrow screens
2026-11-26 17:07:08 +01:00
.cargo Initial BuddyBox implementation 2026-10-22 10:51:35 +02:00
.githooks Reject Co-Authored-By trailers in commit messages 2026-10-22 17:17:01 +02:00
.woodpecker Publish Arch packages to the generic 'extra' group 2026-11-19 14:45:05 +01:00
android Sign native apps in through the browser instead of a pasted device token 2026-11-19 17:10:48 +01:00
api Import Homebox collection exports 2026-10-26 20:27:59 +01:00
assets Initial BuddyBox implementation 2026-10-22 10:51:35 +02:00
crates Update to deltaui 0.6.2; page header actions wrap below the title on narrow screens 2026-11-26 17:07:08 +01:00
deploy/k8s Add Kubernetes manifests 2026-10-22 18:46:21 +02:00
docs Require real secrets, cap request bodies, embed the web app and document backups 2026-10-23 21:05:09 +02:00
packaging/arch Package the desktop client for Arch and publish it to the Forgejo Arch registry on tags 2026-11-19 14:36:09 +01:00
scripts Publish Arch packages to the generic 'extra' group 2026-11-19 14:45:05 +01:00
.dockerignore Initial BuddyBox implementation 2026-10-22 10:51:35 +02:00
.env.example Rate limit auth, public loan page and RPC calls 2026-10-22 18:27:51 +02:00
.gitignore Ignore makepkg work dirs 2026-11-19 14:39:58 +01:00
.gitmodules Use deltaui as a pinned git dependency instead of a submodule 2026-10-22 18:21:50 +02:00
Cargo.lock Update to deltaui 0.6.2; page header actions wrap below the title on narrow screens 2026-11-26 17:07:08 +01:00
Cargo.toml Update to deltaui 0.6.2; page header actions wrap below the title on narrow screens 2026-11-26 17:07:08 +01:00
docker-compose.yml Require real secrets, cap request bodies, embed the web app and document backups 2026-10-23 21:05:09 +02:00
Dockerfile Add an MCP server exposing the BuddyBox API to LLM clients 2026-10-25 16:50:01 +01:00
PLAN.md Use deltaui 0.3.0 from crates.io instead of the local checkout patch 2026-11-18 01:03:38 +01:00
README.md Sign native apps in through the browser instead of a pasted device token 2026-11-19 17:10:48 +01:00
rust-toolchain.toml CI: build, sign and release the Android APK for Obtainium 2026-11-05 16:43:01 +01:00

BuddyBox

BuddyBox icon

Self-hosted inventory for households and friend groups.

The implementation plan lives in PLAN.md.

Status

Phase 0/1 foundation:

  • SQLite/PostgreSQL migrations and generated SeaORM entities
  • Axum server with health endpoints and embedded SPA fallback
  • PocketID OIDC login, JWT access tokens, rotating refresh cookies
  • JSON-RPC API with System.Ping, Users.Me, Spaces.List, Spaces.Create, ItemTypes.List/Create, Locations.List/Create, Items.List/Create/Get/SetFields/Update/Move/Archive/Restore/History, CustomFields.List/Create, Tags.List/Create/Assign/Unassign, Loans.List/Get/CreateOutbound/CreateInbound/ReturnItems, Loans.Extend/Cancel/AddItems/RemoveItem/History, Loans.CreateMagicLink/RevokeMagicLink/ListExtensionRequests/ResolveExtension, Dashboard.Summary, Members.*, Groups.*, People.* and the public Loans.MagicLinkInfo/MagicLinkRequestExtension
  • Reminder policies, notification job materialization, and a scheduler loop
  • ntfy delivery and Telegram message delivery
  • Notification settings UI, ntfy test, Telegram link codes
  • Long-polling Telegram bot with native buttons: /lend quick loans (pick space → items → person → due date → confirm, optional magic link after), /loans and /due listings with per-item and whole-loan return buttons, /pending with approve/deny buttons, plus /start, /cancel, /help, /unlink and a native command menu (replies in the linked user's language)
  • Label sheets with templates, a visual label designer, and PDF/SVG output
  • Camera QR scanning in supported browsers plus USB/typed scanning
  • Location detail, moving, and location photos
  • Full integration test suite on SQLite and PostgreSQL
  • Android app: crates/android (native entry reusing the shared UI), a Gradle project with build/signing/arm64-host scripts (android/, debug APK builds locally) and an NDK check pipeline — functional end-to-end via browser (OIDC) login and a native transport (see android/README.md)
  • Homebox import: upload a collection-export zip from the items page (or via the import_homebox_zip MCP tool); preview first, applies idempotently, locations, quantity groups (split into boxes), tags, custom fields and photos included
  • Photo attachments with thumbnails and local content-addressed storage
  • paperless-ngx search and receipt linking per space
  • MCP server (crates/mcp): search, view, create, edit, move and lend items from any Model Context Protocol client (Claude Desktop, coding agents) over stdio (see MCP server)
  • Hierarchical location and box tree
  • Editable custom fields and tag assignment in item detail
  • QR/Code128 rendering, code resolution, a scan box, and printable label sheets
  • Public magic-link page at /loan/:token
  • Responsive deltaui WASM app: sidebar on desktop, top bar and bottom navigation on phones, URL routing with deep links and browser history, English and German (automatic or chosen in Settings → General), toasts and confirm dialogs, and a shared component kit (crates/ui/src/kit)
  • Dashboard, members, invites and share links, groups, people, item edit/move/archive/history and loan extend/cancel/history (see PLAN.md for the details)
  • Inventory table/cards with search, type/location/status and custom-field filters and sorting, a validated new-item form with the type's custom fields, item detail pages, loan list, loan wizard and loan detail (returns, share link, extension requests; inbound loans create tracked "Borrowed" items that are archived on return), location tree with breadcrumbs/move/photos, item-type and custom-field management, and settings split into General, Spaces, Notifications and paperless-ngx

Development

Requirements:

  • Rust 1.98+ with the wasm32-unknown-unknown target
  • trunk
  • jrpc-cli (from the JsonRPC-Rust repository)
cp .env.example .env

JWT_SECRET is required (at least 32 bytes; generate one with openssl rand -base64 32) — the server refuses to start without it. Set APP_ENCRYPTION_KEY to use a separate key for encrypting stored provider tokens; it falls back to JWT_SECRET.

Build the frontend once:

cd crates/web
trunk build

Re-run trunk build after frontend changes; a running dev server picks the new bundle up without a restart (it serves crates/web/dist from disk and recomputes the CSP inline-script hashes per request). A binary built without a bundle serves the embedded one (or a placeholder page).

MCP server

buddybox-mcp exposes the inventory over the Model Context Protocol: a thin stdio bridge that maps each tool onto the same JSON-RPC the web app uses, so any MCP client can search, inspect and manage a space. It reuses device tokens for auth — mint one in the web app under Account → Device tokens.

cargo build -p buddybox-mcp --release   # target/release/buddybox-mcp
bash scripts/build-mcp.sh               # + a dist/buddybox-mcp-<os>-<arch>.tar.gz

.woodpecker/mcp-release.yaml publishes that tarball (with its sha256) as a release asset whenever a v* tag is pushed — deliberately a plain executable, not part of the Docker image. On other platforms, run the build script there.

It is configured entirely by environment variables:

Variable Meaning
BUDDYBOX_URL base URL of the server, e.g. https://buddybox.example
BUDDYBOX_TOKEN a device token (Account → Device tokens)
BUDDYBOX_SPACE optional default space name or id; tools also take a per-call space

Register the binary in an MCP client such as Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "buddybox": {
      "command": "/path/to/buddybox-mcp",
      "env": {
        "BUDDYBOX_URL": "https://buddybox.example",
        "BUDDYBOX_TOKEN": "bb_…",
        "BUDDYBOX_SPACE": "Home"
      }
    }
  }
}

MCP over HTTP (no extra binary)

The server itself speaks MCP at POST /mcp (streamable HTTP, stateless), with the same tools. Authenticate with a device token as a bearer token; the optional X-BuddyBox-Space header (name or id) sets the default space. Calls run in-process through the normal RPC handlers, so permissions and rate limits are the web app's.

claude mcp add --transport http buddybox https://buddybox.example/mcp \
  --header "Authorization: Bearer bb_…" --header "X-BuddyBox-Space: Home"
{ "mcpServers": { "buddybox": {
    "type": "http",
    "url": "https://buddybox.example/mcp",
    "headers": { "Authorization": "Bearer bb_…", "X-BuddyBox-Space": "Home" } } } }

Only clients that can send a custom Authorization header work (there is no OAuth flow). import_homebox_zip reads a file from the machine running the MCP server, so it is refused on /mcp; use the stdio binary or the web app's import for that.

Tools: buddybox_summary, search_items (text, type, location and custom-field filters), get_item, list_spaces, list_item_types, list_locations, list_fields, create_item, update_item, move_item, set_item_fields, list_loans, lend_items, return_item and import_homebox_zip (path on the MCP host). Names are matched by id or case-insensitive name, and an unknown name returns the available options so the model can correct itself. tests/stdio_e2e.rs drives the whole MCP↔HTTP path against a scripted stub.

Deployment

docker compose up runs BuddyBox with SQLite on a volume. Backups and the restore procedure are documented in docs/BACKUP.md. For Kubernetes, deploy/k8s holds a Kustomize setup (namespace, config map, volume, single-replica deployment, service and ingress); create the secret from deploy/k8s/secret.example.yaml first and apply with kubectl apply -k deploy/k8s. Behind a reverse proxy or ingress set TRUST_PROXY_HEADERS=true, otherwise all visitors share one rate-limit bucket.

UI logging

The UI logs to the browser console (debug in dev builds, info in release): RPC calls with timings, navigation, session events, failed actions and panics. Change the level without rebuilding with ?log=trace|debug|info|warn|error in the URL or localStorage.setItem("buddybox.log", "debug"). Native builds read BUDDYBOX_LOG.

UI translations

UI texts live in crates/ui/i18n/en.txt and de.txt (key = value, {name} placeholders, key.one / key.other for plurals). Screens use t("key"); a unit test fails when a key is missing in either language or used but not defined. Add a language by adding a catalog and an entry in LANGUAGES in crates/ui/src/i18n.rs.

Run the server:

cargo run -p buddybox-server

The server listens on http://127.0.0.1:8085 and stores a SQLite database in ./data/buddybox.db. Without OIDC configuration the login screen is shown but sign-in is unavailable; the API can still be tested with a JWT issued by the test suite.

For PostgreSQL:

DATABASE_URL=postgres://buddybox:buddybox@localhost/buddybox cargo run -p buddybox-server

Tests

cargo test -p buddybox-migrations -p buddybox-server
cargo check -p buddybox-ui --target wasm32-unknown-unknown

Code generation

The JSON-RPC API definition is api/buddybox.jrpc. Generated code is committed under crates/api. Regenerate with the pinned JsonRPC-Rust CLI:

./scripts/codegen.sh

The current jrpc-cli template is already wasm-compatible; no post-processing is required.

Docker

docker compose up --build

The Compose file keeps SQLite on the /data volume. To use PostgreSQL, set DATABASE_URL_OVERRIDE in .env, for example:

DATABASE_URL_OVERRIDE=postgres://buddybox:buddybox@postgres:5432/buddybox

and start the bundled (volume-backed) database with docker compose --profile postgres up.

The image builds the WASM frontend and the server. The server binary embeds the built frontend, so the runtime image contains only the binary. The SQLite database and attachments live in the buddybox-data volume.

WASM size

The release frontend is built with trunk build --release --cargo-profile web (see [profile.web] in the workspace): opt-level = "z", panic = "abort", fat LTO, plus trunk's wasm-opt -Oz pass — together about a third smaller than a plain release build (~8.5 MB raw, ~3.2 MB gzipped today; the bulk is deltaui/Vello/wgpu). --release is what enables wasm-opt and minification, --cargo-profile web the size flags; strip must not be enabled for this profile, it removes the target_features section wasm-opt validates against. Use twiggy top -n 20 <file>.wasm to see who owns the remaining bytes.

Build cache

The Dockerfile uses BuildKit cache mounts for Cargo's registry/git caches, the Rust target directory, and Trunk's cache. Source changes therefore only recompile the affected side: frontend edits do not invalidate the server dependency build, and server edits do not rebuild the WASM bundle. Because the server binary embeds the built frontend, a frontend change does relink the server binary (fast); it does not recompile the server's dependencies. In CI (e.g. a fresh docker-in-docker daemon) these mounts start cold, as there is no persistent BuildKit cache between builds.

BuildKit is enabled by default in current Docker versions. If cache mounts are not active, force it:

DOCKER_BUILDKIT=1 docker compose build

The first build populates the caches and is slower. Later builds reuse them. To clear the cache, run docker builder prune (this affects all Docker builds).

OIDC

Configure the PocketID client with the callback URL:

${PUBLIC_URL}/auth/callback

Scopes: openid profile email groups.

The admin group (configurable via OIDC_ADMIN_GROUP) maps to the instance admin role. Without an admin group configured, the first user becomes the instance admin.

The desktop and Android apps use the same provider and callback: they open /auth/login?return_to=<app address>&challenge=<sha256 of a secret> in the system browser (return_to is a loopback address or buddybox://auth, and only accepted together with a challenge), receive a one-time code there and redeem it with the secret at POST /auth/exchange. No extra provider configuration is needed. Device tokens remain for the MCP server.