Skip to content

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:

bash
git clone https://github.com/touched-page/touched-node.git
cd touched-node
mkdir -p data && chmod 700 data
sudo chown 1000:1000 data

Step 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_:

bash
cp .env.example .env
printf 'OWNER_KEY=tp_live_%s\n' "$(openssl rand -hex 32)" >> .env

Edit .env to set your handle, display name, site title, and public HTTPS origin:

dotenv
OWNER_HANDLE=lin
OWNER_DISPLAY_NAME=Lin
SITE_TITLE=Lin's Media Library
TOUCHED_PUBLIC_ORIGIN=https://library.example.com

Step 3: Pull and start ​

bash
docker compose up -d

Step 4: Verify health and open protocol ​

bash
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:

txt
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:

dotenv
DATABASE_URL=postgresql://user:password@ep-example.us-east-2.aws.neon.tech/personal_node?sslmode=require

Or enable the bundled PostgreSQL 17 Compose profile:

dotenv
POSTGRES_PASSWORD=replace-with-strong-password
DATABASE_URL=postgresql://personal_node:replace-with-strong-password@postgres:5432/personal_node
bash
docker compose --profile postgres up -d --wait postgres
docker compose up -d node

Verify GET /healthz reports "storage":"postgres". Never share one PostgreSQL database across two separate nodes.


4. Backup, Migration & Upgrades ​

Migrate data from touched.page Cloud ​

  1. Download your backup at https://touched.page/settings (touched-backup-<handle>.json).
  2. Unlock your touched-node, open /settings, and upload the JSON—or import via CLI:
bash
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.json

PGlite disk backup & container upgrades ​

bash
# 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 -d

5. 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:

  1. Create a scoped API key (read:self + mark:write) in https://touched.page/settings.
  2. Paste https://touched.page and your API key on /cloud and click Save & Connect.
  3. Click Sync Now (Push + Pull) to push local updates and pull cross-device metadata, then browse /discover directly from your own node.
  4. Opt-in Direct Node Pull: Enter your public https://library.example.com/touched.json URL in the Direct Self-Hosted Node section on /cloud and 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 ​

VariableDescriptionDefault
OWNER_HANDLEInitial owner handle (without @)owner
OWNER_DISPLAY_NAMEInitial display nameowner
SITE_TITLECustom top-bar titleempty
OWNER_KEYOwner unlock & extension Bearer key (prefix tp_live_)empty
ALLOW_OPEN_LOCAL_WRITEAllow passwordless local writes (isolated loopback only)false
PGLITE_DATA_DIREmbedded PGlite directory (used when DATABASE_URL is unset)/data/pglite
DATABASE_URLExternal PostgreSQL URL (overrides PGlite)empty
TOUCHED_PUBLIC_ORIGINPublic HTTPS origin for RSS, touched.json, and canonical linksauto
BIND_IP / HOST_PORTCompose host bind IP & port127.0.0.1 / 4411
CLOUD_API_URL / CLOUD_API_KEYOptional preconfigured Cloud Bridge settingshttps://touched.page / empty

Key public endpoints:

  • GET /healthz — health and storage status
  • GET /touched.json & GET /@<handle>/touched.json — open protocol (Access-Control-Allow-Origin: *)
  • GET /rss.xml & GET /@<handle>/rss.xml?scope=all|posts|reviews — outbound RSS
  • GET /extension.zip — packaged browser extension

Open-core ecosystem under MIT License. Built around works, writing, and data sovereignty.