Skip to content
taog
GitHub

§ Docs · v0.1.0-alpha

Self-hosting Taog

Compose quickstart, configuration, read-only NAS mounts, the complete HTTP surface, and the safety model behind every action that writes to disk.

Live available in v0.1.0-alphaT8 lands with the Safe Remediation milestone
1.1

Requirements

  • Docker Engine with Compose v2 (the docker compose plugin).
  • A Linux host for production storage — Unraid, TrueNAS SCALE, Proxmox, or any Debian/Ubuntu box. Mount propagation and inode semantics are Linux features.
  • Local disk for ./data — the SQLite index and WebP thumbnails. Keep it off network shares: SQLite WAL relies on shared memory that NFS and SMB cannot provide.
  • Nothing else. The backend image already bundles ffmpeg, tesseract-ocr, and poppler-utils, and runs as an unprivileged taog user.
1.2

Quickstart

Clone the repository and start both services. The first run builds the Go backend and the Next.js studio images.

shell
$ git clone https://github.com/jerrytunin/taog.git && cd taog && docker compose up -d

Confirm the API is healthy and the database is in WAL mode:

shell
$ curl -s http://localhost:8115/api/v1/health
response · 200
{"status":"ok","service":"taog","version":"0.1.0-alpha","db":"wal"}

Then open the studio at http://localhost:8116. After pulling new commits, rebuild with docker compose up -d --build.

1.3

Ports

Host portServiceServes
8115taog-backendREST /api/v1/*, SSE /api/v1/events, MCP POST /mcp
8116 → 3000taog-frontendNext.js studio UI

To move the backend, change TAOG_ADDR and the matching ports entry together.

1.4

Compose file

The stack shipped in the repository root:

docker-compose.yml
services:  taog-backend:    build:      context: ./backend      dockerfile: Dockerfile    container_name: taog-backend    restart: unless-stopped    ports:      - "8115:8115"    environment:      - TAOG_ADDR=:8115      - TAOG_DB_PATH=/data/taog.db      - TAOG_THUMB_DIR=/data/thumbs      - TAOG_MOUNT_ROOT=/mnt      - TAOG_CORS_ORIGIN=*      - TAOG_SCAN_CONCURRENCY=4    volumes:      - ./data:/data      # Uncomment to expose host/NAS mounts read-only for indexing:      # - /mnt:/mnt:ro,rslave   taog-frontend:    build:      context: ./frontend      dockerfile: Dockerfile      args:        - NEXT_PUBLIC_API_URL=http://localhost:8115    container_name: taog-frontend    restart: unless-stopped    ports:      - "8116:3000"    environment:      - NEXT_PUBLIC_API_URL=http://localhost:8115    depends_on:      - taog-backend
2.1

Environment variables

All configuration is read from the environment of taog-backend at startup. Empty values fall back to the defaults below.

VariableDefaultStatusPurpose
TAOG_ADDR:8115LiveListen address for REST, SSE, and MCP.
TAOG_DB_PATH./data/taog.dbLiveSQLite database file; WAL and SHM sidecars live beside it. Compose sets /data/taog.db.
TAOG_THUMB_DIR./data/thumbsLiveWebP thumbnails and video filmstrip sprites. Compose sets /data/thumbs.
TAOG_QUARANTINE_DIR—T8Destination for the quarantine remediation mode. Files keep their relative path so they can be moved back. Suggested: /data/quarantine.
TAOG_MOUNT_ROOT/mntLiveContainer path where host and NAS storage is bind-mounted. Source root_path values live beneath it.
TAOG_SCAN_CONCURRENCY4LiveGlobal scan worker count. Integers ≥ 1; anything else falls back to 4. Each source also throttles its own mount via io_concurrency.
TAOG_CORS_ORIGIN*LiveSent as Access-Control-Allow-Origin. Pin it to the studio origin when the API is reachable beyond localhost.
TAOG_WEBHOOK_URL—T8Webhook or ntfy endpoint for bit-rot, scan, and remediation alerts.
NEXT_PUBLIC_API_URLhttp://localhost:8115LiveStudio only: build-time API base URL compiled into the browser bundle.

Variables marked T8 are reserved for the Safe Remediation milestone; v0.1.0-alpha ignores them, so setting them early is harmless.

2.2

Read-only host & NAS mounts

Indexing, search, hashing, duplicate analysis, and bit-rot scrubbing only ever read. Bind every data path with :ro so the kernel — not application logic — guarantees your files cannot be modified.

docker-compose.yml · taog-backend
    volumes:      - ./data:/data      # Unraid user shares      - /mnt/user:/mnt/user:ro,rslave      # NFS / SMB shares mounted on the host (fstab, autofs, systemd)      - /srv/nas:/mnt/nas:ro,rslave      # A second disk or VM export      - /mnt/backups:/mnt/backups:ro,rslave

What the flags do

FlagEffect
roThe mount is read-only inside the container. Writes fail with EROFS no matter what any API call or UI action requests.
rslaveRecursive, one-way propagation from host to container. Shares that mount after Taog starts — autofs NFS, SMB, USB disks, an Unraid array coming online after Docker — appear inside the container without a restart. Nothing mounted inside the container leaks back to the host.

Checking propagation

rslave only receives events if the host path sits on a shared mount. systemd makes / shared by default; verify, and fix if needed:

host shell
$ findmnt -o TARGET,PROPAGATION /mnt# PROPAGATION should read "shared". If it says "private":$ sudo mount --make-rshared /mnt

Docker Desktop on macOS and Windows does not support propagation flags on host paths — use plain :ro there. Bind mounts preserve device and inode numbers, which is what lets Taog recognize existing hardlinks across paths.

2.3

Registering sources

A source is a named root to index. root_path is a container path, so it lives under TAOG_MOUNT_ROOT.

shell
$ curl -sS -X POST http://localhost:8115/api/v1/sources \    -H 'Content-Type: application/json' \    -d '{"name":"media","host":"nas-01","root_path":"/mnt/user/media","io_concurrency":2}'
FieldTypeRequiredNotes
namestringyesUnique display name. A duplicate returns 409.
hoststringyesHost label shown in results, e.g. nas-01.
root_pathstringyesAbsolute container path to index.
io_concurrencyintegernoParallel I/O for this mount. Values below 1 become 2.
cron_schedulestringnoCron expression saved with the source.

Unknown fields are rejected, and leading or trailing whitespace is trimmed from every string.

3.1

Conventions

TopicBehavior
Base URLhttp://<host>:8115
FormatJSON in and out. Errors are {"error":"message"} with a 4xx/5xx status.
Body limitRequest bodies are capped at 1 MiB.
CORSAccess-Control-Allow-Origin from TAOG_CORS_ORIGIN; methods GET, POST, OPTIONS; headers Content-Type, Authorization. Preflight OPTIONS returns 204.
TimestampsRFC 3339 UTC, e.g. 2026-11-27T19:02:11Z.
3.2

REST endpoints

GET/api/v1/healthLive

Liveness and database probe. db reports SQLite's journal mode in lowercase.

200 · ok
{ "status": "ok", "service": "taog", "version": "0.1.0-alpha", "db": "wal" }
503 · database unreachable
{ "status": "degraded", "service": "taog", "version": "0.1.0-alpha", "db": "error" }
GET/api/v1/statsLive

Index-wide counters for dashboards and agents.

200
{  "source_count": 3,  "file_count": 4812337,  "total_bytes": 38620000000000,  "protected_path_count": 2,  "bitrot_open_count": 1}
500
{"error":"failed to load stats"}
GET/api/v1/sourcesLive

Every registered source.

200
{  "sources": [    {      "id": 1,      "name": "media",      "host": "nas-01",      "root_path": "/mnt/user/media",      "enabled": true,      "io_concurrency": 2,      "cron_schedule": "",      "last_scan_at": null,      "created_at": "2026-11-27T19:02:11Z"    }  ]}
500
{"error":"failed to list sources"}
POST/api/v1/sourcesLive

Register a source. See Registering sources for the body schema.

request body
{ "name": "media", "host": "nas-01", "root_path": "/mnt/user/media", "io_concurrency": 2 }
201
The created source, same shape as an entry in GET /api/v1/sources
400
{"error":"invalid JSON payload"} — malformed JSON or unknown field
400
{"error":"name, host, and root_path are required"}
409
{"error":"source name already exists"}
500
{"error":"failed to create source"}
3.3

Server-sent events

GET/api/v1/eventsLive

A long-lived text/event-stream with Cache-Control: no-cache. A ready event is sent on connect, then a comment keepalive every 25 seconds until the client disconnects.

shell
$ curl -N http://localhost:8115/api/v1/events
stream
event: readydata: {"status":"connected","service":"taog"} : keepalive
browser
const events = new EventSource("http://localhost:8115/api/v1/events"); events.addEventListener("ready", (e) => {  console.log(JSON.parse(e.data)); // { status: "connected", service: "taog" }});

Scan progress, duplicate groups, bit-rot detections, and heals join ready on this stream as the studio is wired up. Clients should ignore event types they do not recognize.

3.4

MCP · JSON-RPC 2.0

POST /mcp accepts one JSON-RPC 2.0 request per HTTP call and answers with application/json. Any agent or script that can POST JSON can use it.

MethodStatusResult
initializeLiveprotocolVersion 2024-11-05, serverInfo, and capabilities.tools.
tools/listLiveThe registered tool catalog with JSON Schema inputs.
tools/callT8Executes a tool. Until T8 it answers -32601.

initialize

shell
$ curl -sS http://localhost:8115/mcp \    -H 'Content-Type: application/json' \    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'
response
{  "jsonrpc": "2.0",  "id": 1,  "result": {    "protocolVersion": "2024-11-05",    "serverInfo": { "name": "taog", "version": "0.1.0-alpha" },    "capabilities": { "tools": {} }  }}

tools/list

shell
$ curl -sS http://localhost:8115/mcp \    -H 'Content-Type: application/json' \    -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
response
{  "jsonrpc": "2.0",  "id": 2,  "result": {    "tools": [      {        "name": "taog_search_files",        "description": "Search indexed filenames, paths, OCR text, subtitles, and archive contents via SQLite FTS5.",        "inputSchema": {          "type": "object",          "properties": { "query": { "type": "string" } },          "required": ["query"]        }      },      {        "name": "taog_storage_growth",        "description": "Query 24h, 7d, or 30d directory growth deltas across indexed hosts and NAS shares.",        "inputSchema": {          "type": "object",          "properties": { "window": { "type": "string", "enum": ["24h", "7d", "30d"] } }        }      },      {        "name": "taog_reclaimable_summary",        "description": "Summarize reclaimable space from exact BLAKE3 duplicates, Merkle folder clones, and perceptual media matches.",        "inputSchema": { "type": "object", "properties": {} }      }    ]  }}

Tool catalog

ToolArgumentsStatus
taog_search_filesquery: stringRegistered
taog_storage_growthwindow?: "24h" | "7d" | "30d"Registered
taog_reclaimable_summarynoneRegistered
taog_bitrot_statusstatus?: "open" | "healed" | "all"T8
taog_storage_tierssource_id?: integerT8

Registered tools appear in tools/list today; executing them through tools/call ships with T8. Argument shapes for T8 tools may still change.

Errors

CodeMessageWhen
-32700parse errorThe body is not valid JSON. HTTP 400, id is null.
-32601method not foundUnknown or not-yet-implemented method. HTTP 200.

From an agent

node / browser
const res = await fetch("http://localhost:8115/mcp", {  method: "POST",  headers: { "Content-Type": "application/json" },  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" }),}); const { result } = await res.json();console.log(result.tools.map((t) => t.name));
4.1

Layers of protection

Taog is designed so that the destructive half of storage management is the hardest half to trigger by accident. Protection is layered from the kernel up — each layer holds even if the one above it fails.

  1. L1Read-only mountsKernelData mounted :ro cannot be written, full stop.Live
  2. L2Protected PathsIndex + plannerReference-only directories are never remediation targets.T8
  3. L3#keep-forever tagsIndex + plannerPinned files are excluded from every plan.T8
  4. L4Dry-run plansPlannerEvery action is previewed with exact ops and bytes first.T8
  5. L5Donor verificationSelf-healerHealing copies only bytes that verify on disk.Live

The protected_paths, tags, and file_tags tables already exist in the v0.1.0-alpha schema and /api/v1/stats reports protected_path_count; planner enforcement arrives with T8.

4.2

Protected Paths

T8

A Protected Path is a reference-only directory. Files beneath it can be the keeper in a duplicate group — never the target. Every remediation plan is validated against protected_paths before a single filesystem call is made.

Good candidates: the canonical photo library, a backup target, and anything another tool manages — such as a media library hardlinked to a torrent client's seeding directory.

4.3

#keep-forever virtual tags

T8

Tags live in the index, never on disk: no extended attributes, no sidecar files, no renames. #keep-forever pins a file so it is excluded from every remediation plan regardless of mode or auto-selection rule. #archive marks intentional cold storage.

Auto-selection rules — Keep Newest, Keep Oldest, Keep Highest Resolution, and Path Priority — choose the keeper in each duplicate group. Protected Paths and #keep-forever always win over a rule.

4.4

Dry-run remediation

T8

Every action is expressed as a plan. Submit it with dry_run: true to receive the validated operation list and byte totals without touching disk, review it, then submit the same plan with dry_run: false.

remediate.Plan
{  "mode": "quarantine",  "target_paths": ["/mnt/user/photos/dupes/IMG_0412 (1).CR3"],  "dry_run": true}
ModeEffectReversible
quarantineMoves the file into TAOG_QUARANTINE_DIR, preserving its relative path.Yes — move it back
hardlinkReplaces the duplicate with a hardlink to the keeper. Same filesystem only.Content preserved
symlinkReplaces the duplicate with a symlink to the keeper.Content preserved
deleteUnlinks the duplicate.No
fix_extensionRenames the file to the extension that matches its sniffed MIME type.Yes — rename back
heal_bitrotRestores rotted bytes from a verified donor (see below).Restores the original
4.5

Bit-rot donor verification

Live

A scrub re-hashes each indexed file with streaming BLAKE3. A mismatch is recorded as bit-rot only when size and mtime match the index before, during, and after a complete read and the file was not swapped mid-read. Anything else — edited, replaced, written while hashing — counts as a legitimate change and waits for the next scan. Detections persist even if the scrub is cancelled.

The healing pipeline

  1. 01

    Re-check the target

    The event must still be open, the indexed digest must still equal the expected digest, and the file's size and mtime must still match the index. A file that was legitimately edited after detection is never overwritten (ErrTargetChanged).

  2. 02

    Resolve paths defensively

    Absolute paths, NUL bytes, .. segments, and symlinks that resolve outside the source root are refused, and the target must be a regular file (ErrUnsafePath).

  3. 03

    Retry the target first

    If the target now hashes clean — the mismatch was a transient read fault — the event closes and nothing is copied.

  4. 04

    Verify the donor on disk

    Each duplicate candidate is re-hashed with BLAKE3 before use. Hardlinks of the target (same inode, therefore the same rotten bytes) are rejected, and a donor that fails to read or verify is skipped in favor of the next.

  5. 05

    Stream into a temp file beside the target

    Same directory, same filesystem — so the final rename is atomic. The bytes are hashed as they are written, and the temp file is verified again.

  6. 06

    Restore metadata, rename, verify

    The temp file receives the target's mode and mtime, atomically replaces it, and the result is hashed one final time before the event is marked healed.

5.1

Reverse proxy

Server-sent events need response buffering disabled, or updates arrive in delayed bursts. The 25-second keepalive keeps idle streams under typical 60-second proxy timeouts.

nginx · SWAG
# SWAG / nginx: Taog API, live events, and MCP behind one hostnamelocation /api/ {    proxy_pass http://taog-backend:8115;} location = /api/v1/events {    proxy_pass http://taog-backend:8115;    proxy_http_version 1.1;    proxy_set_header Connection "";    proxy_buffering off;          # stream events as they happen    proxy_cache off;    proxy_read_timeout 1h;        # keepalives arrive every 25 s} location = /mcp {    proxy_pass http://taog-backend:8115;} location / {    proxy_pass http://taog-frontend:3000;}

When the studio and API share one public hostname, rebuild the studio with NEXT_PUBLIC_API_URL set to that hostname and pin TAOG_CORS_ORIGIN to it.

5.2

Troubleshooting

SymptomFix
Backend exits on start with a database errorThe container runs as the unprivileged taog user (UID 1000). If Docker created ./data as root, hand it over: sudo chown -R 1000:1000 ./data.
Studio shows BACKEND OFFLINEYour browser cannot reach NEXT_PUBLIC_API_URL. See Browsing from another machine.
Health returns 503 degradedThe SQLite file is unreachable or locked. Check that TAOG_DB_PATH is on local disk.
New NAS shares are missing inside the containerThe host path is not a shared mount. See Checking propagation.
Live events arrive in burstsDisable proxy buffering for /api/v1/events.
5.3

Build from source

backend · Go 1.25+
$ cd backend$ CGO_ENABLED=0 go test ./...$ CGO_ENABLED=0 go run ./cmd/server
studio · Node.js 24+
$ cd frontend$ npm install$ npm run typecheck$ npm run dev

The backend is pure Go (modernc.org/sqlite, lukechampine.com/blake3) and cross-compiles without a C toolchain. Issues and pull requests are welcome on GitHub.