HUB
Sign inSign up

samuelstreets/immich-share

By samuelstreets

โ€ขUpdated 25 days ago

Image
0

9.9K

samuelstreets/immich-share repository overview

โ ๐Ÿ–ผ๏ธ Immich Share

A self-hosted web app that sits alongside your Immichโ  instance and lets you share albums or photos with anyone via a password-protected URL โ€” no Immich account required.

โ Features

  • ๐Ÿ”’ Password-protected shares โ€” each share has its own password
  • ๐Ÿ”‘ Passwordless access โ€” generate a token-in-URL link (no password prompt)
  • ๐Ÿ“ Album or tag shares โ€” share a whole Immich album or assets by tag
  • โฑ Expiry dates โ€” shares can auto-expire
  • ๐Ÿ‘ Max view limits โ€” auto-disable a share after N views
  • โฌ‡ Optional downloads โ€” control whether viewers can download originals or a ZIP
  • โฌ† Optional uploads โ€” let viewers contribute photos back to the album (chunked, no file-size limit)
  • ๐Ÿท Auto-tag uploads โ€” automatically apply Immich tags to every uploaded asset
  • ๐Ÿ‘€ Album watcher โ€” periodically tags new assets added to watched albums
  • ๐Ÿ’พ Local sync โ€” keep an album's thumbnails, previews and originals on this server's disk; uploads are saved locally first, then forwarded to Immich
  • ๐Ÿ”— Custom slugs โ€” friendly URLs like /s/summer-2024
  • ๐ŸŒ External URL config โ€” set the public URL used in share links
  • ๐Ÿ–ผ Lightbox viewer โ€” full-screen photo/video viewer with pinch-to-zoom, drag-to-pan, and keyboard navigation
  • โœ… Drag-to-select โ€” select multiple photos in the gallery and bulk-download as ZIP
  • ๐Ÿ“Š Admin dashboard โ€” stats, per-share activity charts, access logs with export (CSV/JSON)
  • ๐Ÿ”” Notification triggers โ€” email (SMTP) and webhook alerts for uploads, first view, view limit reached, failed password, expiry reminders and expiry; toggle each in Settings
  • ๐Ÿ“ท Photo metadata โ€” optional per-share details panel (camera, lens, exposure, size, date) with an opt-in location (GPS) toggle
  • ๐Ÿ” Two-factor authentication โ€” TOTP (Google Authenticator, Authy, etc.) for the admin login
  • ๐Ÿงน Scheduled cleanup โ€” auto-purge expired shares and orphaned upload chunks
  • ๐Ÿ“ฑ Mobile-friendly admin โ€” responsive sidebar + bottom nav for phones
  • ๐Ÿณ Single Docker container โ€” easy to self-host

โ Quick Start (Docker Compose)

# 1. Clone the repo
git clone https://github.com/YOUR_USERNAME/immich-share.git
cd immich-share

# 2. Create your .env file
cp .env.example .env
# Edit .env โ€” set JWT_SECRET at minimum

# 3. Start
docker compose up -d

# 4. Open http://localhost:3000
# Login: admin / <ADMIN_PASSWORD from .env>
#   If ADMIN_PASSWORD is unset, "admin" or under 8 chars, a random password is
#   generated on first boot and printed once in the container logs
#   (docker compose logs immich-share). Change it in Settings.

โ Configuration

Settings can be configured via environment variables (seed on first boot) or the admin UI โ†’ Settings page at any time.

VariableRequiredDescription
JWT_SECRETYesLong random string for signing admin tokens. Min 32 chars.
IMMICH_URLNo*URL of your Immich instance, e.g. http://192.168.1.100:2283
IMMICH_API_KEYNo*API key from Immich โ†’ Account Settings โ†’ API Keys
EXTERNAL_URLNo*Public URL of this app โ€” used in share links
ADMIN_PASSWORDNoInitial admin password (first run only, min 8 chars). If unset or weak, a random one is generated and logged once
PORTNoPort to listen on (default: 3000)
DB_PATHNoPath to SQLite database (default: /app/data/app.db)
TRUST_PROXYNoNumber of reverse proxies in front of the app (default: 1). Set to 0 if the port is exposed directly โ€” otherwise clients can spoof X-Forwarded-For and bypass the login rate limits
ALLOWED_ORIGINSNoNewline-separated list of allowed CORS origins (empty = allow all)
SMTP_HOSTNoSMTP server hostname for email notifications
SMTP_PORTNoSMTP port (default: 587)
SMTP_USERNoSMTP username
SMTP_PASSNoSMTP password
SMTP_FROMNoFrom address for notification emails
GLOBAL_WEBHOOK_URLNoWebhook URL fired for enabled notification events across all shares
GLOBAL_WEBHOOK_SECRETNoHMAC-SHA256 signing secret for the global webhook
CLEANUP_INTERVAL_MSNoHow often the cleanup job runs (default: 30 minutes)
MEDIA_RATE_LIMITNoMax thumbnail/preview/download requests per IP per 15 min (default: 30000)
WATCH_INTERVAL_MSNoHow often the album watcher runs (default: 5 minutes)
LOCAL_SYNC_INTERVAL_MSNoHow often local-sync shares are re-synced with Immich and pending uploads retried (default: 5 minutes)
LOCAL_SYNC_CONCURRENCYNoParallel file downloads during a sync (default: 3)
CACHE_DIRNoWhere local-sync files are stored (default: cache/ next to the database, i.e. /app/data/cache)

*These can be set via the Settings UI after first boot.


โ Getting an Immich API Key

  1. Open your Immich web UI
  2. Click your profile icon โ†’ Account Settings
  3. Go to API Keys โ†’ New API Key
  4. Copy the key and paste it into the Settings page (or .env)
โ Required API Key Permissions
PermissionWhy it's needed
album.readList and browse albums in the share creation UI
album.statisticsFetch album asset counts for the admin UI
albumAsset.createAdd uploaded assets to the shared album
asset.readFetch asset metadata
asset.viewServe thumbnails and preview images to share viewers
asset.downloadProxy original file downloads to share viewers
tag.readList tags so you can create tag-based shares
asset.upload(upload-enabled shares) Let viewers upload photos into Immich
tag.asset(upload tags / album watcher) Apply tags to assets automatically

Note: An admin Immich account key has all permissions by default. Scoped permissions apply when using Immich v1.100+ fine-grained API keys.

Full Immich permission reference
ScopePermissions
activityactivity.create activity.read activity.update activity.delete activity.statistics
apiKeyapiKey.create apiKey.read apiKey.update apiKey.delete
assetasset.read asset.update asset.delete asset.statistics asset.share asset.view asset.download asset.upload asset.replace asset.copy asset.derive asset.edit.get asset.edit.create asset.edit.delete
albumalbum.create album.read album.update album.delete album.statistics album.share album.download
albumAssetalbumAsset.create albumAsset.delete
albumUseralbumUser.create albumUser.update albumUser.delete
authauth.changePassword
authDeviceauthDevice.delete
archivearchive.read
backupbackup.list backup.download backup.upload backup.delete
duplicateduplicate.read duplicate.delete
faceface.create face.read face.update face.delete
folderfolder.read
jobjob.create job.read
librarylibrary.create library.read library.update library.delete library.statistics
timelinetimeline.read timeline.download
maintenancemaintenance
mapmap.read map.search
memorymemory.create memory.read memory.update memory.delete memory.statistics
memoryAssetmemoryAsset.create memoryAsset.delete
notificationnotification.create notification.read notification.update notification.delete
partnerpartner.create partner.read partner.update partner.delete
personperson.create person.read person.update person.delete person.statistics person.merge person.reassign
pinCodepinCode.create pinCode.update pinCode.delete
pluginplugin.create plugin.read plugin.update plugin.delete
serverserver.about server.apkLinks server.storage server.statistics server.versionCheck
serverLicenseserverLicense.read serverLicense.update serverLicense.delete
sessionsession.create session.read session.update session.lock
sharedLinksharedLink.create sharedLink.read sharedLink.update sharedLink.delete
stackstack.create stack.read stack.update stack.delete
syncsync.stream
syncCheckpointsyncCheckpoint.read syncCheckpoint.update syncCheckpoint.delete
systemConfigsystemConfig.read systemConfig.update
systemMetadatasystemMetadata.read systemMetadata.update
tagtag.create tag.read tag.update tag.delete tag.asset
useruser.read user.update
userLicenseuserLicense.create userLicense.read userLicense.update userLicense.delete
userOnboardinguserOnboarding.read userOnboarding.update userOnboarding.delete
userPreferenceuserPreference.read userPreference.update
userProfileImageuserProfileImage.create userProfileImage.read userProfileImage.update userProfileImage.delete
queuequeue.read queue.update
queueJobqueueJob.create queueJob.read queueJob.update queueJob.delete
workflowworkflow.create workflow.read workflow.update workflow.delete
adminUseradminUser.create adminUser.read adminUser.update adminUser.delete
adminSessionadminSession.read
adminAuthadminAuth.unlinkAll

โ Share Features

โ Passwordless Access

Generate a static token-in-URL link for a share โ€” visitors open the link and go straight to the gallery without a password prompt. Tokens can be generated or revoked at any time from the Shares admin page.

โ Custom Slugs

Instead of /s/<uuid>, give a share a memorable URL like /s/wedding-photos. Slugs must be 3โ€“60 lowercase alphanumeric characters or hyphens and must be unique.

โ Max Views

Set a view limit on a share โ€” it is automatically disabled once the limit is reached (checked every 30 minutes by the cleanup job).

โ Upload Tags

When uploads are enabled, select one or more Immich tags to be automatically applied to every photo uploaded through that share.

โ Album Watcher

For album shares, configure "watch tags" โ€” the watcher runs every 5 minutes and applies those tags to any assets that have been newly added to the album since the last check.

โ Photo Metadata

Enable Show metadata on a share and viewers get an Info button (or press i) in the lightbox showing date taken, dimensions, file size, camera, lens and exposure. Only a fixed set of EXIF fields is ever sent to viewers. Location (city/country and a map link) is hidden unless you also tick Include location (GPS) on that share.

โ Local Sync

Tick Keep synced locally on a share to copy its album (thumbnails, previews and original files) onto this server's disk. Viewers, downloads and ZIPs are then served from disk instead of going back to Immich on every request, and the share keeps working if Immich is temporarily unreachable.

  • Sync: runs on creation/enable, then every LOCAL_SYNC_INTERVAL_MS (default 5 min), or on demand with Sync now. New assets are downloaded, changed ones refreshed, and assets removed from the album are deleted from the cache. Until the first sync finishes the share is served from Immich as before; any file that failed to cache falls back to Immich.
  • Uploads: when uploads are enabled, a file is saved to the local cache first, shown in the gallery straight away, and forwarded to Immich in the background (added to the album and tagged as usual). If Immich is down it stays queued and is retried every cycle. Once Immich accepts it the local copy is kept as the cached original.
  • Size limits: set a total cache limit under Settings โ†’ Local Sync Cache (0 = unlimited) and, optionally, a per-share limit when editing a share (handy for one 10โ€“20 GB album while others stay small). Both are changeable at any time. Thumbnails and previews are always cached; once a limit is reached, remaining originals are served from Immich instead. Lowering a limit deletes cached originals (newest first) until it fits; raising it fills in the rest on the next sync.
  • Storage: files live under /app/data/cache (inside the immich-share-data volume). Turning local sync off, deleting the share or removing assets frees the space. Size โ‰ˆ the full size of the album's originals, so check free disk space first.
โ ZIP Downloads

By default, "download all" produces one ZIP (ZIP64, so no size limit from the format). Tick Split ZIP downloads into ~2 GB parts on a share to get several smaller ZIPs (max ~2 GB / 500 files each) instead, which is easier on flaky connections and proxies with request timeouts.

โ Notifications

Configure SMTP settings globally, then choose which events trigger alerts under Settings โ†’ Notification Triggers:

EventDefault
A file is uploadedOn
A share is opened for the first timeOff
A share reaches its view limitOff
A wrong password is entered (max 1 alert per IP per 15 min)Off
A share is about to expire (reminder)Off
A share has expiredOff

Alerts are sent to the share's notify email, the admin notification email (if set), the per-share webhook and the global webhook. Webhooks receive a JSON payload with an event field (upload, first_view, view_limit_reached, password_failed, expiry_reminder, expired), signed with HMAC-SHA256 when a secret is set.

Expiry reminders are sent a configurable number of hours before expiry (default 48) by the cleanup job, once per expiry date. Editing a share's expiry date re-arms the reminder.

โ Two-Factor Authentication

Enable TOTP under Settings โ†’ Two-Factor Authentication: scan the QR code with an authenticator app and confirm with a code. Disabling requires your password.


โ Reverse Proxy (nginx example)

server {
    listen 443 ssl;
    server_name share.yourdomain.com;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        # Required for large uploads and downloads
        proxy_buffering off;
        proxy_read_timeout 300s;
        client_max_body_size 0;
    }
}

โ Local Development

โ Prerequisites
  • Node.js 20+
  • An Immich instance
โ Run locally
# Quickstart script (copies .env.example if no .env exists)
./dev.sh

# Or manually:

# Backend
cd backend
cp ../.env.example .env  # edit it โ€” set JWT_SECRET at minimum
npm install
node src/index.js

# Frontend (separate terminal)
cd frontend
npm install
npm run dev
# โ†’ http://localhost:5173 (proxies /api to :3000)
โ Build Docker image locally
docker build -t immich-share .
docker run -p 3000:3000 \
  -e JWT_SECRET=change-me-to-something-long \
  -e IMMICH_URL=http://your-immich:2283 \
  -e IMMICH_API_KEY=your-key \
  -e EXTERNAL_URL=http://localhost:3000 \
  -v immich-share-data:/app/data \
  immich-share

โ Data & Privacy

  • All share metadata is stored in a local SQLite database at /app/data/app.db
  • Photo data is not stored unless a share has Keep synced locally enabled; otherwise all media is proxied directly from your Immich instance
  • Share passwords are bcrypt-hashed (cost factor 10)
  • Admin passwords are bcrypt-hashed (cost factor 12)
  • Share session tokens are HMAC-SHA256 signed, valid for 8 hours
  • Webhook payloads are optionally HMAC-SHA256 signed (X-ImmichShare-Signature: sha256=โ€ฆ)
  • Rate limiting is applied to auth, share-verify, and token-access endpoints

โ License

MIT

Tag summary
Recent tags
Content type
Image
Digest
sha256:c4b0193beโ€ฆ
Size
57.5 MB
Last updated
25 days ago
docker pull samuelstreets/immich-share:latest