Files

334 lines
21 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p align="center"><img src="branding/logo.svg" width="128" alt="IndexiPro logo"></p>
<h1 align="center">IndexiPro</h1>
<p align="center"><b>Photograph everything. Your AI does the research.</b></p>
IndexiPro helps a group of non-experts catalogue a large, mixed collection of physical things
quickly — a household, an attic, a shop's stock, a club archive, a storage unit. Furniture,
books, vinyl records, CDs, stamps, coins, art, silver, tools, electronics, boxes of who-knows-what: it all goes in
the same way.
* **The team** (each with their own account) only takes photos with their phones and optionally adds a note, a location and a quantity.
* **The AI** — your own Claude or ChatGPT subscription, connected over MCP — does the heavy
lifting. It researches each item in depth and verifies its identification against several
sources. It picks the category and fills in the details that matter for that kind of thing
(ISBN and edition for books, the exact pressing for records and CDs via Discogs — catalogue
number, matrix/runout, label, country — catalogue number for stamps, hallmarks for silver,
dimensions for furniture…), writes research notes on what it checked and what is still uncertain, and triages
the item.
* After every run the AI writes an **honest report**: what it found, what it couldn't
determine, and what needs more information. It reports in the chat and on the *AI reports* page.
* Anyone else (relatives, a buyer, an appraiser) can get a **read-only share link** — no
account, no password, no app. Per link you choose whether values and team notes are shown.
Value indications are available but deliberately low-key: the AI only adds them when there's real
evidence (comparable sold prices), and the app leads with the catalogue, not the money.
```
phones (Android app / any browser) web app (this server) your AI subscription
┌───────────────────────────┐ photos ┌──────────────────────┐ MCP ┌───────────────────────┐
│ scan QR → account → shoot │ ─────────▶ │ catalogue, search, │ ◀──────▶ │ research & verify, │
│ offline queue, to-do list │ ◀───────── │ photos, reports │ │ document, ask humans, │
└───────────────────────────┘ questions └──────────────────────┘ │ report back honestly │
│ read-only links └───────────────────────┘
▼
anyone you share with
```
## Features
**Web app** — dashboard (progress, latest AI report, highlights, triage, team leaderboard,
activity feed), full-text search across everything including custom fields, filters (status /
tier / category / location), bulk edits, merging duplicates, CSV export, printable QR sticker
labels, research notes, comparable sales, and optional copy-ready sales listings.
**Custom fields** — every item has free-form fields on top of the standard ones. The AI picks
the right fields per category and reuses the names already in use (the `field_conventions` tool),
so all books get `author / publisher / isbn / edition`, all records get `artist / label /
catalogue_number / matrix_runout / media_grade / sleeve_grade`, and all stamps get `country / catalogue /
catalogue_number`. Custom fields are searchable, editable in the web app, and become columns in the CSV export.
**Android app** — QR sign-up and sign-in, a big camera button, several photos per item,
gallery import, sticky location with recent-location chips, quantity, a note, and optional
condition and works / untested dropdowns. Uploads go
through a durable **offline queue** (attics and cellars have bad signal) that retries in the
background. *My items* shows what the AI made of your photos. *To-do* shows the AI's questions
("please photograph the hallmark") with a one-tap photo or answer reply. The app checks the
server for updates and shows a download banner.
**Browser capture** — iPhones, or anyone without the app, can scan the same QR code and add items from the browser.
**Triage tiers** — `notable` (rare, special or significant — worth a closer look), `sell`,
`lot` (handle together with similar items), `keep` (personal or sentimental), `donate`, `discard`.
**Statuses** — `new` (waiting for AI) → `identified` → `needs_info` (AI asked the team) →
`reviewed` → `listed` → `sold` / `kept` / `disposed`.
## Quick start
```bash
cp .env.example .env # set PUBLIC_URL, ADMIN_PASSWORD, COLLECTION_NAME, CURRENCY
docker compose up -d --build
```
Open `PUBLIC_URL` (or `http://<server-ip>:8080`) and sign in as **`admin`** with `ADMIN_PASSWORD`
(min. 6 characters). If you leave it empty, a password is generated and printed once in
`docker compose logs`. Change it under *My account*. All data, the database and the photos,
lives in `./data`. **Back up that folder.**
Without Docker: Node 22+, then `cd server && npm install && ADMIN_PASSWORD=… npm start`.
### Making it reachable
Phones on the same wifi can use `http://<server-ip>:8080`. But Claude.ai and ChatGPT connect
from the internet, so the server needs a **public https address**. The easiest options:
* **Cloudflare Tunnel** (free, no open ports): create a tunnel in the Cloudflare Zero Trust
dashboard, point a hostname at `http://indexipro:8080`, put the token in `.env` as
`CLOUDFLARE_TUNNEL_TOKEN`, then run `docker compose --profile tunnel up -d`.
* **Tailscale Funnel**: `tailscale funnel 8080`.
* Any reverse proxy with TLS (Caddy, Traefik, nginx).
Set `PUBLIC_URL` to that address so QR codes and AI connector addresses use it.
## Export packages
*Export* builds a package for a specific audience: one zip containing
* **items.csv**, the selected items with every custom field as its own column;
* **catalogue.pdf**, a cover with your introduction and contact line, a contents page, then the
items with photos and details. It can hold all selected items, only the notable ones, items
above a value, or the top N. Layout is detailed (one per page, up to 4 photos) or compact
(three per page);
* optionally **photos/** at full size (`0042-1-title.jpg`) and **items.json**;
* a **README.txt**.
Choose items with filters that **must all match** (categories, search words, locations, value
range, year range, tier, status, has photos) plus an optional **"…and at least one of"** group
(notable, made before or after a year, value at least, tier, AI confident). For example:
*computers that are notable or made before 2000*. Per package you decide whether the recipient
sees value indications, storage locations, internal notes and research notes. A live preview
shows the counts before you build.
Ready-made presets, all editable: **Antique book dealer**, **Computer museum**, **Record
dealer**, **Auction house**, **Insurance inventory**, **Charity / donation**, **Recycler**,
**Keepsakes overview**. Save your own with *Save as preset*.
## Accounts and access
| Who | How they get in | Can |
|---|---|---|
| **Admin** | username + password | everything: team accounts, share links, settings, delete |
| **Editor** | username + password; created by scanning the join QR, or added by an admin | add, edit and research items, answer AI questions, create their own AI keys |
| **Share link** | a read-only link, **no account** | look around; value indications can be hidden per link |
| **AI** | a personal API key per AI account | read photos, fill in data, research, report; every change is logged as e.g. *AI (Sam's Claude)* |
Admins can add people directly (a temporary password is generated), reset passwords, change
roles and disable accounts. Disabling an account instantly signs out that person's phones and
revokes their AI keys.
## Getting started
1. **Team:** an admin opens *Team & sharing* and shows the **join QR code** (there's a
fullscreen button). Helpers point their phone camera at it and tap the link. On Android they
install the app and tap *Open in the app*; on an iPhone or without the app they stay in the
browser. They enter their name and choose a password, which creates their account. Join codes
last 12 hours and can be stopped at any time.
To add a second phone for the same person: *My account → Pair a phone* shows a personal, single-use QR code.
2. **Sharing:** on the same page, under *Read-only share links*, type who the link is for and
click *Create link*. The link is copied to the clipboard. Untick *show values* to hide value
indications for that link, and switch a link off whenever you like.
3. **AI** (anyone on the team; no technical knowledge needed): open *Connect AI*.
* **Once:** copy the clean **server URL** (`https://<your-server>/mcp`) into your AI app.
Choose **OAuth** authentication when offered. Sign in with your **IndexiPro username and
password**, review the requested access, then approve it. No API token needs to be copied.
For Claude, choose **Register automatically** under **OAuth client**, leaving optional
client ID and secret fields empty. Enable the connector in the chat before starting work.
* **Verify:** the page shows authentication, completed handshake, tool discovery and the
first successful tool call separately, with the latest connection error. These are historical
milestones, not a claim that an AI app is currently online. Refresh the status after connecting.
* **Manual clients:** expand **Advanced: manual API token**. Use `/mcp` with
`Authorization: Bearer <token>`, or the private one-address URL if required. Existing manual
connections still work. In Codex, a bearer-token environment-variable field expects the
*name* of an environment variable, not the token itself.
* **Replacing a failed setup:** remove the failed connector in the AI app and add the clean
`/mcp` URL using OAuth; do not reuse an old token-bearing URL for OAuth.
* **Every time after that:** click **🤖 Start AI research**, copy the start message, paste it
into a new chat and send. The message contains no secret. The AI reports back when it's
done; say *"continue"* for the next batch.
* Developers: it's a standard Streamable-HTTP MCP server; Claude Code:
`claude mcp add --transport http indexipro <address>`.
Set the collection's **country / region** under *Settings* (or `REGION` in `.env`). The AI
researches internationally, because prices differ a lot between platforms and countries; in the
Netherlands, for example, eBay.de and Marktplaats often say more than eBay.nl. It gives the local
market extra weight and notes which market each comparable comes from. You can also put extra
instructions for the AI under *Settings → Extra guidance* (e.g. "Paperbacks can be grouped as lots."). They're sent to the AI with every connection.
**Tip:** write the item number shown after saving (e.g. `#142`) on a piece of masking tape on
the object, or print QR labels from the browse page (*Select → Print labels*). Then a request
from the AI like "please photograph the underside of #142" is easy to act on.
## How the AI works
By default the AI does **deep research on every item**:
1. It reads every label and mark, zooming in on photos at full resolution.
2. It verifies its identification against several independent sources (maker and museum
references, collector catalogues, specialist forums, auction archives) and pins down the exact
model, edition or variant.
3. It records what it checked in **research notes**, together with an honest confidence level.
4. It is free to research however it sees fit: web and image search, maker archives, museum
collections, collector databases, forums, auction archives, and marketplaces in any country.
The goal is that people understand what they're looking at. Where there's evidence, it adds a
value indication backed by comparable sales from several markets.
5. When the photos aren't enough, it asks the team one simple question.
6. At the end of a run, or whenever it has to stop, it calls `submit_run_report` and writes the
same report in the chat: what it found per item, what it is confident about, what it couldn't
determine, what needs more info or an expert, and anything that went wrong.
### Keeping it manageable with thousands of items
Under *Settings → AI questions & research depth*:
* **Questions to the team:** *On*, which follows the steps below, or *Never ask*.
* **Deep research only from:** below this estimated value the AI does a quick identification
and moves on (0 = deep research for everything).
* **Questions per item, by the AI's value estimate:** an editable ladder. The default:
| Estimated value | Max questions |
|---|---|
| under 50 | 0 |
| 50 – 100 | 1 |
| 100 – 500 | 4 |
| 500 – 1 500 | 8 |
| 1 500 and up | unlimited |
Plus special cases: **AI unsure** (low identification confidence) → 5, **no value estimate
yet** → 1, **marked notable** → 10. An item gets whichever applicable rule allows the most;
an empty field means unlimited. Add, change or remove steps as you like.
The server enforces these limits: `ask_humans` refuses requests that break them, says which
rule applies, and tells the AI to finish the item and note what is uncertain. The AI is told to
save its value estimate first, so the right step applies. Every item the AI sees says whether
it may ask about it.
Every question also has **Skip — don't ask again**: on the item page, on the *Questions* page and
in the app's To-do tab. The *Questions* page has **Dismiss all**. A skipped item is marked
identified (or goes back to the AI once if it wasn't identified yet), and the AI won't ask about
it again unless someone clicks *Allow questions again* on the item.
### MCP tools
| Tool | What the AI uses it for |
|---|---|
| `collection_overview` | counts, progress, what's waiting |
| `field_conventions` | categories and custom field names already in use, to stay consistent |
| `next_items_to_identify` | the next unprocessed items **with photos** and notes from the team |
| `get_item`, `get_photo` | the full record; one photo at full resolution to read marks and labels |
| `list_items`, `search_items` | filtering and full-text search (duplicates, sets, related items) |
| `update_item` | title, category, maker, year, condition, **custom attributes**, research notes, confidence, tier, optional value range |
| `bulk_update` | triaging many items at once |
| `add_comparables` | recording the reference or sold listings it found as evidence |
| `ask_humans` | putting a question on the team's to-do list (the item returns to the queue when answered) |
| `submit_run_report` | the honest end-of-run report, shown on *AI reports* and on the dashboard |
| `save_listing` | storing a ready-to-paste sales listing, when asked |
| `merge_items` | combining duplicates |
| `research_links` | starting points grouped by purpose: identification (image search, Wikipedia, museum collections, forums), category databases (AbeBooks, Discogs, Colnect, Numista, Chrono24, BoardGameGeek…), auction archives, eBay sold listings in 10 countries, and regional marketplaces (Marktplaats, 2dehands, Kleinanzeigen, Leboncoin, Subito, Wallapop, Tradera, Willhaben, Allegro, Vinted, Etsy…). The AI is free to use any other source too. |
| `search_ebay` | optional extra: live eBay listings via the official API, only when `EBAY_CLIENT_ID` and `EBAY_CLIENT_SECRET` are set |
Two prompts, `catalogue_batch` and `write_listings`, are included too. The server is a standard
Streamable-HTTP MCP endpoint (sessions and sessionless requests are supported) at `/mcp/<key>`, or at `/mcp` with `Authorization: Bearer <key>`.
## Security notes
* **Passwords** are stored as scrypt hashes. Wrong logins are limited per client address and
per username, so the limit holds even if a client lies about its address. Resetting or changing
a password signs that person's other browsers out; phones and AI connections have their own
tokens and keep working. Disable the account to cut off everything.
* **AI connections** use OAuth with S256 PKCE, explicit consent, one-hour access tokens and
rotating refresh tokens (90 days). Registrations and grants survive restarts. Removing a
connection or disabling its owner revokes access and refresh. Manual API tokens remain
supported; they are personal, stored hashed, and shown only once. Anyone who has the token
can read and edit the collection; if it leaks, remove it on *Connect AI* and make a new one.
Prefer *server URL + token*. With the one-address form the token is part of the URL, so keep
`/mcp` out of your proxy's access log (see `deploy/nginx.example.conf`).
* **Share links** are read-only (the server refuses writes) and revocable. They never see the
AI's questions, the activity log or internal fields. Per link you choose whether **value
indications** (with research notes and comparables) and **team notes & storage locations** are
shown. Hidden fields are stripped from every response, and can't be reached through filters,
sorting, search or the CSV either.
* **Phones:** tokens are stored hashed. Signing out a phone, or disabling its owner, takes effect immediately.
* **Exports:** spreadsheet cells can't start a formula, and links saved by the AI must be http(s).
* **Browser hardening:** the site can't be framed by other sites and only loads scripts and data from itself.
* **OAuth behind a proxy:** forward `/.well-known/`, `/authorize`, `/token`, `/register`,
`/revoke` and `/oauth/` to the app without login challenges or bot interstitials. Set
`PUBLIC_URL` to the canonical public HTTPS origin. OAuth registration and token endpoints
have application rate limits. Keep authorization and consent query strings out of access logs.
* **Behind a proxy:** the server only believes `X-Forwarded-For` from proxies on the same machine or
private network (`TRUST_PROXY` changes this).
* The container runs as an unprivileged user.
## Backups
The server writes a **snapshot of the database** to `data/backups/` once a day and keeps the
last 14, which protects against a bad edit or a bad AI run. Photos are not in the snapshot, and
everything is still on one disk. Copy the whole `data/` folder to another machine regularly.
## Android app: updates and releases
The app updates itself from the server it's paired with. When the server offers a newer version,
a banner appears (there's also *⋮ → Check for updates*). Tapping **Update** downloads the APK,
verifies its SHA-256 checksum against the server's metadata, and opens Android's installer. The
first time, Android asks to allow IndexiPro to install apps. Updates only install over a copy
signed with the same key.
The server offers the current APK at two addresses: `/download/indexipro.apk` (always the
latest) and `/download/IndexiPro-<version>.apk`.
**Making a release:**
```bash
cd android
# 1. bump versionCode and versionName in app/build.gradle.kts, commit
# 2. build, commit the web-app copy, tag v<version>, push, create the Gitea release:
GITEA_TOKEN_FILE=/path/to/token ./release.sh [release-notes.md]
```
Every release gets the tag `v<versionName>` and the asset `IndexiPro-<versionName>.apk`, so
the download URL is predictable:
```
https://git.autisme.monster/juli/indexipro/releases/download/v<version>/IndexiPro-<version>.apk
```
**For F-Droid metadata:** point at the versioned release asset, not at the fixed
`server/public/download/indexipro.apk` path in the source tree. For example
`Binaries: https://git.autisme.monster/juli/indexipro/releases/download/v%v/IndexiPro-%v.apk`
with `UpdateCheckMode: Tags`. Then auto-update picks up each new version on its own.
To only build (no tag or release): `./build-and-publish.sh`. It updates the web-app copy and
writes `android/dist/IndexiPro-<version>.apk`.
Release signing uses `android/keystore.properties` and `android/indexipro-release.jks`. These
are **not committed — keep a backup**, because without the same key Android refuses updates to
copies that are already installed. Without them the build falls back to the debug key. Building
requires JDK 17 and the Android SDK (`local.properties`).
## Development
```bash
cd server
npm install
npm test # end-to-end test: accounts, pairing, uploads, MCP keys, reports, share links
node scripts/seed-demo.js http://localhost:8080 <admin-password> # demo items + a demo report
node scripts/render-icons.js # re-render favicons + Android icons from branding/
```
Stack: Node 22, Express, SQLite (better-sqlite3, FTS5 search), sharp for images, the official
MCP TypeScript SDK; plain HTML/JS front-end without a build step; Kotlin + Jetpack Compose,
OkHttp, WorkManager and ZXing for Android.
## Licence
MIT — see [LICENSE](LICENSE). The bundled DejaVu fonts (`server/assets/fonts/`) have their own free licence, included next to them.