Self-Hosting touched-node
touched-page/touched-node (MIT License) is the open-core single-user Personal Media Library, blog, and open-protocol node for touched.page.
It runs from a single multi-arch Docker image (ghcr.io/touched-page/touched-node:latest, supporting linux/amd64 and linux/arm64) with embedded PGlite by default—zero external database setup, zero OAuth dependency, full browser extension and Android client compatibility, and optional Cloud Bridge + Direct Node Pull.
1. Turnkey Docker Deployment (Embedded PGlite)
Step 1: Clone & prepare persistent storage
The container runs as non-root UID 1000. Create the local data directory first:
git clone https://github.com/touched-page/touched-node.git
cd touched-node
mkdir -p data && chmod 700 data
sudo chown 1000:1000 dataStep 2: Configure .env and generate OWNER_KEY
OWNER_KEY unlocks /unlock in the browser and authenticates your browser extension (Authorization: Bearer tp_live_...). Always use a strong random key prefixed with tp_live_:
cp .env.example .env
printf 'OWNER_KEY=tp_live_%s\n' "$(openssl rand -hex 32)" >> .envEdit .env to set your handle, display name, site title, and public HTTPS origin:
OWNER_HANDLE=lin
OWNER_DISPLAY_NAME=Lin
SITE_TITLE=Lin's Media Library
TOUCHED_PUBLIC_ORIGIN=https://library.example.comStep 3: Pull and start
docker compose up -dStep 4: Verify health and open protocol
curl -s http://127.0.0.1:4411/healthz
# Expected: {"ok":true,"mode":"personal-node","storage":"pglite","cloudLinked":false}
curl -sI http://127.0.0.1:4411/touched.json | grep -iE 'HTTP/|access-control-allow-origin'
# Expected: HTTP/1.1 200 OK + access-control-allow-origin: *Open http://127.0.0.1:4411/unlock and enter OWNER_KEY to start editing. Visitors read your public reviews, posts, /rss.xml, and /touched.json without logging in; private and archive records never leave the database.
2. Reverse Proxy with HTTPS (Caddy Example)
By default Compose binds only to 127.0.0.1:4411. Put Caddy (or Nginx/Traefik) in front for automatic TLS, keep a strong OWNER_KEY, and leave ALLOW_OPEN_LOCAL_WRITE=false:
library.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:4411 {
header_up X-Real-IP {remote_host}
}
}3. Optional External PostgreSQL / Neon / Supabase
Prefer PostgreSQL over embedded PGlite? Set DATABASE_URL in .env and restart—touched-node automatically switches to PostgreSQL and creates its minimal 8-table schema idempotently on startup:
DATABASE_URL=postgresql://user:password@ep-example.us-east-2.aws.neon.tech/personal_node?sslmode=requireOr enable the bundled PostgreSQL 17 Compose profile:
POSTGRES_PASSWORD=replace-with-strong-password
DATABASE_URL=postgresql://personal_node:replace-with-strong-password@postgres:5432/personal_nodedocker compose --profile postgres up -d --wait postgres
docker compose up -d nodeVerify GET /healthz reports "storage":"postgres". Never share one PostgreSQL database across two separate nodes.
4. Backup, Migration & Upgrades
Migrate data from touched.page Cloud
- Download your backup at
https://touched.page/settings(touched-backup-<handle>.json). - Unlock your
touched-node, open/settings, and upload the JSON—or import via CLI:
curl -X POST https://library.example.com/api/import \
-H "Authorization: Bearer tp_live_YOUR_OWNER_KEY" \
-H "Content-Type: application/json" \
--data-binary @touched-backup-handle.jsonPGlite disk backup & container upgrades
# Stop container cleanly before tarring PGlite directory
docker compose stop node
tar czf personal-node-data-$(date +%Y%m%d).tar.gz data
docker compose start node
# Upgrade to latest multi-arch release
docker compose pull && docker compose up -d5. Optional Cloud Account Bridge & Direct Node Pull
touched-node works offline forever. Whenever you also want cross-medium discovery and WorkDB aggregation without giving up self-hosting, open /cloud on your node:
- Create a scoped API key (
read:self+mark:write) inhttps://touched.page/settings. - Paste
https://touched.pageand your API key on/cloudand click Save & Connect. - Click Sync Now (Push + Pull) to push local updates and pull cross-device metadata, then browse
/discoverdirectly from your own node. - Opt-in Direct Node Pull: Enter your public
https://library.example.com/touched.jsonURL in the Direct Self-Hosted Node section on/cloudand flip visibility to Public (off by default). Followers' browsers will pull fresh updates straight from your server over CORS, falling back cleanly to the cloud cache if your node is offline—and your node also caches followed peers' direct URLs locally so peer-to-peer reading keeps working even when you disconnect from the cloud.
Disconnecting from Cloud on /cloud only deletes the stored API key; your local library, posts, and lists stay untouched.
6. Environment Variables & Endpoints
| Variable | Description | Default |
|---|---|---|
OWNER_HANDLE | Initial owner handle (without @) | owner |
OWNER_DISPLAY_NAME | Initial display name | owner |
SITE_TITLE | Custom top-bar title | empty |
OWNER_KEY | Owner unlock & extension Bearer key (prefix tp_live_) | empty |
ALLOW_OPEN_LOCAL_WRITE | Allow passwordless local writes (isolated loopback only) | false |
PGLITE_DATA_DIR | Embedded PGlite directory (used when DATABASE_URL is unset) | /data/pglite |
DATABASE_URL | External PostgreSQL URL (overrides PGlite) | empty |
TOUCHED_PUBLIC_ORIGIN | Public HTTPS origin for RSS, touched.json, and canonical links | auto |
BIND_IP / HOST_PORT | Compose host bind IP & port | 127.0.0.1 / 4411 |
CLOUD_API_URL / CLOUD_API_KEY | Optional preconfigured Cloud Bridge settings | https://touched.page / empty |
Key public endpoints:
GET /healthz— health and storage statusGET /touched.json&GET /@<handle>/touched.json— open protocol (Access-Control-Allow-Origin: *)GET /rss.xml&GET /@<handle>/rss.xml?scope=all|posts|reviews— outbound RSSGET /extension.zip— packaged browser extension