By Chirag Patil · · 4 min read
Self-Hosting Photos with Immich: An Architectural Deep Dive
A deep dive into self-hosting your photos and videos with Immich, exploring its architecture, features like semantic search and facial recognition, and backup strategies.
It costs me nothing, i know the internals and architecture and i can add new features myself if i want to.
I have always wanted an open-source solution for all my photos and media. I've tried Google Photos and it's awesome. The best features being face recognition and semantic search. However, looking at the plans from a third-world country the prices outright don't make sense.

Barely anyone I know has any media less than 100GB and most likely you'd be accumulating something between 100 GB and 1TB in 10 years of time for which I have to buy a 2TB plan half of which I will never use.
Then I left my unified photo and video management dream aside for a while. In my undergrad university, I got access to 1TB of OneDrive storage. This wasn't explicit and is something that I hacked around and found out. So naturally, I backed everything up there for a few years, the size of which they later reduced and I couldn't upload anything up there. So I kept it as is knowing that Microsoft won't delete my data.
Later I even performed a stunt of downloading my ~300GB and uploading it to Google Cloud cold storage. Surprisingly the GCS bucket (standard) costs similar to what Google storage pricing offers. Google can afford this because they have datacenters themselves.
A few days back I found out about Immich and around the same time, I had upgraded my old laptop which I had been on an upgrade sprint and had some issues as well.
The setup is pretty straightforward, a few hiccups but now you have AI to help you out so anyone having some experience with a Linux terminal should be able to set it up.
Here is the quick start guide: https://immich.app/docs/overview/quick-start
My favorite features about this app are semantic search and facial recognition, and all of this is deployed on your own machine. This felt really cool to me. The data scientist inside me was even more excited when I found out it uses Postgres for metadata management.
Here is how your Immich will look like after the setup. I was surprised when I unzipped and brought together data from all the oddly stored sources together that it would end up being ~550GB.

Semantic search is awesome:

Knowing that it could do all of these cool things, I set out to explore more on how it works. So here's how it works:
The system is architected as a containerized, microservices-based platform.
Core services are:

immich-server: A Node.js TypeScript app which is the primary API gateway and is responsible for validating users, Postgres search, and starting jobs.

immich-machine-learning: This is a FastAPI application for externalizing ML away from TypeScript to Python native ML libraries. It can use a hardware accelerator for speeding up the process. It uses the CLIP embedding model for search over Postgres vector pgvector extension and buffalo_l facial recognition model with DBScan algorithm for face clustering. You can change the embedding model and tweak settings at admin/system-settings?isOpen=machine-learning.

immich-postgres: Storage for all application metadata, including users, assets, albums, and vector embeddings for ML features.
immich-redis: Manages the job queues for all asynchronous background tasks, ensuring API responsiveness.
It even has a CLI for file uploads: https://immich.app/docs/features/command-line-interface
It's been only a few days since I have started this server. It works only locally for now, that is on my home wifi. I am going to use Cloudflare tunnel to access photos over the internet using a domain that I own.
One important consideration is backups. It is recommended to have a 3-2-1 backup strategy:

Right now I have backed up one copy locally in my SSD and soon plan to rsync over to my GCS archive bucket with an estimated ~INR 100 per month along with a one-time setup cost of INR 500 including class A operations.
This essay keeps its original canonical home at blog.lordpatil.com.