# Building a Self-Hosted Photo Library That Survives

A self-hosted photo library offers more control than a commercial cloud service, but storage is only the first concern. A useful system also needs automatic uploads, searchable metadata, thumbnail generation, duplicate detection, and reliable access from phones. I run the application in containers on a small home server, with originals stored on mirrored disks and the database kept on fast local SSD storage.

## Storage and Deployment

The photo directory is mounted read-write only where the application needs it. Database files, thumbnails, and machine-learning indexes live in separate volumes so they can be backed up and restored independently. A minimal Compose service might look like this:

```yaml
services:
  photos:
    image: ghcr.io/example/photos:stable
    volumes:
      - /srv/photos/originals:/library
      - photo-cache:/var/lib/photos
    restart: unless-stopped
```

## Importing and Organizing Photos

Phones upload over Wi-Fi using the library’s mobile client, while camera files arrive through a watched import directory. The server calculates checksums before moving originals into a date-based folder structure, preventing accidental duplicates without relying on filenames. EXIF timestamps remain the primary source of truth, with filesystem modification times used only when metadata is missing.

## Search, Faces, and Performance

Search quality depends heavily on background processing. Thumbnail generation is inexpensive, but face recognition and semantic search can consume substantial CPU and memory after a large import. Scheduling those jobs overnight keeps the interface responsive, and storing generated assets on SSD avoids making every timeline view wait on slower archival disks.

## Backups and Remote Access

Mirroring is not a backup, so originals are copied nightly to encrypted external storage and periodically replicated off-site. Database dumps are included because albums, edits, labels, and sharing permissions may not exist in the image files themselves. Remote access runs through a reverse proxy with TLS and multi-factor authentication; the photo service is never exposed directly to the internet.

## Operational Lessons

The most important maintenance task is testing recovery. Once a quarter, I restore the database and a sample of originals into an isolated instance, then verify that albums, thumbnails, and metadata still match. Self-hosting adds operational work, but a documented restore process turns a collection of disks and containers into a photo library that can realistically last for decades.