π§ Why I Did This
Google Photos is a popular and convenient option for storing and managing your photos β no doubt. But once you run out of free storage (15GB shared across Gmail, Drive, and Photos), youβre stuck either:
Paying a monthly fee
Compressing your precious photos
Or manually managing space
And beyond storage, there's another issue - your data lives on someone else's servers, often scanned, categorized, and used to train models.
Thatβs when I decided to take control and build my own smart photo system. With Immich and Cloudflare Tunnel, I now have:
AI-powered face and object detection
A Google Photosβlike timeline
Unlimited uploads
Zero cost
And most importantly β complete privacy
π What Youβll Get
By the end of this guide, you'll have:
β
A private, feature-rich photo album
β
Accessible from anywhere on your custom domain
β
With face detection, object tagging, and smart search
β
Running entirely on your own device
β
Free, encrypted, and zero third-party storage
π§ Architecture Overview
Immich running locally via Docker
Cloudflare Tunnel to expose it to the internet
Custom domain (e.g.,
photos.mydomain.com)HTTPS and WAF via Cloudflare
Amphetamine to keep your Mac always awake
Monitoring script to alert you on service downtime
π³ Step 1: Set Up Immich Locally with Docker
Clone and run the official Docker setup:
git clone https://github.com/immich-app/immich.git
cd immich
cp .env.example .env
docker compose up -d Access Immich at http://localhost:2283, register your account, and you're ready to start uploading and tagging.
π Step 2: Expose Immich via Cloudflare Tunnel (Token Method)
Cloudflare Tunnel is magic β it securely exposes your local service to the web without exposing your IP or messing with NAT/firewall.
β Setup:
Sign up at Cloudflare, add your domain
Install
cloudflared:
brew install cloudflaredCreate a tunnel from the dashboard, and copy the one-liner:
cloudflared tunnel run --token <your-unique-token> Run the command β your Immich instance is now live at
https://photos.yourdomain.com!Want it to run on startup? Install it as a background service:
cloudflared service install --token <your-unique-token> π Step 3: Set DNS and Routing in Cloudflare
In your Cloudflare dashboard:
Go to DNS β Add
CNAMEforphotosβ point it toyour-tunnel-id.cfargotunnel.comEnable the orange cloud proxy toggle (for HTTPS + DDoS protection)
Your site is now publicly accessible with end-to-end encryption!
π‘ Keep Your Mac Awake with Amphetamine
Since this setup runs from your Mac, you want to make sure it doesnβt sleep or suspend Docker/tunnel processes.
I used Amphetamine β a free utility to keep your machine awake:
Runs silently in the menu bar
Allows conditional triggers (e.g., keep awake when Docker is running)
Perfect for long-running home servers
π₯οΈ Optional: Run It on an Old Mac Mini or Spare Laptop
To free up your main machine, consider running Immich on:
π§ An old Mac Mini (Intel or M1)
π» A spare laptop (Linux/macOS/Windows with WSL2)
π§ A Raspberry Pi 4 or Jetson Nano (works well, especially with GPU)
Tip: Connect it via Ethernet, and use Amphetamine or caffeinate CLI to prevent sleep.
π Bonus: Minimal Monitoring Script
You can set up a basic check to ensure your Immich server is running and alert you via email or webhook if it crashes.
Here's a sample Bash script (check-immich.sh):
#!/bin/bash
URL="http://localhost:2283"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$STATUS" -ne 200 ]; then
echo "Immich down! Status: $STATUS" \
| mail -s "Immich Alert" you@example.com
fi
Run it via cron every 5 minutes:
*/5 * * * * /path/to/check-immich.sh
Or integrate with Slack/Webhook/Pushover for mobile alerts.
π§ Immich Features You'll Love
πΈ Face recognition and grouping
π§ Object detection (e.g., find βbeachβ or βbikeβ photos)
π Smart search by date, location, or tags
π Google Photosβlike timeline
ποΈ Custom albums
π² Mobile app for auto-uploads from iOS/Android
π¨π©π§π¦ Multiple users with shared albums
π Privacy & Security Highlights
Zero third-party access β all media and metadata stays local
Cloudflare handles HTTPS and firewall
No port forwarding β reduces exposure to attacks
Open-source and auditable codebase
β Final Thoughts
With Immich + Cloudflare Tunnel, I now have a fully private, intelligent photo album:
π Free
π Secure
π Globally accessible
π‘ Always running
π§ Packed with AI smarts β all local
This was one of the most satisfying weekend projects Iβve done β and now I own my memories, fully.
π Resources
Cloudflare Tunnel Docs
Photo by Soragrit Wongsa on Unsplash