⌂ Self-hosting

Immich: the family photo library hosted at home

Immich as a self-hosted alternative to commercial photo services: phone backup, face recognition, external libraries and how to keep your data safe.

Photos are almost always the data a family cares about most, and they are also what takes up the most space in cloud subscriptions. Immich is an open source project built precisely for this: an application that reproduces the experience of the big photo services (automatic upload from the phone, search by faces and content, shared albums) but with the files on your own hardware.

How Immich is built

Immich is installed with Docker Compose using the file provided by the project. The main components are:

  • the server, which handles the API, the web interface and processing jobs;
  • the machine learning service, which detects faces and builds the indexes for semantic search (you can type "beach at sunset" and find matching photos);
  • PostgreSQL with a vector extension, where metadata and indexes are stored;
  • Redis (or a compatible equivalent) for job queues.

The heaviest load comes in the first weeks, when thumbnails are generated, videos transcoded and faces analysed across the whole library. On a modern mini PC, processing tens of thousands of photos can take days; after that the work becomes incremental and light. The machine learning service can also run on another, more powerful machine, leaving the server on a more modest device.

Backing up from the phone

The mobile app, for Android and iOS, automatically uploads new photos and videos. A few settings deserve attention:

  1. Album selection. You choose which phone folders to upload: the camera, yes; messaging app folders, perhaps not.
  2. Background upload. On iOS the system limits background activity, so uploading is more reliable if you open the app now and then or while the phone is charging.
  3. Wi-Fi only. For long videos it is better to avoid uploading over mobile data.
  4. Freeing up space. The feature that deletes already uploaded photos from the phone should only be used when you are sure a backup of the server exists too.

External libraries: don't move everything

If you already have an archive organised in folders, perhaps on a NAS, you don't have to import it again. Immich supports external libraries: folders mounted read-only that are indexed without copying the files. It is the ideal solution for historical archives, scans of old prints or folders curated by hand over the years.

An example mount in the Compose file:

volumes:
  - ${UPLOAD_LOCATION}:/usr/src/app/upload
  - /mnt/archivio/foto:/mnt/archivio:ro

The :ro suffix guarantees that Immich cannot modify the original files, an excellent habit for any precious archive.

Organising and sharing

Face recognition groups people automatically; you only need to name the groups and merge duplicates. Photos are sorted by the capture date read from EXIF metadata, so an archive with wrong dates (scans, photos received in chats) will look messy: Immich lets you fix date and location, even on many items at once.

For a family, these are useful:

  • separate users, each with their own library and a storage quota;
  • partner sharing, which shows another person's photos in your own timeline;
  • shared albums between users or via links, with expiry and password.

Updates: always read the notes

Immich is developed at a fast pace, and in the past some versions have required manual changes to the Compose file or environment variables. The rule is simple:

  • pin the image version instead of using a generic tag;
  • read the release notes before updating, looking for the section on breaking changes;
  • update one version at a time if you have fallen behind.

Protecting the library

An Immich backup has two parts, and you need both:

What Why
Upload folder contains the original photo and video files
PostgreSQL database contains albums, faces, users, descriptions and edited metadata

Immich periodically writes an automatic database dump into the upload folder, but you should check that it is enabled and that the folder is included in the offsite copy. A library without its database can be rebuilt from the files, but you lose albums, people's names and manual corrections.

Thumbnails and transcoded videos, on the other hand, can be regenerated and do not have to be included in the remote backup: excluding them reduces the space used.

To expose it or not

To upload photos while away from home you need remote access or a VPN. The most cautious solution is a private network between your own devices; if you prefer public access, use HTTPS, strong passwords and, where possible, a centralised authentication system in front of the service.

In short

  • Immich offers automatic upload, search by faces and content, and shared albums with the data at home.
  • The initial processing is long, then the load becomes light.
  • Read-only external libraries avoid duplicating archives that are already organised.
  • Release notes must be read before every update.
  • The backup must include both the original files and the database.
MM
Marco Marzaduri

Marco Marzaduri works in cybersecurity, digital forensics and web development. A computer science graduate, he combines rigorous technical analysis with attention to the people who use technology.

Read also