← Blog

Building a local-first photo library

The usual choices for photo storage

There are two possibilities: cloud hosting or self-hosting. Self-hosting with something like Immich gives you more control, but you're responsible for keeping things running, updating the server, etc. If you don't want this mental load, some cloud services like Ente or Zeitkapsl offer encryption and replication.

So what's the issue? Well, what if the cloud service messes up? You lose everything. That's why you're supposed to make a backup.

The backup problem

The 3-2-1 rule sounds simple: three copies, two types of storage media, one copy offsite.

Actually, I have no idea who does that. Because cloud services and self-hosted solutions usually focus on storing the data and database in one location, there is no native solution to duplicate them onto another medium.

I know some people who actually run cron jobs to regularly rsync the Immich data folder to another location, though...

My take is that storage, storage replication, and backup should be handled within the same app.

Why local-first

The idea is simple: keep part of the library state on the device, make changes locally, and sync when storage is available. You can sync to any kind of storage: an S3-compatible bucket, a NAS, or an external drive.

In practice, you could sync regularly to your home NAS, then plug in a backup drive once a week. Add a remote bucket for an offsite copy. Or skip the NAS and use cloud storage plus a drive. The destinations do not all need to be connected at once.

The problems move

With a local-first app, you don't have a server to run and maintain, but, as always, the problem shifts to concurrency. Two devices can change the library while offline, and changes can arrive in different orders. And two devices might try to sync at the same time. But Lasco uses algorithms specifically designed to handle this (CRDTs).

Where Lasco is today

Lasco has iOS and Android apps. It syncs to NAS storage over SMB, USB drives, S3-compatible buckets, and Lasco Cloud. Photos and library data are encrypted before reaching storage.